How to set RITM Opened By value with CartJS API?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-21-2023 07:27 PM
I am using CartJS API to dynamically create RITM.
Everything is working fine.
But I am not able to customize the Opened By field's value in the RITM by the following code:
var ritm = {
sysparm_id: "catalog sys id",
sysparm_quantity: "1",
sysparm_requested_for: "custom value",
sysparm_opened_by: "custom value", /** NOT WORKING **/
variables: {
variable1: "custom value",
variable2: "custom value",
},
};
Can someone please tell me what is the correct parameter name to do this.
In above code, sysparm_opened_by is not working.
Please mark this post as a solution and also as helpful, if this resolves your issue or query.
Thanks,
Subhadeep Ghosh.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-21-2023 07:35 PM
Hi @subhadeep1618 ,
You can try using the impersonation in Script. Try the following approach,
session.onlineImpersonate("USER_NAME"); //Start impersonation as the user whom you want the opened_by field to be
WRITE ALL YOUR CODE HERE TO CREATE THE RITM
session.onlineUnimpersonate(); //End impersonation
Anvesh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-21-2023 08:22 PM
I've a much simpler way of doing this instead using session impersonation.
I can simply set the Opened By value in the workflow - it is working perfectly.
But I just wanted to know if this is possible through CartJS API or not.
Please mark this post as a solution and also as helpful, if this resolves your issue or query.
Thanks,
Subhadeep Ghosh.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-21-2023 08:12 PM
what is being shown currently in opened_by field?
where have you written this script?
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-21-2023 08:20 PM
Currently the name of the user who runs this script (e.g. System Administrator) is being shown.
Please mark this post as a solution and also as helpful, if this resolves your issue or query.
Thanks,
Subhadeep Ghosh.