How can I get information from the logged in user and show it in a Flexcard in Omnistudio?
In Apex we can use the UserInfo
class, but in Omnistudio how do I do that in a Dataraptor, Integration Procedure or Flexcard?
How can I get information from the logged in user and show it in a Flexcard in Omnistudio?
In Apex we can use the UserInfo
class, but in Omnistudio how do I do that in a Dataraptor, Integration Procedure or Flexcard?
There are a number of environment variables that we can use for DataRaptors and Integration Procedures according to this Salesforce doc: https://help.salesforce.com/s/articleView?id=sf.os_environment_variables_in_dataraptors_and_integration_procedures_47878.htm&type=5
For our use case, we can use the '$Vlocity.UserId' environment variable. Make sure you put single or double quote around it though when you use it. See screenshot below for how that works in a DataRaptor.
Update (March 18, 2023): I dug deeper into Saleforce docs and found a list of context variables, like {User.userId} that we can use to get the current user Id for flexcards. You can check out the list at: https://help.salesforce.com/s/articleView?id=sf.os_flexcards_context_variables.htm&type=5