Configure Microsoft Dynamics Workflows for CXone Agent

You can configure Search, Custom Create, and Standard Create workflows for Microsoft Dynamics and CXone Agent. 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

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.

Use this example script.

  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

Use this example script.

  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. A full list of Microsoft Dynamics operators can be found in the Microsoft documentation . 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='{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 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.

Use this example script.

This was previously called the Create Entity workflow.

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

  2. If you haven't already, add a SNIPPETaction 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]"
    						
    DYNAMIC createPhoneCallPayload
    createPhoneCallPayload.workflowInput = createPayload
    						
    ASSIGN createPhoneCallJson = "{createPhoneCallPayload.asjson()}"
    		

    You must include each of those lines.

  5. Change the value of the createPayload.pinnedRecord attribute to either true or false. When set to true, the created record will display to agents in the Current Interactions section of the customer card. If set to false, it will display 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.
  6. 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.

  7. Save your script.

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

Configure Standard Create Workflows

Standard Create workflows allow users to search standard Microsoft Dynamics records inside Microsoft Dynamics.

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

Use this example script.

  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}"
    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. Save your script.

  8. 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]"
    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. Save your script.

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

Configure the Create Contact Workflow

Use this example script.

  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}"
    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. Save your script.

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

Configure the Create Lead Workflow

Use this example script.

  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}"
    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. Save your script.

  7. 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]"
    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. Save your script.

  7. 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"
    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. Save your script.

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