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

viraj4
Giga Contributor

Hi Asif,

Thanks for the response that worked for me

Regards,

Viraj

But it was showing read only I want to update or edit the form so how we can achieve.

Hi Viraj,

please refer script mentioned by asif.

Do let us know if more help required.

Regards
Ankur

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

Kieran Anson
Kilo Patron

Hi Viraj,

Use on an onChange client script based on 'Vendor' field as below:

function onChange(control, oldValue, newValue, isLoading, isTemplate) {
    if (isLoading || newValue === '') {
        return;
    }

    //Type appropriate comment here, and begin script below
    var description = "Name: \nActions: \nRoot Cause: \n";
    g_form.setValue("Description", description);
}

Indrajit
Mega Guru

Hey viraj,

To prepopulate description field on incident form you have to create onChange() client script with where om change of vendor company and for pretext just check out below link, might help you

https://community.servicenow.com/community?id=community_question&sys_id=9d7c0ba5db9cdbc01dcaf3231f96...

 

kindly mark Correct and Helpful if applicable.

Regards,

Indrajit.