Configure Salesforce Workflows for CXone Agent

This is the final step of integrating Salesforce with CXone Agent.

You can configure Search, Custom Create, Standard Create, and Update workflows for Salesforce and CXone Agent. These workflows search, create, or update Salesforce records, also called objects. This is the back end configuration of dynamic data mapping.

Workflow Type

Description

Workflows

Search Search workflows scan Salesforce for records that are applicable to the interaction the agent is handling. Search for ANI
Custom Search
Custom Create Custom Create workflows create any record type with both standard and custom fields. Create Custom Record
Standard Create

Standard Create workflows create standard Salesforce records with their standard data fields. The SNIPPET payload of these workflows must include the standard fields and only those fields.

Create Account
Create Case
Create Contact
Create Lead
Create Opportunity
Create Work Order
Update Update workflows update the field values of a record. They can be used to update a record retrieved by a Search workflow or a record created by a Custom Create or Standard Create workflow. Update Record

Download this folder of template scripts. It contains voice and digital scripts for Desktop Studio and CXone Studio.

Configure Search Workflows

There are two Search workflows: Search for ANI and Custom Search.

Configure the Search for ANI Workflow

The Search for ANI workflow uses the ANIClosed Also known as caller ID. Listed phone number of an incoming voice call. from the ACD to search all standard phone fields for matching records.

Do not include the timeoutMilliSec property in your workflow code. It may cause multiple of the same interaction to be delivered to your agents.

  1. In Studio, open the script where you want to configure the Search for ANI workflow.

  2. If you haven't already, add a SNIPPET action after BEGIN and before the Workflow Execute action.

  3. Double-click the SNIPPET action on the script canvas.

  4. Copy each of the following lines of code and paste them into the Text View tab of the Editor window.

    
    DYNAMIC searchInput
    searchInput.workflowInput.phoneNumber = "{ANI}"
    						
    ASSIGN searchJson = "{searchInput.asjson()}"
    
    		
  5. Save your script.

  6. You can test your script by simulating an interaction in Studio.

Configure the Custom Search Workflow

The Custom Search workflow allows you to search for one or more Salesforce records. They also allow you to search multiple fields and variables within a specified record. You can connect different search requirements using Salesforce operators.

This workflow supports these Salesforce records:

  • Account

  • Case

  • Contact

  • Lead

  • Opportunity

  • Work Order

Do not include the timeoutMilliSec property in your workflow code. It may cause multiple of the same interaction to be delivered to your agents.

  1. In Studio, open the script where you want to configure the Custom Search workflow.

  2. If you haven't already, add a SNIPPET action after BEGIN and before the Workflow Execute action.

  3. Double-click the SNIPPET action on the script canvas.

  4. Copy each of the following lines of code and paste them into the Text View tab of the Editor window.

    
    DYNAMIC searchInput
    
    DYNAMIC payload					
    payload.entity = "[API Name]"
    payload.filter = "[fieldName][operator]'{variable}'"
    
    searchInput.workflowInput.search = payload
    
    ASSIGN searchJson = "{searchInput.asjson()}"
    
    		
  5. Change the value of the payload.entity attribute to the API name for the record you want to search. For example, payload.entity = "account". This is case-sensitive.

  6. Change the value of the payload.filter attribute. This determines the search filter criteria for the record. For example, payload.filter = "phone='{ANI}'".

    1. Change [fieldName] to the name of the field you want to use to search, such as phone. This is case-sensitive.

    2. Change [operator] to the Salesforce operator you want to use. A full list of Salesforce operators can be found in the Salesforce documentation Box with arrow indicating navigation to external site.. This is case-sensitive.

    3. Change {variable} to the variable you want to assign to the field. This is case-sensitive.

  7. To add additional search filters, use a Salesforce operator between the filters. For example:

    
    payload.filter = "phone='{ANI}'AND customer_number_c='{CustomerNumber}'"
    		
  8. Save your script.

  9. You can test your script by simulating an interaction in Studio.

Configure Custom Create Workflows

