Map variables to description field on incident form

Community Alums
Not applicable

Hey guys,

 

On record producer, when  an incident  is raised on behalf of an affected user by their manager, or is raised by there manager's manager or any other additional manager to reset password autopulate the  descriotion field with caller, affected user, email and date.

 

Firstly, how do i use the if else if condtion for the above? only the if condtion for when a n indient is raised by affected user's manager works the else if for other conditions don't work.

 

There is a script that checks if email or location  is empty, populate description field with short description and affected ci. I only want to update/include the above to the script. i need to update the script to check for  the above conditions. If the caller is requesting the reset only popluate email and date in the description field. 

There are no variables declared on the script.

 

I appreciate your guidance.

3 REPLIES 3

Ankur Bawiskar
Tera Patron
Tera Patron

@Community Alums 

share that script here along with screenshots.

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

Community Alums
Not applicable

Hi Ankur.

Here is the script snippet.

current.caller_id = gs.getUserID();
if (producer.manager_1 !== '') {
current.u_affected_user = producer.application_password_reset_firstline_reporter;
 
}
else if (producer.report_to_direct_reports_manager_2) !== '') {
current.u_affected_user = producer.user_report_to_direct_reports;
}
else if (producer.additonal_manager_reset_password_3) !== '') {
current.u_affected_user = producer.additonal_manager_reset_password;
}
else current.u_affected_user = gs.getUserID();
 
current.location = gs.getUser().getLocation();
current.u_telephone_number = gs.getUser().getRecord().getValue('phone');
current.category = 'Password Reset';
current.business_service =
current.cmdb_ci = producer.application_name;
current.impact = 3;
current.urgency = 3;
current.contact_type = 'self-service';
current.assignment_group = producer.application_name.u_password_assignment_group;
current.short_description = "Please reset my " + producer.application_name.getDisplayValue();
 
if (producer.email_address == '' && producer.location == '') {
current.description = "Password reset request";
}
 
else if (producer.email_address != '') {
current.description = "Password reset request" + "\n" + "Email: " + producer.email_address;
}
 
else {
current.description = "Password reset request" + "\n" + "Location: " + producer.location.getDisplayValue();
}
current.description = current.description + "\nUser ID = " + producer.user_id;
 
Thanks

Community Alums
Not applicable

Hi Ankur.

I have attached the script. As previously mentioned,, the script was already in place, new part updated  on the script is the affected user statements. 

 

Thanks.