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 ChasitorInit
endpoint:
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/Time
field being empty, but the Checkbox
type filled gets filled.
yyyy-MM-dd HH:mm:ss
format?2020-01-10 10:00:00
I believe the docs mention thatvalue
accepts a string.