How to map a variable requested for to the RITM Field requested for

BCELSTEI
Tera Expert

Hello everybody,

I d like to know how to push the requested for variable on the sc_req_item.requested for field 

my requested for variable is in set variable I don't know if it can be trouble.

 

find_real_file.png

I already searched in the community and it's not working

https://community.servicenow.com/community?id=community_question&sys_id=00c00b65db98dbc01dcaf3231f9619b6&view_source=searchResult

 

I created a BR on before based on my catalog element and it's working for the other field (self service,telephone and description)

(function executeRule(current, previous /*null when async*/) {

// Add your code here

current.requested_for=current.variables.requested;
current.contact_type='self-service';
current.u_t_l_phone_pro=current.variables.telephone;current;
current.description=current.variables.description;

})(current, previous);

 

Thanks a lot for your help

Have a good day

Barbara CS

1 ACCEPTED SOLUTION

mr18
Tera Guru
Tera Guru

you can achieve this from workflow.

In the workflow, use Run script and try below code

var req = new GlideRecord("sc_request");
req.addQuery("sys_id", current.request);
req.query();
if(req.next()) {
req.requested_for = current.variables.<variable name>;
req.update();
}

View solution in original post

5 REPLIES 5

Thanks a lot for your help. I created a workflow with an Run script and it's works! Have a good day