Notifications

68 views

Issue

Symptoms

When trying to use 'work_notes' as the field parameter of the sendMessage method in the Conversation API, the message is still posted as a comment.

Release

All

Cause

The Documentation is a bit incorrect and instead of passing two string parameters into the sendMessage method you should instead be passing an object.

Resolution

Call the sendMessage method with an object containing a body and field.

 

Here is an example that should work in a connect action.

var con = sn_connect.Conversation.get(conversation.sys_id);
con.sendMessage({body: 'testMessage', field: 'work_notes'});

 

Here is an example that should work in a connect action.

var con = sn_connect.Conversation.get(conversation.sys_id);
con.sendMessage({body: 'Are you available?'});

 

Additional Information

Documentation of the method. 

https://docs.servicenow.com/bundle/madrid-application-development/page/app-store/dev_portal/API_reference/Conversation/concept/c_ConversationScopedAPI.html#conversation-sendMessage_String_String

Article Information

Last Updated:2019-08-02 20:43:38
Published:2019-07-26