- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-07-2023 06:58 AM
Hello;
For a business need, I need to modify the field "Requested for" of RITMs by script.
I did the following test in a background script:
var grRITM = new GlideRecord('sc_req_item');
grRITM.get('<sys_id of the RITM>');
grRITM.setValue('requested_for','<sys_id of the user>');
grRITM.update();
- On my PDI, it works fine, the field is being updated;
- On my business instance, field is not updated.
Although there is a comment added mentioning it was updated:
Note: If I modify the value of the field manually, it works. (meaning after saving, the new value is displayed).
I suppose this is due to a rule in my business instance, I looked for "requested_for" in Business Rules but I did not find one that would prevent to update this field.
I wanted to ask where I could look / what should I be searching for, to find out what is causing me this issue ?
Thank you very much in advance for your support !
Kr,
Sylvain
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-08-2023 02:53 AM
Yeah that is what i am saying it is the field coming from sc_request and not a field directly on ritm table
var grRITM = new GlideRecord('sc_request');
grRITM.get('sys_id_of_request'); // you can get this from request field of ritm
grRITM.requested_for='sys_id of the user';
grRITM.update();
OR
Bring the requested for field of RITM on the form.
Please mark my answer as correct based on Impact.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-07-2023 07:27 AM
If it is logging in the activity formatter as field chnages then the field value should have been updated.
Any ways please use the below code once and check:-
var grRITM = new GlideRecord('sc_req_item');
grRITM.get('<sys_id of the RITM>');
grRITM.requested_for='sys_id of the user';
grRITM.update();
Also just check once if the requested for you are looking at on the RITM form is requested for from the RITM tabke or is it dotwalked from request and you are looking at that value.
Please mark my answer as correct based on Impact.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-08-2023 01:04 AM
Hello Saurav,
Thanks for your reply.
I tried your code and it does not work either.
The "requested for" field is indeed the standard field of the RITM and not a variable of the catalog item:
Other information : If I update the "description" field by script with same code as above, it works.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-08-2023 01:11 AM
Hello,
Please right click on the requested for field. Then click on show requestd for as below:-
Then let me know what you see in the below:-
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-08-2023 01:53 AM - edited 06-08-2023 01:55 AM
Hi Saurav,
Please find below: