getConversations

Omnichannel for Customer Service offers a suite of capabilities that extend the power of Dynamics 365 Customer Service Enterprise to enable organizations to instantly connect and engage with their customers across digital messaging channels. An additional license is required to access Omnichannel for Customer Service. For more information, see the Dynamics 365 Customer Service pricing overview and Dynamics 365 Customer Service pricing plan pages.

This function can be used to fetch a list of conversation (msdyn_ocliveworkitem) records for an agent.

Syntax

Microsoft.Omnichannel.getConversations(input, correlationId);

Parameters

Parameter Type Description
input String JSON input. It has the following format:
{attributes, agentID, status, orderBy, createdBeforeDays}
where:
  • attributesis an array of strings containing entity attribute names
  • agentId is a string containing unique identifier for the agent
  • status is an array of strings with comma-separated values
  • orderBy is an array of objects in the format:
    [{ attributeName: "<Attribute_Name>" descending:<Boolean>}]
  • createdBeforeDaysis the number of days since the conversation was created

The agentId is the only required input variable and the rest are optional.
correlationId String Optional. Unique identifier for telemetry logging.

Return value

Returns a resolved or rejected promise based on the outcome of the operation.

Note

Even if the caller doesn't pass any attributes in the input, the function returns the records with the following default attributes:

  • msdyn_ocliveworkitemid
  • msdyn_liveworkstreamid
  • msdyn_lastsessionid
  • StatusCode
  • CreatedOn

Example

The following code snippet fetches the currently waiting conversation for the given agent ID.

var input = { 
    "attributes": [
        "msdyn_title",
        "msdyn_channel"
        ],
    "agentId": "2b330c52-6844-4d36-8e05-03c78c9681dc",
    "status": [3], 
    "orderBy": [
        { 
            "attributeName": "createdon",
            "descending": true
        }
    ]
};
Microsoft.Omnichannel.getConversations(input).then(result => {
    console.log("result is as:", result); 
    }, (error) => {
        console.log("error is as:", error); 
    }
);

Live chat SDK reference
Omnichannel JavaScript API reference
getConversationId
linkToConversation
unlinkFromConversation
openConversation
sendMessageToConversation