Genesys Cloud for Salesforce. Extension Point call to visualforce

Hello,

We are using Genesys Cloud for Salesforce and have a problem. The system automatically makes a search in every Salesforce object searching for a match with the caller's number. We can't use that because we want certain fields to not be searched. Genesys support recommended to use External Points in order for the search to be custom. In one the conditions the class would return a visualforce that should show the results of the search. However, the visualforce loads without data. If we use the standard version, without External Points the visualforce loads with data. I am going to share the apex controller an the External Points to make it more clear. The visualforce page just calls the controller.

Apex controller:

public class FlowRedirectController {

public PageReference redirectToFlow() {

// Obtén el parámetro de la página actual

String phone = ApexPages.currentPage().getParameters().get('key');

// Construye el argumento del flujo con el parámetro

String flowArgs = '[{"name":"Phone","type":"String","value":"' + phone + '"}]';

// Codifica el argumento para la URL

String encodedFlowArgs = EncodingUtil.urlEncode(flowArgs, 'UTF-8');

// Construye la URL del flujo en Lightning Experience

String flowUrl = '/lightning/page/recordActionFlow?lightning__flowDevName=CTI_ScreenFlow_GestionDeContactosMultiples&lightning__flowArgs=' + encodedFlowArgs + '&lightning__isMandatory=false&lightning__isServiceCatalogFlow=false';

// Redirige a la URL del flujo en Lightning

PageReference pageRef = new PageReference(flowUrl);

pageRef.setRedirect(true);

return pageRef;

}

}

External point:

global class MyCTIExtensions implements purecloud.CTIExtension.ScreenPop{

public String onScreenPop(String data){

Map screenPopData = (Map) JSON.deserializeUntyped(data);

Map dataToReturn = new Map();

String phoneNumber = (String) screenPopData.get('searchValue');

if (String.isNotBlank(phoneNumber)){

String phone = '%910782475';

List cases = [SELECT Id FROM Account WHERE Phone LIKE :phone ORDER BY LastModifiedDate DESC];

if(cases.size() > 1) {

dataToReturn.put('url','/lightning/page/recordActionFlow?lightning__flowArgs=%5B%7B%22name%22%3A%22Phone%22%2C%22type%22%3A%22String%22%2C%22value%22%3A%22null%22%7D%5D&lightning__flowDevName=CTI_ScreenFlow_GestionDeContactosMultiples&lightning__isMandatory=false&lightning__isServiceCatalogFlow=false' /cases.get(0).Id/);

return JSON.serialize(dataToReturn);

}else if (cases.size() > 0) {

dataToReturn.put('url',cases.get(0).Id);

return JSON.serialize(dataToReturn);

}

}

dataToReturn.put('defaultScreenPop', true);

return JSON.serialize(dataToReturn);

}

}

How can we populate the data?

Thanks for your help.

This topic was automatically closed 31 days after the last reply. New replies are no longer allowed.