Create sys_cs_message with GlideRecord form custom scope
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-14-2025 03:46 AM
I'm trying to create a sys_cs_conversation with messages in a Script Include from a scoped application.
Creating the conversation worked fine with this:
var conversation = new GlideRecordSecure('sys_cs_conversation');
conversation.initialize();
conversation.setValue('device_type', 'CC Voice');
conversation.setValue('state', 'open');
var conversationId = conversation.insert();
Trying the same with sys_cs_message does not work:
var conversationMessage = new GlideRecordSecure('sys_cs_message');
conversationMessage.initialize();
conversationMessage.setValue('payload', transcriptMessage);
conversationMessage.setValue('conversation', conversationId);
var conversationMessageId = conversationMessage.insert();I've created the necessary cross-scope priviliges from the source scope to the global target scope for all operations (read, create, write) and adapted application access (Can read, Can create, Can update) on the sys_cs_message table.
While it runs through in the script include it does not create a sys_cs_message record.
When executing the same lines in a background script in the same scope I receive this error:
Security restricted: Access to api 'setValue(sys_cs_message.payload)' from scope '[CUSTOM_SCOPE]' has been refused due to the api's cross-scope access policy.
Security restricted: Access to api 'setValue(sys_cs_message.conversation)' from scope '[CUSTOM_SCOPE]' has been refused due to the api's cross-scope access policy.
Security restricted: Create operation against 'sys_cs_message' from scope '[CUSTOM_SCOPE]' has been refused due to the table's cross-scope access policy
When executing this code in a background script in the global scope the record is created successfully.
I have also tried to create the message with:
var conversation = sn_connect.Conversation.get(conversationId);
conversation.sendMessage(transcriptMessage);and
var factory = new sn_cs.ConversationMessageFactory();
var message = factory.createTextMessage(conversationId, transcriptMessage);but similar problems occur.
Is there a way to create a sys_cs_message without the use of the external Voice Interaction API?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-14-2025 04:01 AM
Did you also check the restricted caller access privileges (sys_restricted_caller_access) table?
Regards,
Sumanth
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-14-2025 04:03 AM
Also try giving 'Execute API' access along with create.
Accept the solution and mark as helpful if it does, to benefit future readers.
Regards,
Sumanth
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-14-2025 04:35 AM
