Genesys Cloud - Developer Community!

 View Only

Sign Up

Tab/Interaction Sync with Salesforce does not work programmatically.

  • 1.  Tab/Interaction Sync with Salesforce does not work programmatically.

    Posted 05-14-2025 09:07

    We are using the Genesys Cloud for Salesforce (v4.28) and we configured ApexClass Extension points on both OnScreenPop and OnSaveLog extensions.

    For a Genesys WebMessage, a new Case is created for an Account and the Case Id is Screenpopped. This pops the Case when the message alerts. But the case is a sub-tab within the main Account tab (And I think Tab Sync only works with main tabs in Salesforce). The Case Id is associated with the 'Related to' field in the UI Embedded Client. But the Name field is empty... which is understandable as we did not associate the account. To do that, I tried to use the onSaveLog extension point. With this, the Name field in the Salesforce task gets updated, but the Name in UI Embedded Client is still not updated, and the Tab sync does not work automatically. I must click the Account Subtab on the UI so that is available in the list, and then select it manually in the client call Log Name field. Is there a way for me to pop the Case and auto associate the Account for Tab Sync?

    I have Enable Tab/Interaction Sync turned on.

    Here is the OnScreenPop code:
     
    public String onScreenPop(String data) {
    Map<String, Object> jsonData = (Map<String, Object>)JSON.deserializeUntyped(data); 
    Map<String, Object> interaction = (Map<String,Object>)jsonData.get('interaction'); 
    Map<String, Object> attributes = (Map<String,Object>)interaction.get('attributes');
            Map<String, Object> dataToReturn = new Map<String, Object>();
            String msgAccId = String.valueOf(attributes.get('Participant.sfAccountId'));
    String msgCaseId = String.valueOf(attributes.get('Participant.sfCaseId'));
            String url = '';
     
    if(msgCaseId!=''){
    url = msgCaseId;
            }
            else{
            url = 'lightning/page/home';
            }
     
            dataToReturn.put('url',url);
            return JSON.serialize(dataToReturn);
    }
     
    Here is the onSaveLog code:
     
    public String onSaveLog(String data) {
            Map<String, Object> saveLogData = (Map<String, Object>) JSON.deserializeUntyped(Data);
            Map<String, Object> interaction = (Map<String, Object>) saveLogData.get('interaction');      
            Map<String, Object> attributes = (Map<String, Object>) interaction.get('attributes');
            Map<String, Object> callLog = (Map<String, Object>) saveLogData.get('callLog');
           
            Boolean isConnected = false;
            String callLogId = '';
            isConnected=(Boolean) interaction.get('isConnected');
            if(isConnected){
                    Task t = (Task)JSON.deserialize(JSON.serialize(callLog),Task.class);
                    String contactId = '';
                    for(Contact con:[Select Id from Contact Where AccountId =:String.valueOf(attributes.get('Participant.sfAccountId')) LIMIT 1]) { 
                                    contactId = con.Id;    
                    }
                    if(contactId!='')
                                    t.whoId=contactId;
                   
                    upsert t;
                    callLogId = t.Id; 
             }
             return callLogId;
    }

    #EmbeddableFramework
    #Integrations
    #WebMessaging

    ------------------------------
    Ebin Sunny
    ------------------------------