From the Service Portal record producer form to populate Incident for with "Impact"

Roshni1
Tera Expert

I currently have a form on our SP that captures the new incidents.  Users are to identify the "Impact" and "Urgency" of thier incident which then is added to the Incident form and will set the priorty.  

At this time only the "Urgency" is getting populated after a users submits the form. Is there something wrong with my coding or is there a better way 

 

This is the code I currently have: 

current.setValue('contact_type', 'self-service');
gs.addInfoMessage(producer.getDisplayValue('impacted_user'));
current.setValue('caller_id',producer.getValue('impacted_user'));
current.setValue('contact_type', 'self-service');
//current.setValue('short_description', 'Issue: ' + producer.getDisplayValue('issue_related_to') +   (producer.getValue('issue') ? ' - ' + producer.getDisplayValue('issue') : ''));
current.setValue('u_preferred_method_of_contact', producer.getValue('preferred_method_of_contact'));
if(producer.getValue('alternate_contact_information')) {
    current.setValue('u_alternate_contact_information', producer.getValue('alternate_contact_information'));
}
current.setValue('impact', producer.getValue('impact'));
current.setValue('urgency', producer.getValue('urgency'));
 
Thanks very much for your continued support. 
1 ACCEPTED SOLUTION

Deepak Negi
Mega Sage
Mega Sage

There are easier ways to copy the variables from producer to the target record without any script.

 

1. If you keep the variable names same as Incident field name, it will automatically copy from record producer

e.g keep the Impact variable name as 'impact'

 

2. Use "Map to field" on the record producer form

DeepakNegi_0-1754624242513.png

 

 

Please mark the answer helpful or correct if it helps

 

Thanks
Deepak

View solution in original post

6 REPLIES 6

kaushal_snow
Mega Sage

Hi @Roshni1 ,

 

Both Impact and Urgency are often controlled by Data Lookup Definitions or other priority setting logic, which typically executes after your record producer script runs. Meaning writing directly to these fields (even using current.setValue('impact', ...)) can be ignored or overridden by Servicenow system logic.

 

Check this community post once: https://www.servicenow.com/community/developer-forum/setting-impact-or-urgency-via-script-on-a-recor...

 

If you find this helpful, please accept this as a solution and hit the helpful button..

 

 

Thanks and Regards,
Kaushal Kumar Jha - ServiceNow Consultant - Lets connect on Linkedin: https://www.linkedin.com/in/kaushalkrjha/

Ankur Bawiskar
Tera Patron
Tera Patron

@Roshni1 

impact and urgency determine the Priority of INC.

This is controlled by data lookup definitions.

It runs during record insert.

what's not working for you?

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

Deepak Negi
Mega Sage
Mega Sage

There are easier ways to copy the variables from producer to the target record without any script.

 

1. If you keep the variable names same as Incident field name, it will automatically copy from record producer

e.g keep the Impact variable name as 'impact'

 

2. Use "Map to field" on the record producer form

DeepakNegi_0-1754624242513.png

 

 

Please mark the answer helpful or correct if it helps

 

Thanks
Deepak

It finally worked this time.  Thank you