If you’re writing C++ code:
You can fetch a uint8 Blackboard KeyID by using an FName that matches the key in the blackboard:
uint8 BlackboardKeyID_Enemy = BlackboardAsset->GetKeyID(EnemyKeyName);
Then you can set values using the appropriate function for the type of key, such as:
Blackboard->SetValueAsObject(BlackboardKeyID_Enemy, EnemyPawn);
(Also, SetValueAsEnum, SetValuesAsClass, SetValueAsVector, SetValueAsName, SetValueAsInt, SetValueAsFloat, SetValueAsBool, etc. See BlackboardComponent.h for the functions). There are corresponding GetValueAs… functions there as well.
If you’re using blueprints:
The functions above (SetValueAs… and GetValueAs…) are all also exposed as nodes in blueprints which can be called from within Behavior Tree blueprint node objects (decorators, tasks, services).
In the blueprint, you can use a variable of type BlackboardKeySelector and set it as Editable to expose the selection to the details view from within the behavior tree itself. That will let you pick a valid entry from the blackboard you are using within the behavior tree (from a dropdown list). Pass that variable into the “Key” input on the Set/Get node.