- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-13-2024 03:20 AM
Hi,
I thought I would follow this article to set the "Requested for" field.
https://support.servicenow.com/kb?id=kb_article_view&sysparm_article=KB0529490
It seems simple enough - run a client script that calls a "Script Include", but I am getting "Javascript error".
Here's the script from the article. Can anyone see what could be wrong here?
var CartRequestFunction = Class.create();
CartRequestFunction.prototype = Object.extendsObject(AbstractAjaxProcessor, {
cartRequestFunction: function () {
var requestedFor = this.getParameter('sysparm_requestedFor');
var cart = new GlideRecord('sc_cart');
var userid = this.getParameter('sysparm_currentUser');
cart.addQuery('user', userid);
cart.query();
if(cart.next()){
// Update Requested for in the cart
if (cart.requested_for != requestedFor) {
cart.requested_for = requestedFor;
cart.update();
}
}
}
});
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-13-2024 03:23 AM
This knowledge article predates the introduction of the 'Requested For' variable set which allows for a seperation between Opened By and Requested For.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-13-2024 03:23 AM
This knowledge article predates the introduction of the 'Requested For' variable set which allows for a seperation between Opened By and Requested For.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-13-2024 06:00 AM
Fantastic!! Thank you Kieran. That was so easy - instead of a "Reference" variable, changing that to "Requested for" has done everything I needed it to.