How to set the Requested for value in RITM to within the RITM variables Requestes for (custom )

Kishore Thippal
Tera Expert

I have a requirement that inbound email action when email received by instance then need to create a RITM with SC TASK in fields we have requested for that value need to set the variables so have variables requested for (u_requested_for) this value I'm setting through flow designer but its not getting populate . in workflow i have used as run script activity in starting stage its not worked and have used business rule that's also not worked how to archive this feet.

 

i have used script BR

 

current.request.requested_for=current.variables.u_requested_for; // this not working

 

In workflow i have used this in first activity

workflow.scratchpad.requested = current.request.requested_for.getDisplayValue();

 

I have used this after approval activity in workflow in logs I'm getting the value but value haven't set for variable

current.variables.u_requested_for = workflow.scratchpad.requested;

 

KishoreThippal_0-1704176293393.png

 

 

Thanks,

Kishore.

 

 

 

 

1 ACCEPTED SOLUTION

Kishore Thippal
Tera Expert
Finally got the solution for this issue thank you Ankur Bawiskar
 
var ritm = new GlideRecord('sc_req_item');
ritm.get(current.sys_id);
ritm.variables.u_requested_for = ritm.request.requested_for;
ritm.update();
gs.log('scratchpad:' + ritm.requested_for + ':' + current.variables.u_requested_for);
 
Thanks,
Kishore.

View solution in original post

6 REPLIES 6

Ankur Bawiskar
Tera Patron
Tera Patron

@Kishore Thippal 

you want to set variable (u_requested_for) value or field (requested_for for REQ) value?

For setting the requested_for on REQ use this in after insert BR of RITM table

var req = current.request.getRefRecord();
req.requested_for = current.variables.u_requested_for;
req.update();

For setting the variable value use workflow run script

workflow.scratchpad.requested = current.request.requested_for;
current.variables.u_requested_for = workflow.scratchpad.requested;

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader

Hi Ankur,

 

Thanks for the your reply need to set the variable value based on (Requested for) from RITM or REQ

i have used this in workflow value passing but value not setting for the u_requested_for  variable this is the issue

workflow.scratchpad.requested = current.request.requested_for;
current.variables.u_requested_for = workflow.scratchpad.requested;

 

Thanks,

Kishore.

@Kishore Thippal 

u_requested_for variable is of what type? reference right?

any reference qualifier is present on that variable?

if it's reference then it requires sysId and not display value

If you are using after insert BR then use current.update()

current.variables.u_requested_for = current.request.requested_for;

current.update();

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader

u_requested_for variable is reference type- No good luck for this i have used this script in BR

 

The variable don't have any conditions as well as don't have any reference qualifiers

 

current.variables.u_requested_for = current.request.requested_for;

current.update();