Configure ServiceNow Workflows for CXone Agent Embedded

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

Workflow Type

Description

Workflows

Search Search workflows scan ServiceNow 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 ServiceNow records with their standard data fields. The SNIPPET payload of these workflows must include the standard fields and only those fields. Create Case
Create Consumer
Create Contact
Create Incident
Create Interaction
Create User

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 ServiceNow records. They also allow you to search multiple fields and variables within a specified record. You can connect different search requirements using ServiceNow operators.

This workflow supports these ServiceNow records:

  • Consumer

  • Consumer User

  • Contact

  • User

  • Household

  • Incident

  • Interaction

  • Case

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 = "number = {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 = "incident". This is case-sensitive.

  6. Change the value of the payload.filter attribute. This determines the search filter criteria for the record.

    1. Change {variable} to the variable you want to be searched. This is case-sensitive.

    2. To add more variables, use ServiceNow operators. A full list of ServiceNow operators can be found in the ServiceNow documentation Box with arrow indicating navigation to external site.. They are case-sensitive.

  7. Save your script.

  8. 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 ServiceNow record, standard or custom. They also allow you to populate any field type, standard or custom. For example, you could create a Case 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 ServiceNow records.

Configure the Create Custom Record Workflow (Previously Create Entity)

The Create Custom Record workflow creates any type of ServiceNow 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.name = "subject"
    item1.value = "New Record - {CONTACTID}"
    DYNAMIC item2
    item2.name = "phonenumber"
    item2.value = "{ANI}"
    DYNAMIC item3
    item3.name = "new_contactid"
    item3.value = "{CONTACTID}"
    						
    createPayload.tablename = "incident"
    		ASSIGN createDataArray[1] = item1
    		ASSIGN createDataArray[2] = item2
    		ASSIGN 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 create[RecordName]Json = "{create[RecordName]Payload.asjson()}"
    		

    You must include each of those lines.

  5. To add additional fields:

    1. Create additional dynamic data objects under item3.value = "{CONTACTID}". Follow this format:

      
      DYNAMIC item#
      item#.name = "[fieldname]"
      item#.value = "{variable}"
      		
    2. Then create additional data arrays under createPayload.entity = "incident". Follow this format:

      
      ASSIGN createDataArray[#] = item#
      		

      The number (#) needs to increment by one with each additional item you add to the array.

  6. 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.
  7. 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 ServiceNow. 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 createPayload.relatesTo attribute to either true or false. When set to true, agents can relate another record to the created record. When set to false, this functionality is not available to agents. If you do not include this attribute in the payload, it will be assumed as false.
  9. 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 incident, your code would be:

    
    DYNAMIC createIncidentPayload
    createIncidentPayload.workflowInput = createPayload
    						
    ASSIGN createIncidentJson = "{createIncidentPayload.asjson()}"
    		
  10. Save your script.

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

Configure Standard Create Workflows

Standard Create workflows create standard ServiceNow records. Agents can use the customer card in CXone Agent Embedded to manually create new ServiceNow 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 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 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.title = "[Case Name]"
    createCase.entity = "Case"
    createCase.phoneNumber = "{ANI}"
    						
    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.phoneNumber = "".

  5. Change the value of the createCase.title attribute to the case's name. For example, createCase.title = "Elinor's Case". 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 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 ServiceNow. 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 relate another record to the created record. When set to false, this functionality is not available to agents. 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 Consumer Workflow

  1. In Studio, open the script where you want to configure the Create Consumer 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 createConsumer
    createConsumer.phoneNumber = "{ANI}"
    createConsumer.firstName = "[first name]"
    createConsumer.lastName = "[last name]"
    createConsumer.email = "[email address]"
    						
    createConsumer.pinnedRecord = "[true or false]"
    createConsumer.screenPop = "[true or false]"
    createConsumer.relatesTo = "[true or false]"
    
    DYNAMIC createConsumerPayload
    createConsumerPayload.workflowInput = createConsumer
    						
    ASSIGN createConsumerJson = "{createConsumerPayload.asjson()}"
    		

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

  5. Change the value of the createConsumer.firstName attribute to the contact's first name. For example, createConsumer.firstName = "Elinor". 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 createConsumer.lastName attribute to the contact's last name. For example, createConsumer.lastName = "Dashwood". 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 createConsumer.email attribute to the contact's email address. For example, createConsumer.email = "elinor.dashwood@classics.com". 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.

  8. Change the value of the createConsumer.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 createConsumer.screenPop attribute to either true or false. When set to true, the created record automatically appears to the agent as a screen pop in ServiceNow. 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 createConsumer.relatesTo attribute to either true or false. When set to true, agents can relate another record to the created record. When set to false, this functionality is not available to agents. If you do not include this attribute in the payload, it will be assumed as false.
  11. Save your script.

  12. 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.phoneNumber = "{ANI}"
    createContact.firstName = "[first name]"
    createContact.lastName = "[last name]"
    createContact.email = "[email address]"
    						
    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.email = "".

  5. Change the value of the createContact.firstName attribute to the contact's first name. For example, createContact.firstName = "Elinor". 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 createContact.lastName attribute to the contact's last name. For example, createContact.lastName = "Dashwood". 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 createContact.email attribute to the contact's email address. For example, createContact.email = "elinor.dashwood@classics.com". 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.

  8. 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.
  9. 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 ServiceNow. 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 createContact.relatesTo attribute to either true or false. When set to true, agents can relate another record to the created record. When set to false, this functionality is not available to agents. If you do not include this attribute in the payload, it will be assumed as false.
  11. Save your script.

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

Configure the Create Incident Workflow

  1. In Studio, open the script where you want to configure the Create Incident 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 createIncident
    createIncident.title = "[Incident Name]"
    createIncident.entity = "Case"
    createIncident.phoneNumber = "{ANI}"
    						
    createIncident.pinnedRecord = "[true or false]"
    createIncident.screenPop = "[true or false]"
    createIncident.relatesTo = "[true or false]"
    
    DYNAMIC createIncidentPayload
    createIncidentPayload.workflowInput = createIncident
    ASSIGN createIncidentJson = "{createIncidentPayload.asjson()}"
    		

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

  5. Change the value of the createIncident.title attribute to the incident's name. For example, createIncident.title = "Elinor's Incident". 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 createIncident.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 createIncident.screenPop attribute to either true or false. When set to true, the created record automatically appears to the agent as a screen pop in ServiceNow. 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 createIncident.relatesTo attribute to either true or false. When set to true, agents can relate another record to the created record. When set to false, this functionality is not available to agents. 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 Interaction Workflow

  1. In Studio, open the script where you want to configure the Create Interaction 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 createInteraction
    createInteraction.title = "[Interaction Name]"
    createInteraction.entity = "Case"
    createInteraction.phoneNumber = "{ANI}"
    						
    createInteraction.pinnedRecord = "[true or false]"
    createInteraction.screenPop = "[true or false]"
    createInteraction.relatesTo = "[true or false]"
    						
    DYNAMIC createInteractionPayload
    createInteractionPayload.workflowInput = createInteraction
    ASSIGN createInteractionJson = "{createInteractionPayload.asjson()}"
    		

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

  5. Change the value of the createInteraction.title attribute to the case's name. For example, createInteraction.title = "Elinor's Interaction". 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 createInteraction.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 createInteraction.screenPop attribute to either true or false. When set to true, the created record automatically appears to the agent as a screen pop in ServiceNow. 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 createInteraction.relatesTo attribute to either true or false. When set to true, agents can relate another record to the created record. When set to false, this functionality is not available to agents. 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 User Workflow

  1. In Studio, open the script where you want to configure the Create User 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 createUser
    createUser.phoneNumber = "{ANI}"
    createUser.firstName = "[first name]"
    createUser.lastName = "[last name]"
    createUser.email = "[email address]"
    						
    createUser.pinnedRecord = "[true or false]"
    createUser.screenPop = "[true or false]"
    createUser.relatesTo = "[true or false]"
    
    DYNAMIC createUserPayload
    createUserPayload.workflowInput = createUser
    						
    ASSIGN createUserJson = "{createUserPayload.asjson()}"
    		

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

  5. Change the value of the createUser.firstName attribute to the contact's first name. For example, createUser.firstName = "Elinor". 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 createUser.lastName attribute to the contact's last name. For example, createUser.lastName = "Dashwood". 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 createUser.email attribute to the contact's email address. For example, createUser.email = "elinor.dashwood@classics.com". 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.

  8. Change the value of the createUser.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 createUser.screenPop attribute to either true or false. When set to true, the created record automatically appears to the agent as a screen pop in ServiceNow. 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 createUser.relatesTo attribute to either true or false. When set to true, agents can relate another record to the created record. When set to false, this functionality is not available to agents. If you do not include this attribute in the payload, it will be assumed as false.
  11. Save your script.

  12. 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 ServiceNow 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 Contact workflow, this line should be createContact.pinnedRecord = "true".

  3. Save your script.

Configure Records for Screen Pop

You can configure created records to automatically appear as screen pops in ServiceNow. Only one record can appear:

  • If you have a single match record, that record appears.

  • If you have multiple match records and only one created record, the created record appears.

  • If you have multiple match records and more than one created record, the last created record appears.

  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 Contact workflow, this line should be createContact.screenPop = "true".

  3. Save your script.

Enable Relate Records

You can enable agents to relate ServiceNow records from inside CXone Agent Embedded. 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., a drop-down appears, listing the records that can be related.

Agents can select a record from that list to relate it to the current interaction record. The related record appears in the corresponding field in the current interaction record. If the related record doesn't have a name, no text appears in the field. However, agents can click Preview this record icon of the letter I in a circle. next to the field to view the related record.

To enable agents to relate records:

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

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

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

    						
    createPayload.relatesTo = "true"					
    		

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

  4. Save your script.