Modify Requested_for field by script

Sylvain12
Tera Contributor

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:

Sylvain12_1-1686145888154.png

 

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

 

 

 

1 ACCEPTED SOLUTION

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.

View solution in original post

6 REPLIES 6

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.

Sylvain12
Tera Contributor

Oh ok ! 

 

This field is from the REQ...

 

Thank you very much for your help ! Problem solved !

 

Have a nice day  !

 

Kr,

Sylvain