How to Map variables from service request(RITM) to incident description which is created in workflow using Run script?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-29-2022 03:23 AM
Hi All,
I am creating an incident in workflow using run script based on option selected in form level, and I have to map the variables which is presented in RITM and form to incident description part(Dependent fields also need to map and those fields should be mapped if that is selected on the form otherwise those variables should not come in incident description part).
If 'a' is selected on form it will be creating an incident otherwise RITM & catalog task will be created.
if(a == 'true')
return 'yes';
else
return 'no';
Below is the code which I have tried to map Independent fields.
var gr = new GlideRecord("incident");
gr.initialize();
gr.setValue('impact', 3);
gr.setValue('urgency', 3);
gr.setValue('u_user_impact', 4);
gr.setValue('u_requested_by', current.u_requested_by);
gr.setValue('u_requested_for', current.variables.requested_for);
gr.setValue('short_description', "Request assistance from the CRM Support Team ");
gr.setValue('description', "aaa : " + current.variables.backend value of the variable);
gr.insert();
I want to map Dependent fields and checkbox variables that should come only if they have selected in form, otherwise it should not come in the description of the incident .
Please suggest how to map dependent fields and check box variables?
Choose atleast one option:

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-29-2022 04:28 AM
Hi Natraj,
I don't understand what is dependent field , can you eloborate.? below short description you can add something like if(current.variables.backedname!= '') { gr.setValue('description', "aaa : " + current.variables.backend value of the variable);} something like this.
Regards
Regards,
Musab
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-29-2022 04:58 AM
Hi ,
I have used same condition but it is not working.
Thanks & Regards,
Natraj
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-29-2022 05:07 AM
Hi Rasheed,
The fields will be hidden on the form level, If we select any other fields some fields will be populated.
Example:
If we select option "a", b and c will be populated.
If we didn't select select a , b and c will be hidden and it won't be mapped to incident ticket.
Regards,
Natraj

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-29-2022 06:07 AM
In Condition where you are checking whether 'a' is selected or not , just store that variable value in workflow scratchpad variable and call that variable in Incident script and check for empty value and proceed.?
In If block
workflow.scratchpad.a= current.variables.backedname;
and In Incident script
var ge = workflow.scratchpad.a;
and before detailed description mapping use something like
if(ge != '')
{
gr.setValue('description', "aaa : " + current.variables.backend value of the variable);
}
Regards,
Musab