Custom Create workflows allow you to configure a SNIPPET payload to create any type of Salesforce record, standard or custom. They also allow you to populate any field type, standard or custom. For example, you could create an Account record with some of the standard fields from that record type, as well as your own custom fields.

This is the recommended method to create Salesforce records.

Configure the Create Custom Record Workflow (Previously Create Entity)

The Create Custom Record workflow creates any type of Salesforce record, standard or custom. This record can display standard and custom data fields. The fields must contain text, numbers, or variables. Binded fields are most often populated by search results or lists of options, but you can configure this workflow to add hard-coded data to a binded field.

If you use the older version of this workflow, called the Create Entity workflow, you need to configure your Studio script with two additional actions: a SNIPPET called Snippet for Send Workflow Response, and a CUSTOMEVENT called Send Workflow Response. Use this template script for Desktop Studio or this template script for CXone Studio.

  1. In Studio, open the script where you want to configure the Create Custom Record workflow.

  2. If you haven't already, add a SNIPPET action after BEGIN and before the Workflow Execute action.

  3. Double-click the SNIPPET action on the script canvas.

  4. Copy each of the following lines of code and paste them into the Text View tab of the Editor window.

    
    DYNAMIC createPayload
    DYNAMIC createDataArray
    						
    DYNAMIC item1
    item1.key = "[API name]"
    item1.value = "[variable]"
    DYNAMIC item2
    item2.key = "[API name]"
    item2.value = "[variable]"
    DYNAMIC item3
    item3.key = "[API name]"
    item3.value = "[variable]"
    
    createPayload.entity = "[record type]"
    createDataArray[1] = item1
    createDataArray[2] = item2
    createDataArray[3] = item3
    
    createPayload.data = createDataArray
    						
    createPayload.pinnedRecord = "[true or false]"
    createPayload.screenPop = "[true or false]"
    createPayload.relatesTo = "[true or false]"						
    										
    DYNAMIC create[RecordName]Payload
    create[RecordName]Payload.workflowInput = createPayload
    						
    ASSIGN createJson = "{create[RecordName]Payload.asjson()}"
    		

    You must include each of those lines.

  5. Change the values of the attributes listed below. Any of these can be hard-coded, a variable, or a combination of these. Use a variable if you want the value to update for each interaction.

    1. Change the value of item1.key to the first field you want to display. Change item1.value to the value of that field. For example:

      
      item1.key = "Status"
      item1.value = "New"
      		
    2. Change the value of item2.key to the second field you want to display. Change item2.value to the value of that field. For example:

      
      item2.key = "Origin"
      item2.value = "Phone"
      		
    3. Change the value of item3.key to the third field you want to display. Change item3.value to the value of that field. For example:

      
      item3.key = "CXone_Contact_ID_c"
      item3.value = "{ContactID}"
      		
  6. To add additional fields:

    1. Create additional item dynamic data objects after item3.value. Follow this format:

      
      DYNAMIC item#
      item#.key = "[Field #]"
      item#.value = "[Field # Value]"
      		

      The number (#) needs to increment by one with each additional dynamic data object you add. For example, item4, item5, and so on.

    2. Create additional data arrays after createDataArray[3]. Follow this format:

      
      ASSIGN createDataArray[#] = item#
      		

      The number (#) needs to increment by one with each additional item you add to the array. For example, createDataArray[4], createDataArray[5], and so on.

  7. Change the value of the createPayload.entity attribute to the API name for the record you want to use. For example, createPayload.entity = "account". This is case-sensitive.

    To find the API name for the record, open Salesforce and navigate to Setup Image of gear icon with lightning bolt inside. > Object Manager. Click the record's name. In the Details page that opens, find the API Name.

  8. Change the value of the createPayload.pinnedRecord attribute to either true or false. When set to true, the created record displays to agents in the Current Interactions section of the customer card. When set to false, it displays in the Recent Interactions section of the customer card. If you do not include this attribute in the payload, it will be assumed as false.
  9. Change the value of the createPayload.screenPop attribute to either true or false. When set to true, the created record automatically appears to the agent as a screen pop in Salesforce. When set to false, it does not. If you do not include this attribute in the payload, it will be assumed as false.
  10. Change the value of the createPayload.relatesTo attribute to either true or false. When set to true, agents can manually relate records inside CXone Agent. When set to false, they cannot; relating records happens automatically through data memorialization. If you do not include this attribute in the payload, it will be assumed as false.
  11. Change all the instances of [RecordName] in the last three lines of the code to the name of the record you created. Capitalize the name to match the camel case of the attribute. For example, if the name of the record you created is workorder, your code would be:

    
    DYNAMIC createWorkOrderPayload
    createWorkOrderPayload.workflowInput = createPayload
    						
    ASSIGN createJson = "{createWorkOrderPayload.asjson()}"
    		
  12. Save your script.

  13. You can test your script by simulating an interaction in Studio.

Configure Standard Create Workflows

Standard Create workflows create standard Salesforce records. Agents can use the customer card in CXone Agent to manually create new Salesforce records during interactions. If they select one of these workflows, the record is created with the fields specified in that workflow's payload.

You cannot add or delete fields in the SNIPPET payload of Standard Create workflows. If you add or delete fields, the workflow will fail and the record won't be created. To create a standard or custom record with the fields you want, use the Create Custom Record workflow.

Configure the Create Account Workflow

  1. In Studio, open the script where you want to configure the Create Account workflow.

  2. If you haven't already, add a SNIPPET action after BEGIN and before the Workflow Execute action.

  3. Double-click the SNIPPET action on the script canvas.

  4. Copy each of the following lines of code and paste them into the Text View tab of the Editor window.

    
    DYNAMIC createAccount
    createAccount.accountName = "[account name]"
    createAccount.accountType = "[account type]"
    createAccount.accountPhone = "{ANI}"
    						
    createAccount.pinnedRecord = "[true or false]"
    createAccount.screenPop = "[true or false]"
    createAccount.relatesTo = "[true or false]"	
    						
    DYNAMIC createAccountPayload
    createAccountPayload.workflowInput = createAccount
    
    ASSIGN createAccountJson = "{createAccountPayload.asjson()}"
    		

    You must include each of those lines. If you want a field to stay blank, you can use a null value (""). For example, createAccount.accountType = "". However, you cannot assign a null value to createAccount.accountName.

  5. Change the value of the createAccount.accountName attribute to the name of the account. For example, createAccount.accountName = "Elinor from Classics, Inc.". This value can be hard-coded, a variable, or a combination of these. Use a variable if you want this value to update for each interaction.

  6. Change the value of the createAccount.accountType attribute to the type of account. For example, createAccount.accountType = "Book Orders - Chat". This value can be hard-coded, a variable, or a combination of these. Use a variable if you want this value to update for each interaction.

  7. Change the value of the createAccount.pinnedRecord attribute to either true or false. When set to true, the created record displays to agents in the Current Interactions section of the customer card. When set to false, it displays in the Recent Interactions section of the customer card. If you do not include this attribute in the payload, it will be assumed as false.
  8. Change the value of the createAccount.screenPop attribute to either true or false. When set to true, the created record automatically appears to the agent as a screen pop in Salesforce. When set to false, it does not. If you do not include this attribute in the payload, it will be assumed as false.
  9. Change the value of the createAccount.relatesTo attribute to either true or false. When set to true, agents can manually relate records inside CXone Agent. When set to false, they cannot; relating records happens automatically through data memorialization. If you do not include this attribute in the payload, it will be assumed as false.
  10. Save your script.

  11. You can test your script by simulating an interaction in Studio.

Configure the Create Case Workflow

  1. In Studio, open the script where you want to configure the Create Case workflow.

  2. If you haven't already, add a SNIPPET action after BEGIN and before the Workflow Execute action.

  3. Double-click the SNIPPET action on the script canvas.

  4. Copy each of the following lines of code and paste them into the Text View tab of the Editor window.

    
    DYNAMIC createCase
    createCase.entityType = "[Contact or Account]"
    createCase.name = "[case name]"
    createCase.phone = "{ANI}"
    createCase.email = "[case email]"
    createCase.company = "[case company]"
    createCase.status = "[case status]"
    createCase.caseReason = "[reason for case]"
    createCase.caseOrigin = "{SKILL}"
    createCase.priority = "[low, medium, high, or critical]"
    createCase.description = "New Record - {CONTACTID}"
    createCase.internalComments = "[internal comments]"
    						
    createCase.pinnedRecord = "[true or false]"
    createCase.screenPop = "[true or false]"
    createCase.relatesTo = "[true or false]"	
    						
    DYNAMIC createCasePayload
    createCasePayload.workflowInput = createCase
    
    ASSIGN createCaseJson = "{createCasePayload.asjson()}"
    		

    You must include each of those lines. If you want a field to stay blank, you can use a null value (""). For example, createCase.name = "". However, you cannot assign a null value to createCase.entityType or createCase.status.

  5. Change the values of the attributes. Any of these can be hard-coded, a variable, or a combination of these. Use a variable if you want the value to update for each interaction.

    1. Change the value of the createCase.entityType attribute to Contact or Account. For example, createCase.entityType = "Contact".

    2. Change the value of the createCase.name attribute to the case's name. For example, createCase.name = "Elinor Dashwood's Case".

    3. Change the value of the createCase.email attribute to the email address for the case. For example, createCase.email = "elinor.dashwood@classics.com".

    4. Change the value of the createCase.company attribute to the organization for the case. For example, createCase.company = "Classics, Inc.".

    5. Change the value of the createCase.status attribute to the case's status. For example, createCase.status = "New".

    6. Change the value of the createCase.caseReason attribute to the reason for the case. For example, createCase.caseReason = "Shipping problems".

    7. Change the value of the createCase.priority attribute to low, medium, high, or critical. For example, createCase.priority = "low".

    8. Change the value of the createCase.internalComments attribute to a description of the case for internal use. For example, createCase.internalComments = "Elinor's book order is missing. It might have a wrong shipping address.".

  6. Change the value of the createCase.pinnedRecord attribute to either true or false. When set to true, the created record displays to agents in the Current Interactions section of the customer card. When set to false, it displays in the Recent Interactions section of the customer card. If you do not include this attribute in the payload, it will be assumed as false.
  7. Change the value of the createCase.screenPop attribute to either true or false. When set to true, the created record automatically appears to the agent as a screen pop in Salesforce. When set to false, it does not. If you do not include this attribute in the payload, it will be assumed as false.
  8. Change the value of the createCase.relatesTo attribute to either true or false. When set to true, agents can manually relate records inside CXone Agent. When set to false, they cannot; relating records happens automatically through data memorialization. If you do not include this attribute in the payload, it will be assumed as false.
  9. Save your script.

  10. You can test your script by simulating an interaction in Studio.

Configure the Create Contact Workflow

  1. In Studio, open the script where you want to configure the Create Contact workflow.

  2. If you haven't already, add a SNIPPET action after BEGIN and before the Workflow Execute action.

  3. Double-click the SNIPPET action on the script canvas.

  4. Copy each of the following lines of code and paste them into the Text View tab of the Editor window.

    
    DYNAMIC createContact
    createContact.firstName = "[first name]"
    createContact.lastName = "[last name]"
    createContact.homePhone = "{ANI}"
    createContact.mobilePhone = "[mobile phone number]"
    createContact.businessPhone = "{ANI}"
    createContact.email = "[email address]"
    createContact.contactDescription = "[description of contact]"
    						
    createContact.pinnedRecord = "[true or false]"
    createContact.screenPop = "[true or false]"
    createContact.relatesTo = "[true or false]"	
    
    DYNAMIC createContactPayload
    createContactPayload.workflowInput = createContact
    
    ASSIGN createContactJson = "{createContactPayload.asjson()}"
    		

    You must include each of those lines. If you want a field to stay blank, you can use a null value (""). For example, createContact.firstName = "". However, you cannot assign a null value to createContact.lastName.

  5. Change the values of the attributes. Any of these can be hard-coded, a variable, or a combination of these. Use a variable if you want the value to update for each interaction.

    1. Change the value of the createContact.firstName attribute to the contact's first name. For example, createContact.firstName = "Elinor".

    2. Change the value of the createContact.lastName attribute to the contact's last name. For example, createContact.lastName = "Dashwood".

    3. Change the value of thecreateContact.mobilePhone attribute to the contact's mobile phone number. For example, createContact.mobilePhone = "1234567890".

    4. Change the value of the createContact.email attribute to the contact's email address. For example, createContact.email = "elinor.dashwood@classics.com".

    5. Change the value of the createContact.contactDescription attribute to a description of the contact. For example, createContact.contactDescription = "Elinor needs help with her book order".

  6. Change the value of the createContact.pinnedRecord attribute to either true or false. When set to true, the created record displays to agents in the Current Interactions section of the customer card. When set to false, it displays in the Recent Interactions section of the customer card. If you do not include this attribute in the payload, it will be assumed as false.
  7. Change the value of the createContact.screenPop attribute to either true or false. When set to true, the created record automatically appears to the agent as a screen pop in Salesforce. When set to false, it does not. If you do not include this attribute in the payload, it will be assumed as false.
  8. Change the value of the createContact.relatesTo attribute to either true or false. When set to true, agents can manually relate records inside CXone Agent. When set to false, they cannot; relating records happens automatically through data memorialization. If you do not include this attribute in the payload, it will be assumed as false.
  9. Save your script.

  10. You can test your script by simulating an interaction in Studio.

Configure the Create Lead Workflow

  1. In Studio, open the script where you want to configure the Create Lead workflow.

  2. If you haven't already, add a SNIPPET action after BEGIN and before the Workflow Execute action.

  3. Double-click the SNIPPET action on the script canvas.

  4. Copy each of the following lines of code and paste them into the Text View tab of the Editor window.

    
    DYNAMIC createLead
    createLead.firstName = "[first name]"
    createLead.lastName = "[last name]"
    createLead.company = "[company]"
    createLead.phone = "{ANI}"
    createLead.email = "[email address]"
    createLead.website = "[website URL]"
    createLead.description = "New Record - {CONTACTID}"
    createLead.status = "[status of lead]"
    						
    createLead.pinnedRecord = "[true or false]"
    createLead.screenPop = "[true or false]"
    createLead.relatesTo = "[true or false]"	
    						
    DYNAMIC createLeadPayload
    createLeadPayload.workflowInput = createLead
    
    ASSIGN createLeadJson = "{createLeadPayload.asjson()}"
    		

    You must include each of those lines. If you want a field to stay blank, you can use a null value (""). For example, createLead.firstName = "". However, you cannot assign a null value to createLead.lastName, createLead.company, or createLead.status.

  5. Change the values of the attributes. Any of these can be hard-coded, a variable, or a combination of these. Use a variable if you want the value to update for each interaction.

    1. Change the value of the createLead.firstName attribute to the lead's first name. For example, createLead.firstName = "Elinor".

    2. Change the value of the createLead.lastName attribute to the lead's last name. For example, createLead.lastName = "Dashwood".

    3. Change the value of the createLead.company attribute to the lead's organization. For example, createLead.company = "Classics, Inc.".

    4. Change the value of the createLead.email attribute to the lead's email address. For example, createLead.email = "elinor.dashwood@classics.com".

    5. Change the value of the createLead.website attribute to the lead's website. For example, createLead.website = "classics.com".

    6. Change the value of the createLead.status attribute to the lead's status. For example, createLead.status = "New".

  6. Change the value of the createLead.pinnedRecord attribute to either true or false. When set to true, the created record displays to agents in the Current Interactions section of the customer card. When set to false, it displays in the Recent Interactions section of the customer card. If you do not include this attribute in the payload, it will be assumed as false.
  7. Change the value of the createLead.screenPop attribute to either true or false. When set to true, the created record automatically appears to the agent as a screen pop in Salesforce. When set to false, it does not. If you do not include this attribute in the payload, it will be assumed as false.
  8. Change the value of the createLead.relatesTo attribute to either true or false. When set to true, agents can manually relate records inside CXone Agent. When set to false, they cannot; relating records happens automatically through data memorialization. If you do not include this attribute in the payload, it will be assumed as false.
  9. Save your script.

  10. You can test your script by simulating an interaction in Studio.

Configure the Create Opportunity Workflow

  1. In Studio, open the script where you want to configure the Create Opportunity workflow.

  2. If you haven't already, add a SNIPPET action after BEGIN and before the Workflow Execute action.

  3. Double-click the SNIPPET action on the script canvas.

  4. Copy each of the following lines of code and paste them into the Text View tab of the Editor window.

    
    DYNAMIC createOpportunity
    createOpportunity.name = "[opportunity name]"
    createOpportunity.description = "New Record - {CONTACTID}"
    createOpportunity.stageName = "[stage of opportunity]"
    createOpportunity.closeDate = "[YYYY-MM-DD]"
    						
    createOpportunity.pinnedRecord = "[true or false]"
    createOpportunity.screenPop = "[true or false]"
    createOpportunity.relatesTo = "[true or false]"	
    						
    DYNAMIC createOpportunityPayload
    createOpportunityPayload.workflowInput = createOpportunity
    
    ASSIGN createOpportunityJson = "{createOpportunityPayload.asjson()}"
    		

    You must include each of those lines. If you want a field to stay blank, you can use a null value (""). For example, createOpportunity.description = "". However, you cannot assign a null value to createOpportunity.name, createOpportunity.stageName, or createOpportunity.closeDate.

  5. Change the values of the attributes. Any of these can be hard-coded, a variable, or a combination of these. Use a variable if you want the value to update for each interaction.

    1. Change the value of the createOpportunity.name attribute to the name of the opportunity. For example, createOpportunity.name = "Classics, Inc. Elinor".

    2. Change the value of the createOpportunity.stageName attribute to the stage of the opportunity. For example, createOpportunity.stageName = "New".

    3. Change the value of the createOpportunity.closeDate attribute to the date the opportunity closed. For example, createOpportunity.closeDate = "2024-01-31".

  6. Change the value of the createOpportunity.pinnedRecord attribute to either true or false. When set to true, the created record displays to agents in the Current Interactions section of the customer card. When set to false, it displays in the Recent Interactions section of the customer card. If you do not include this attribute in the payload, it will be assumed as false.
  7. Change the value of the createOpportunity.screenPop attribute to either true or false. When set to true, the created record automatically appears to the agent as a screen pop in Salesforce. When set to false, it does not. If you do not include this attribute in the payload, it will be assumed as false.
  8. Change the value of the createOpportunity.relatesTo attribute to either true or false. When set to true, agents can manually relate records inside CXone Agent. When set to false, they cannot; relating records happens automatically through data memorialization. If you do not include this attribute in the payload, it will be assumed as false.
  9. Save your script.

  10. You can test your script by simulating an interaction in Studio.

Configure the Create Work Order Workflow

  1. In Studio, open the script where you want to configure the Create Work Order workflow.

  2. If you haven't already, add a SNIPPET action after BEGIN and before the Workflow Execute action.

  3. Double-click the SNIPPET action on the script canvas.

  4. Copy each of the following lines of code and paste them into the Text View tab of the Editor window.

    
    DYNAMIC createWorkOrder
    createWorkOrder.description = "New Record - {CONTACTID}"
    createWorkOrder.startDate = "[YYYY-MM-DD]"
    createWorkOrder.endDate = "[YYYY-MM-DD]"
    createWorkOrder.subject = "New Record"
    createWorkOrder.status = "[status]"
    createWorkOrder.priority = "[low, medium, high, or critical]"
    createWorkOrder.duration = "[number of minutes or hours]"
    						
    createWorkOrder.pinnedRecord = "[true or false]"
    createWorkOrder.screenPop = "[true or false]"
    createWorkOrder.relatesTo = "[true or false]"	
    
    DYNAMIC createWorkOrderPayload
    createWorkOrderPayload.workflowInput = createWorkOrder
    
    ASSIGN createWorkOrderJson = "{createWorkOrderPayload.asjson()}"
    		

    You must include each of those lines. If you want a field to stay blank, you can use a null value (""). For example, createWorkOrder.description = "".

  5. Change the values of the attributes. Any of these can be hard-coded, a variable, or a combination of these. Use a variable if you want the value to update for each interaction.

    1. Change the value of the createWorkOrder.startDate attribute to the date the work order began. For example, createWorkOrder.startDate = "2024-01-30".

    2. Change the value of the createWorkOrder.endDate attribute to the date the work order ended. For example, createWorkOrder.endDate = "2024-01-31".

    3. Change the value of the createWorkOrder.status attribute to the status of the work order. For example, createWorkOrder.status = "New".

    4. Change the value of the createWorkOrder.priority attribute to low, medium, high, or critical. For example, createWorkOrder.priority = "low".

    5. Change the value of the createWorkOrder.duration attribute to the number of minutes or hours it took to complete the work order. For example, createWorkOrder.duration = "02".

  6. Change the value of the createWorkOrder.pinnedRecord attribute to either true or false. When set to true, the created record displays to agents in the Current Interactions section of the customer card. When set to false, it displays in the Recent Interactions section of the customer card. If you do not include this attribute in the payload, it will be assumed as false.
  7. Change the value of the createWorkOrder.screenPop attribute to either true or false. When set to true, the created record automatically appears to the agent as a screen pop in Salesforce. When set to false, it does not. If you do not include this attribute in the payload, it will be assumed as false.
  8. Change the value of the createWorkOrder.relatesTo attribute to either true or false. When set to true, agents can manually relate records inside CXone Agent. When set to false, they cannot; relating records happens automatically through data memorialization. If you do not include this attribute in the payload, it will be assumed as false.
  9. Save your script.

  10. You can test your script by simulating an interaction in Studio.

Update Workflows

Update workflows allow you to configure a SNIPPET payload to update any type of Salesforce record, standard or custom. Update workflows can update records retrieved by Search workflows. They can also update records created by Custom Create and Standard Create workflows.

Elinor Dashwood has set up Custom Create workflows to create Salesforce records. However, she notices that the Creator field in those records is populated with the Salesforce user account she created for CXone configuration. She configures an Update workflow in her Studio script so that the value of the Creator field will update to the agent handling the interaction.

Configure the Update Record Workflow

The Update Record workflow updates the fields in a record. You can use it to:

  • Update the fields of a record retrieved by a Search workflow. Update Record is designed for single match. If more than one record is returned in the search, only the first retrieved record is updated.

  • Update the fields of a record created by a Custom Create or Standard Create workflow.

  • Update both standard and custom fields.

Each Update Record workflow can only update one record. To update more than one record, configure more than one Update Record workflow.

  1. In Studio, open the script where you want to configure the Update Record workflow.

  2. Add a SNIPPET action after ONANSWER or ONASSIGNMENT.

  3. Double-click the SNIPPET action on the script canvas.

  4. Copy each of the following lines of code and paste them into the Text View tab of the Editor window.

    
    ASSIGN recordId = workflowResultSet.result[1].records[1].id
    
    DYNAMIC updatePayload
    updatePayload.entityId = [recordId]
    updatePayload.entity = "[entity API]"
    
    DYNAMIC fields
    fields[1].key = "[FieldName]"
    fields[1].value = "[Field value]"
    
    fields[2].key = "[FieldName]"
    fields[2].value = "[Field value]"				
    
    fields[3].key = "[FieldName]"
    fields[3].value = "[Field value]"
    
    updatePayload.fields = fields
    
    DYNAMIC updateInput
    updateInput.workflowInput = updatePayload
    ASSIGN updateInputJson = "{updateInput.asjson()}"
    		
  5. Change the value of the updatePayload.entityId attribute to the record ID of the record you want to update. For example, updatePayload.entityId = "123456-7891011-12131415".

    You can retrieve this record ID from the Search workflow results that appear in the customer card in CXone Agent.

  6. Change the value of the updatePayload.entity attribute to the API name for the record you want to update. For example, updatePayload.entity = "account". This is case-sensitive. You can use the API name of a standard or custom record.

    To find the API name for the record, open Salesforce and navigate to Setup Image of gear icon with lightning bolt inside. > Object Manager. Click the record's name. In the Details page that opens, find the API Name.

  7. Change the value of the fields.key attributes to the fields you want to update. For example, fields[1].key = "SuppliedPhone".
  8. Change the value of the fields.value attributes to the new values for the fields. These can be hard-coded, variables, or a combination of these. For example, fields[1].value = "{ANI}".
  9. Save your script.

  10. You can test your script by simulating an interaction in Studio.

Pin Records

You can pin a record to the Current Interaction section of the customer card. When a record is pinned, it is linked icon of a check mark in a green box. for data memorialization and timeline by default. This means that data memorialization and timeline information will be added to the Salesforce record when the interaction is completed. If the agent does not want the information to be mapped, they can unlink the record.

  1. Open the Snippet for Create Workflow SNIPPET action in your script.

  2. In the workflow payload, copy this line of code and paste it before DYNAMIC create[RecordType]Payload:

    						
    createPayload.pinnedRecord = "true"					
    		

    Make sure that createPayload matches the earlier lines in your workflow. For example, if you're using the standard Create Case workflow, this line should be createCase.pinnedRecord = "true".

  3. Save your script.

Configure Records for Screen Pop

You can configure created records to automatically appear as screen pops in Salesforce.

  1. Open the Snippet for Create Workflow SNIPPET action in your script.

  2. In the workflow payload, copy this line of code and paste it before DYNAMIC create[RecordName]Payload:

    						
    createPayload.screenPop = "true"				
    		

    Make sure that createPayload matches the earlier lines in your workflow. For example, if you're using the standard Create Case workflow, this line should be createCase.screenPop = "true".

  3. Save your script.

Enable Relate Records

You can enable agents to relate Salesforce records inside CXone Agent. This adds the Relates To icon one dot on the top connecting to two dots on the bottom. to the Current Interaction section of the customer card. When agents click Relates To one dot on the top connecting to two dots on the bottom., the Name and Relates To fields appear. They can use these fields to select a record to relate to the current interaction record. Records that have been active during the interaction appear in either the Name and Relates To field, depending on the type of record:

  • Leads and contacts appear in the Name field.

  • Accounts, campaigns, cases, opportunities, and custom records appear in the Relates To field.

Salesforce allows for records to be related automatically without any additional configuration. Through context switching, the last active record is agents select is related to the current interaction record. The steps below add the Relates To icon one dot on the top connecting to two dots on the bottom. and the Name and Relates To fields to the customer card in CXone Agent so that agents can relate records manually.

To enable agents to manually relate records:

  1. In Agent Integrations icon: an orange gear with three arrows inside., add data memorialization mappings for the whoid and whatid CXone data fields.

    1. Follow these steps to open a CRM integration, navigate to the Data Memorialization tab, and add an entity.

    2. In the External CRM Field drop-down, select a Salesforce field that can be mapped to the whoid or whatid CXone data field. Then select Script Variable in the Select Channel drop-down and enter whoid or whatid in CXone Data.

    3. Click Save at the top of the page.

  2. In Studio, open the Snippet for Create Workflow SNIPPET action in your script.

  3. Make sure the record is pinned to the Current Interaction section of the customer card.

  4. Make sure the AGENT WORKFLOW CONFIGURATION action in your script is configured for data memorialization. This involves selecting a data memorialization workflow mapping in the wizard.

  5. Save your script.