I am new to Einstein analytics. I want to show the current User's name on the Einstein analytics dashboard. Can anyone please help me to do it.I have a text widget and I have added welcome note. But I need to add the current user's name. Thank you. Regards, Sujendran.
2 Answers
That's actually not quite that hard.
Create a new query (pick any dataset) with the following SAQL
q = load \"MyDataset\";
q = group q by all;
q = foreach q generate \"!{User.Name}\" as UserName;
The important part is the !{User.Name}. This obviously gives you the Name of the current logged in User. For other options besides Name, refer to Salesforce help
Then all that is left is binding this in your Text widget, like
"text": "Hello {{cell(lens_1.result, 0, \"UserName\").asString()}}",
hi you can do this with the binding and soql step
first :-- "UserData": { "groups": [], "numbers": [], "query": "SELECT Username, Country, FirstName, LastLoginDate FROM User WHERE Name = '!{user.name}'", "selectMode": "single", "strings": [ "Username", "Country", "FirstName", "LastLoginDate" ], "type": "soql" }
you have to create a SOQL query like this and then
Second:--- "Billing_Country_2": { "groups": [], "isFacet": true, "label": "Billing Country", "numbers": [], "query": "q = load \"Opp_Icons\";\n q = group q by 'Billing_Country';\n q = foreach q generate 'Billing_Country' as 'Billing_Country', sum('Amount') as 'sum_Amount';\n q = order q by 'sum_Amount' desc;", "selectMode": "multi", "start": "{{cell(UserData.result, 0, \"Country\").asObject() }}", "strings": [], "type": "saql", "useGlobal": true }
Do binding like this :-- you can also refer to https://developer.salesforce.com/docs/atlas.en-us.bi_dev_guide_bindings.meta/bi_dev_guide_bindings/bi_dashboard_bindings_wave_designer_initial_selections.htm for more help