How to pre-populate description field on incident form on change of vendor company

viraj4
Giga Contributor

How to pre-populate description field on incident form on change of vendor company.

Pre text would be - Name,Actions,Root Cause etc.

Regards,

Viraj

1 ACCEPTED SOLUTION

Hello Viraj,

Write onChange client on your company field and in that add this code

if(newValue == "yoir_company") {
  var desc = "Name:  \nActions:  \nRootCause:  \n";
  g_form.setValue("Description",desc);
}

Kindly mark the comment as a correct answer and helpful if it helps to solve your problem.

Regards,
Asif
2020 ServiceNow Community MVP

View solution in original post

9 REPLIES 9

Pradeep Sharma
ServiceNow Employee
ServiceNow Employee

Hi Viraj,

 

You can create an OnChange Client Script against the company field to set the description field.

https://docs.servicenow.com/bundle/orlando-application-development/page/script/client-scripts/concep...

 

- Pradeep Sharma

Ankur Bawiskar
Tera Patron
Tera Patron

Hi Viraj,

you would require onChange client script on company field; but from where values are to be fetched for Name, Actions, Root Cause etc to populate in description

Regards
Ankur

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

Hi Ankur,

I am not looking for values for name, action,root cause my requirement is when company is changed to X description should be visible with text in desc as below-

Description:

Name:

Actions:

Root Cause:

and value for above fields would then be filled by the user.

How could this be achieved?

Regards,

Viraj

Hello Viraj,

Write onChange client on your company field and in that add this code

if(newValue == "yoir_company") {
  var desc = "Name:  \nActions:  \nRootCause:  \n";
  g_form.setValue("Description",desc);
}

Kindly mark the comment as a correct answer and helpful if it helps to solve your problem.

Regards,
Asif
2020 ServiceNow Community MVP