0

I have implemented an application that connects to SF Live Agent via it's REST API (https://developer.salesforce.com/docs/atlas.en-us.live_agent_rest.meta/live_agent_rest/)

In order to initialize a connection, I have to make several requests as documented by the API: request sessionID -> make chasitorInit request -> start sending messages

In the chasitorInit request, there is the possibility to add information to the payload that sets certain custom fields in the ChatTranscript object. I can set all fields I need except fields of type Date/Time. They simply remain empty.

Here is an example request with payload to the ChasitorInitendpoint:

requests.post(
'mySfPath/Chasitor/ChasitorInit',
headers={
    'X-LIVEAGENT-SESSION-KEY': myKey, 
    'X-LIVEAGENT-AFFINITY': myAffinityToken,
    'X-LIVEAGENT-SEQUENCE': '1',
    'X-LIVEAGENT-API-VERSION': '46',
    'Content-Type': 'application/json'
},
data=json.dumps(body)
)

with the body being

{
"organizationId": "myOrg",
"deploymentId": "myDeployment", 
"buttonId": "myBtn",
"sessionId": "mySessionId", 
"userAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_6_8) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/28.0.1500.95 Safari/537.36",
"language": "de-DE", 
"screenResolution": "1900x1080", 
"visitorName": "anyone",
"prechatDetails": [
    {
        "label":"Accepted",
        "value": True,
        "transcriptFields":[
            "CC_Accepted_by_specialist__c"
        ],
        "displayToAgent": True
    },
    {
        "label":"AccepeptedByAgentTime",
        "value": "2020-01-10T10:00:00.000Z", 
        "transcriptFields":[
            "CC_Accepted_by_specialist_DateTime__c"
        ],
        "displayToAgent": True
    },
],
"prechatEntities":[],
"receiveQueueUpdates": True, 
"isPost": True
}

The transcriptFields value is correct.

I also tried all time formats described here (https://help.salesforce.com/articleView?id=000325035&language=en_US&type=1&mode=1) plus several more. Still I see the result of the Date/Timefield being empty, but the Checkbox type filled gets filled.

ChatTranscript objects custom fields

2
  • Have you tried yyyy-MM-dd HH:mm:ss format? 2020-01-10 10:00:00 I believe the docs mention that value accepts a string. Jan 10, 2020 at 13:19
  • Hi Kris, yes I have tried that format. With the same result unfortunately...
    – martin_m
    Jan 11, 2020 at 14:54

1 Answer 1

0

I had the same issue and reached out to Salesforce Support. They told me that date fields are not supported as of now and referred to this Knowledge Article:

Knowledge Article Number 000316757 Description
Which field types are supported in Embedded Service (Snap-ins) pre-chat form?

Resolution:

Currently, the following field types are supported:

  • Email
  • Phone
  • Picklist (not including dependent picklist at this time)
  • Text

Link to Knowledge Article

However, what does work is to pass the value in a text field and then use some automation tool to copy this value in a date field. Not really a great solution but I think it does the trick as a work-around.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .