Configure HubSpot Workflows for CXone Agent

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

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

Custom timeline is not supported for HubSpot.

Workflow Type

Description

Workflows

Search Search workflows scan HubSpot 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. Custom Create
Standard Create

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

Create Company
Create Contact
Create Ticket
Create Ticket with Association

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

You can configure the Search for ANI workflow for phone calls or emails.

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. To configure the Search for ANI workflow for phone calls, copy each of the following lines of code and paste them into the Text View tab of the Editor window.

    
    ASSIGN phoneNumber = "{ANI}"
    ASSIGN email = ""
    DYNAMIC searchInput
    searchInput.phoneNumber = "{phoneNumber}"
    DYNAMIC searchFlowPayload
    searchFlowPayload.workflowInput = searchInput
    		
  5. To configure the Search for ANI workflow for emails, copy each of the following lines of code and paste them into the Text View tab of the Editor window.

    
    ASSIGN phoneNumber = ""
    ASSIGN email = "{ANI}"
    DYNAMIC searchInput
    searchInput.email = "{email}"
    DYNAMIC searchFlowPayload
    searchFlowPayload.workflowInput = searchInput
    		
  6. Save your script.

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

This workflow supports these HubSpot records:

  • Company
  • Contact
  • Ticket (with or without associated 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 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 filterGroups
    	
    DYNAMIC filters1
    filters1.propertyName = "[fieldName]"
    filters1.operator = "[operator]"
    filters1.value = "[value]"
    
    DYNAMIC filters2
    filters2.propertyName = "[fieldName]"		
    filters2.operator = "[operator]"
    filters2.value = "[value]"
    
    filterGroups.filters[1] = filters1
    filterGroups.filters[2] = filters2
    
    DYNAMIC sorts
    DYNAMIC sort1
    sort1.propertyName = "[fieldName]"
    sort1.direction = "[ASCENDING or DESCENDING]"
    sorts[1] = sort1
    
    DYNAMIC searchArray
    searchArray[1].entity = "[API name]"
    searchArray[1].filter.filterGroups[1] = filterGroups
    
    DYNAMIC searchFlowPayload
    searchFlowPayload.workflowInput.entities = searchArray
    		
  5. Change the values of the filters1 and filters2 attributes.

    1. Change the values of the filters1.propertyName and filters2.propertyName attributes to the names of the fields you want to use to search. For example, filters1.propertyName = "subject".

      A full list of field names, called properties, and endpoints can be found in the HubSpot documentation for the records:

    2. Change the values of the filters1.operator and filters2.operator attributes to the HubSpot operators you want to use. A full list of HubSpot operators can be found in the HubSpot documentation Box with arrow indicating navigation to external site.. This is case-sensitive.

    3. Change the values of the filters1.value and filters2.value attributes to the values you want to assign to the fields. For example, filters1.value = "Account invalid Login".

  6. Change the values of the sort1 attributes.

    1. Change the value of the sort1.propertyName attribute to the field you want to use to sort the results. For example, sort1.propertyName = "createdate".

    2. Change the value of the sort1.direction attribute to ASCENDING or DESCENDING.

  7. Change the value of the searchArray[1].entity attribute to the API name for the record you want to search. For example, searchArray[1].entity = "companies". This is case-sensitive.

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

Configure the Custom Create Workflow

The Custom Create workflow creates any type of HubSpot record, standard or custom. This record can display standard and custom data fields. The fields must contain text, numbers, or variables.

  1. Make sure you have the Sales Hub Enterprise tool enabled in HubSpot. You need this tool in order to create custom HubSpot records.

  2. Use this HubSpot documentation Box with arrow indicating navigation to external site. to create a custom record, or object, in HubSpot.

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

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

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

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

    
    DYNAMIC createPayload
    createPayload.entities.name = "[custom record API]"
    createPayload.entities.properties.[fieldName]= "[field value]"
    createPayload.entities.properties.[fieldName]= "[field value]"
    createPayload.entities.properties.[fieldName]= "[field value]"
    createPayload.entities.properties.[fieldName]= "[field value]"
    						
    createPayload.pinnedRecord = "[true or false]"
    createPayload.screenPop = "[true or false]"
    
    DYNAMIC create[ObjectName]Payload
    create[ObjectName]Payload.workflowInput = createPayload
    
    ASSIGN create[ObjectName]Json = "{create[RecordName]Payload.asjson()}"
    		
  7. Change the value of the createPayload.entities.name attribute to the API for the custom record you created. For example, createPayload.entities.name = "companies". This is case-sensitive.

  8. In the createPayload.entities.properties attributes, change [fieldname] to the name of the field you want to add to the custom record. For example, createPayload.entities.properties.accountNumber.

  9. Change the values of the createPayload.entities.properties attributes to the values you want to assign to the fields. For example, createPayload.entities.properties.accountNumber = "12345".

  10. 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.
  11. 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 HubSpot. When set to false, it does not. If you do not include this attribute in the payload, it will be assumed as false.
  12. Change all the instances of [ObjectName] 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 account, your code would be:

    
    DYNAMIC createAccountPayload
    createAccountPayload.workflowInput = createPayload
    						
    ASSIGN createAccountJson = "{createAccountPayload.asjson()}"
    		
  13. Save your script.

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

Configure Standard Create Workflows

Standard Create workflows create standard HubSpot records. Agents can use the customer card in CXone Agent to manually create new HubSpot 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 Custom Create workflow.

Configure the Create Company Workflow

  1. In Studio, open the script where you want to configure the Create Company 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
    createPayload.entities.name = "company"
    createPayload.entities.properties.name = "[company name]"
    createPayload.entities.properties.domain = "[company website]"
    createPayload.entities.properties.city = "[company city]"
    createPayload.entities.properties.phone = "[company phone number]"
    						
    createPayload.pinnedRecord = "[true or false]"
    createPayload.screenPop = "[true or false]"
    						
    DYNAMIC createCompanyPayload
    createCompanyPayload.workflowInput = createPayload
    
    ASSIGN createCompanyJson = "{createCompanyPayload.asjson()}"
    		

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

  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 createPayload.entities.properties.name attribute to the company's name. For example, createPayload.entities.properties.name = "Classics, Inc.".

    2. Change the value of the createPayload.entities.properties.domain attribute to the company's website. For example, createPayload.entities.properties.domain = "classics.com".

    3. Change the value of the createPayload.entities.properties.city attribute to the company's city. For example, createPayload.entities.properties.city = "London".

    4. Change the value of the createPayload.entities.properties.phone attribute to the company's phone number. For example, createPayload.entities.properties.phone = "1234567890".

  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 HubSpot. When set to false, it does not. If you do not include this attribute in the payload, it will be assumed as false.
  8. Save your script.

  9. 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 createPayload
    createPayload.entities.name = "contact"
    createPayload.entities.properties.firstName = "[first name]"
    createPayload.entities.properties.email = "[email address]"
    createPayload.entities.properties.lastName = "[last name]"
    createPayload.entities.properties.phone = "[phone number]"
    						
    createPayload.pinnedRecord = "[true or false]"
    createPayload.screenPop = "[true or false]"
    
    DYNAMIC createContactPayload
    createContactPayload.workflowInput = createPayload
    
    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, createPayload.entities.properties.email = "".

  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 createPayload.entities.properties.firstName attribute to the contact's first name. For example, createPayload.entities.properties.firstName = "Elinor".

    2. Change the value of the createPayload.entities.properties.email attribute to the contact's email address. For example, createPayload.entities.properties.email = "elinor.dashwood@classics.com".

    3. Change the value of the createPayload.entities.properties.lastName attribute to the contact's last name. For example, createPayload.entities.properties.lastName = "Dashwood".

    4. Change the value of the createPayload.entities.properties.phone attribute to the contact's phone number. For example, createPayload.entities.properties.phone = "1234567890".

  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 HubSpot. When set to false, it does not. If you do not include this attribute in the payload, it will be assumed as false.
  8. Save your script.

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

Configure the Create Ticket Workflow

  1. In Studio, open the script where you want to configure the Create Ticket 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
    createPayload.entities.name = "ticket"
    createPayload.entities.properties.subject = "[ticket subject]"
    createPayload.entities.properties.hs_pipeline = "[#]"
    createPayload.entities.properties.hs_pipeline_stage = "[#]"
    createPayload.entities.properties.hs_ticket_priority = "[LOW, MEDIUM, or HIGH]"
    						
    createPayload.pinnedRecord = "[true or false]"
    createPayload.screenPop = "[true or false]"
    
    DYNAMIC createTicketPayload
    createTicketPayload.workflowInput = createPayload
    
    ASSIGN createTicketJson = "{createTicketPayload.asjson()}"
    		

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

  5. Change the values of the attributes.

    1. Change the value of the createPayload.entities.properties.subject attribute to the subject of the ticket: why it was created. For example, createPayload.entities.properties.subject = "Query about large book orders". This can be hard-coded, a variable, or a combination of these. Use a variable if you want the value to update for each interaction.

    2. Change the value of the createPayload.entities.properties.hs_pipeline attribute to the ticket's pipeline number. For example, createPayload.entities.properties.hs_pipeline = "0".

    3. Change the value of the createPayload.entities.properties.hs_pipeline_stage attribute to the number that indicates the ticket's status in the pipeline. For example, createPayload.entities.properties.hs_pipeline_stage = "3".

    4. Change the value of the createPayload.entities.properties.hs_ticket_priority attribute to LOW, MEDIUM, or HIGH.

  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 HubSpot. When set to false, it does not. If you do not include this attribute in the payload, it will be assumed as false.
  8. Save your script.

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

Configure the Create Ticket with Association Workflow

  1. In Studio, open the script where you want to configure the Create Ticket with Association 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
    createPayload.entities.name = "ticket"
    createPayload.entities.properties.subject = "[ticket subject]"
    createPayload.entities.properties.hs_pipeline = "[#]"
    createPayload.entities.properties.hs_pipeline_stage = "[#]"
    createPayload.entities.properties.hs_ticket_priority = "[LOW, MEDIUM, or HIGH]"
    						
    createPayload.pinnedRecord = "[true or false]"
    createPayload.screenPop = "[true or false]"
    
    DYNAMIC Association
    DYNAMIC item1
    item1.relatedObjectType = "[record API]"
    item1.relatedObjectId = "[#]"
    createPayload.entities.association[1] = item1
    
    DYNAMIC createTicketPayload
    createTicketPayload.workflowInput = createPayload
    
    ASSIGN createTicketJson = "{createTicketPayload.asjson()}"
    		

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

  5. Change the values of the createPayload attributes.

    1. Change the value of the createPayload.entities.properties.subject attribute to the subject of the ticket: why it was created. For example, createPayload.entities.properties.subject = "Query about mass book orders". This can be hard-coded, a variable, or a combination of these. Use a variable if you want the value to update for each interaction.

    2. Change the value of the createPayload.entities.properties.hs_pipeline attribute to the ticket's pipeline number. For example, createPayload.entities.properties.hs_pipeline = "0".

    3. Change the value of the createPayload.entities.properties.hs_pipeline_stage attribute to the number that indicates the ticket's status in the pipeline. For example, createPayload.entities.properties.hs_pipeline_stage = "3".

    4. Change the value of the createPayload.entities.properties.hs_ticket_priority attribute to LOW, MEDIUM, or HIGH.

  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 HubSpot. 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 values of the item1 attributes.

    1. Change the value of the item1.relatedObjectType attribute to the API for the record you want to connect to this workflow. For example, item1.relatedObjectType = "companies". This is case-sensitive.

    2. Change the value of the item1.relatedObjectId attribute to the ID number for the record you want to connect to this workflow. For example, item1.relatedObjectId = "19019671367".

  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 HubSpot 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.

  3. Save your script.

Configure Records for Screen Pop

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

  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[ObjectName]Payload:

    						
    createPayload.screenPop = "true"				
    		

    Make sure that createPayload matches the earlier lines in your workflow.

  3. Save your script.