Configure Microsoft Dynamics Workflows for CXone Agent Embedded

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

Workflow Type

Description

Workflows

Search Search workflows scan Microsoft Dynamics 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 Microsoft Dynamics 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 Phone Call

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

This workflows supports these Microsoft Dynamics records:

  • Contact

  • Account

  • Lead

  • Opportunity

  • Case

  • Task

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 use. 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. For example, payload.filter = "phone='{ANI}'".

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

    2. Change [operator] to the Microsoft Dynamics operator you want to use. 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 Microsoft Dynamics operator between the filters. For example:

    
    payload.filter = "phone eq '{ANI}'AND customer_number_c eq '{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 Microsoft Dynamics 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 Microsoft Dynamics records.

Configure the Create Custom Record Workflow (Previously Create Entity)

The Create Custom Record workflow creates any type of Microsoft Dynamics 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 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.

    
    DYNAMIC createPayload
    DYNAMIC createDataArray
    						
    DYNAMIC item1
    item1.field = "subject"
    item1.value = "New Record - {CONTACTID}"
    DYNAMIC item2
    item2.field = "phonenumber"
    item2.value = "{ANI}"
    DYNAMIC item3
    item3.field = "new_contactid"
    item3.value = "{CONTACTID}"
    						
    createPayload.entity = "phonecalls"
    		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#.field = "[fieldname]"
      item#.value = "{variable}"
      		
    2. Then create additional data arrays under createPayload.entity = "phonecalls". Follow this format:

      
      ASSIGN createDataArray[#] = item#
      		

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

  6. Optional: To add the Call From field, follow the steps below. You can only add the Call From field to account, contact, lead, and systemuser records.

  7. Optional: To add the Call To field, follow the steps below. You can only add the Call To field to account, contact, lead, and systemuser records.

  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 Microsoft Dynamics. 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 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. Change all the instances of [RecordName] in the last three lines of the code to the type of record you created. Capitalize the type to match the camel case of the attribute. For example, if the type of record you created is phonecall, your code would be:

    
    DYNAMIC createPhoneCallPayload
    createPhoneCallPayload.workflowInput = createPayload
    						
    ASSIGN createPhoneCallJson = "{createPhoneCallPayload.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 Microsoft Dynamics records. Agents can use the customer card in CXone Agent Embedded to manually create new Microsoft Dynamics 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 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 = "[Contact Name]"
    createAccount.email = "[email address]"
    createAccount.mainPhone = "{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.email = "".

  5. Change the value of the createAccount.accountName attribute to the contact's name. For example, createAccount.accountName = "Elinor 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.

  6. Change the value of the createAccount.email attribute to the contact's email address. For example, createAccount.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.

  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 Microsoft Dynamics. 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 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.
  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.title = "[Case Name]"
    createCase.entityType = "contact" 
    createCase.phoneNumber = "{ANI}"
    createCase.email = "[email address]"
    						
    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.email = "".

  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.email attribute to the contact's email address. For example, createCase.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.

  7. 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.
  8. 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 Microsoft Dynamics. 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 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.
  10. Save your script.

  11. 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.email = "[email address]"
    createContact.businessPhone = "{ANI}"
    						
    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 Microsoft Dynamics. 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 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.topic = "[topic]"
    createLead.mobilePhone = "{ANI}"
    
    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.email = "".

  5. Change the value of the createLead.topic attribute to the topic of the lead: what the contact is interested in. For example, createLead.topic = "car insurance". 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 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 Microsoft Dynamics. 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 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 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.topic = "[topic]"
    						
    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.topic = "".

  5. Change the value of the createOpportunity.topic attribute to the topic of the opportunity: what the contact is interested in. For example, createOpportunity.topic = "car insurance". 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 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 Microsoft Dynamics. 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 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 Phone Call Workflow

  1. In Studio, open the script where you want to configure the Create Phone Call 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 createPhoneCall
    createPhoneCall.subject = "[subject]"
    createPhoneCall.phoneNumber = "{ANI}"
    createPhoneCall.directionCode = "Inbound"
    						
    createPhoneCall.pinnedRecord = "[true or false]"
    createPhoneCall.screenPop = "[true or false]"
    createPhoneCall.relatesTo = "[true or false]"
    
    DYNAMIC createPhoneCallPayload
    createPhoneCallPayload.workflowInput = createPhoneCall
    
    ASSIGN createPhoneCallJson = "{createPhoneCallPayload.asjson()}"
    		

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

  5. Change the value of the createPhoneCall.subject attribute to the subject of the call. For example, createPhoneCall.subject = "billing issue". 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 createPhoneCall.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 createPhoneCall.screenPop attribute to either true or false. When set to true, the created record automatically appears to the agent as a screen pop in Microsoft Dynamics. 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 createPhoneCall.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.

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 Microsoft Dynamics 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 Account workflow, this line should be createAccount.pinnedRecord = "true".

  3. Save your script.

Configure Records for Screen Pop

You can configure created records to automatically appear as screen pops in Microsoft Dynamics. If you are using Microsoft Dynamics CIF v2.0, only one record appears. If you have multiple created records, only the first appears. Agents need to click the other records in the customer card to open them.

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

  3. Save your script.

Enable Relate Records

You can enable agents to relate Microsoft Dynamics records from inside CXone Agent Embedded. The related records share data. This happens when the interaction is completed. For inbound interactions, the sharing only applies to the Call From field in the record. For outbound interactions, it only applies to the Call To field in the 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 Account workflow, this line should be createAccount.relatesTo = "true".

  4. Save your script.