Scripting

khuranahima
Tera Contributor

On the incident form, category should be filled, if a word is present in the short description. Kindly help.

7 REPLIES 7

Ankur Bawiskar
Tera Patron
Tera Patron

@khuranahima 

sorry your requirement is not clear.

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

Alright, thank you so much.

Chaitanya ILCR
Kilo Patron

Hi @khuranahima ,

 

if I understand this correct

if short description contains particular keyword the category should be filled automatically

 

you can crate a onchange client script on short description field on the incident table

ChaitanyaILCR_0-1752846134306.png

 

script

 

I have taken database as a key word an choice 

replace key word with your key work 

and choice with your choice backend value

 

I have added comments next to the lines where you have to update 

function onChange(control, oldValue, newValue, isLoading, isTemplate) {
    if (isLoading || newValue === '') {
        return;
    }
    var keyWord = 'database' ; //replace database with your keyword
    if (newValue.includes()) {
        g_form.setValue('category', 'database'); //replace database with your choice
    }

}

 

If My understanding is wrong please share the requirement in detail with some screenshots

 

 

Please mark my answer as helpful/correct if it resolves your query.

Regards,
Chaitanya

 

Thank you so much.