Technical Articles
Companion Doesn’t Know! Companion Doesn’t Know! Let’s Tell Companion!
Hey guys 😉 It’s me again. This time it won’t be about enhancing the standard content review and feedback function in SAP Enable Now with the Content Review Wizard Extension but about our good friend SAP Companion, whose task is to provide all sorts of in-app help relevant to those who request this help. With the first part, SAP Companion has no problem: 75+ SAP applications are supported, and 3rd party products are also welcome to activate SAP Companion. However, there is still some space left for improvements in the latter part.
As we know, SAP Companion uses 4 parameters for selecting relevant learning entities to shoot them in the face of the user (sorry, I’d been playing Borderlands 2 too much during the New Year holidays). These parameters are:
- Product Name, i.e. SAP_S4HANA_ON-PREMISE or SFSF
- Product Version, i.e. 2021.latest or 1805
- Screen Name, i.e. Shell-home or HOME/HOME_TAB/HOME_V4
- System UI Language
Hold on! There is nothing about the user… What if multiple roles have access to the same application screen, like Employee Profile in SAP SuccessFactors, but perform different operations? Therefore, only need help with assets relevant to their role/location/position. Earlier, I showed how to fish for additional information in SAP SuccessFactors and forward it to SAP Companion.
Now, it’s time for Ariba Guided Buying
This is how SAP Companion and Ariba probably feel when using the standard parameters.
How can we share valuable data about the person currently logged in to Ariba Guided Buying with SAP Companion?
The programming language SAP Enable Now is built with?
No-no-no!!!! Not with this elven spell, but with a few lines of JavaScript code added to the standard Ariba Guided Buying Snippet and infamous useConditions=true top secret parameter of the SAP Companion.
Step-by-step Instruction
Step 1. Follow the SAP Companion Integration Guide for Ariba Guided Buying. After creating the Configuration, navigate to the Application tab, expand the Advanced section, locate the Parameters field at the bottom of the dialog window, and add useConditions=true; into it.
Anton + useConditions = LOVE
Step 2. Let’s find values describing the user in Ariba Guided Buying that we can use to increase the content relevance. Log into your Ariba Guided Buying system, and open the Google Chrome or MS Edge developer tools by pressing the F12 key or Ctrl+Shift+i key combination. Switch to the Console tab in the Developer tools and run these 2 commands one by one pressing Enter after each.
let context = JSON.parse(sessionStorage.userContext)
//press Enter
context
//press Enter
Step 3Â Expand the context object by clicking on the small black triangle shape beside it. You’ll see a long list of various values describing the system and the user. Write down parameters that you find helpful, i.e., country, state, companyCode, userPurchaseOrg, to share with the SAP Companion to let it segregate the content for different users.
Step 4Â Make a copy of the standard Ariba Guided Buying Snippet, locate Help4.init() function, and add a few lines similar to mine inside its body that will process previously selected Ariba Guided Buying user session parameters and set them as SAP Companion conditions.
The code highlighted in yellow extracts the values describing the user from the Ariba session storage and saves them in variables.
The code highlighted in aqua sets the SAP Companion conditions and assigns the values saved in variables.
The highlighted code fragment in a copy-pastable format
//extracting user attributes from Ariba session and saving them as variables
let companyCode = JSON.parse(sessionStorage.userContext).companyCode;
let country = JSON.parse(sessionStorage.userContext).country;
let userPurchaseOrg = JSON.parse(sessionStorage.userContext).userPurchaseOrg;
//assigning user attributes to the SAP Companion conditions
Help4.API.setConditions({'companyCode': companyCode, 'country' : country, 'userPurchaseOrg' : userPurchaseOrg});
Step 5. Save your changes, make sure that your Ariba Configuration uses this updated snippet, and refresh the Ariba Guided Buying window where your SAP Companion is running. Open the browser developer tools and execute the command in the Console.
Help4.API.getConditions()
//press Enter
If you did everything correctly, you should see the list of conditions and user-related values gently picked from the Ariba 😉
Open the SAP Companion editor window. You’ll see the Conditions tab and familiar parameters you can assign to the help tile or link or the guided tour step to show them to only those who met these conditions.
All the best, and see you next time!
Nice work (as always!). I'm assuming this use of conditions could work for any 3rd-party app you build your own Snippet for, assuming the app provides usable context values?
...and given that the Help4 API already includes a roles parameter (and useConditions), can we expect to see this extended to SAP products in the near future??
Hi, Dirk
Thank you so much for your feedback.
You are absolutely right. As long as you can obtain something from the application that you might find useful, you may use it as SAP Companion Conditions. For Ariba it works like a charm, because the SAP Companion integration is done by a snippet (script), so by modifying that script, one can add more sophisticated logic there. Same applies to any other Companion integration done with a snippet.
I've heard some rumors that SAP Enable Now team is looking forward to announce the SAP Companion conditions API officially in March this year. Also, there is work in progress to add the conditions to the SAP Companion in SAP SuccessFactors.
Probably, there are other exciting things to come, that I'm not aware of yet. Kristina Kunad definitely knows, but her lips are sealed with an NDA 😉
Hi Dirk and Anton,
indeed this topic is already on the SAP Enable Now roadmap, so you can look forward to seeing it in the official product soon!
There are definitely many other exciting things to come, and who am I to spoil the surprise 🙂
Take care,
Kristina
Hello Anton,
Has this approach been tried out for SuccessFactors? I ask this as in our deployment of Employee Central, we are using SAP Companion to aid users, but we only want to display Tiles/Guided Walkthroughs to specific roles.
Great article by the way!
kind regards
Andrew