OnChange client script on dot walked field

sanvi
Tera Expert

Hi All,

 

I have a table called 'Allegation Outcomes' in which there is a dot walked field called Allegation type.

sanvi_1-1747203699596.png

An onchange client script needs to be configured on this field and on change of this field options have to be added and removed in the outcome field.

Issue: unable to configure the onchange 'Field name' for dot walked field.

 

Can anybody suggest an alternative or any other solution to achieve the results?

1 ACCEPTED SOLUTION

Ankur Bawiskar
Tera Patron
Tera Patron

@sanvi 

it won't work that way for dot walked field.

Why are you allowing to change the Allegation type dot walked field on your current form?

If it has to be updated then it should be updated in the actual record and not on the form where it's shown as dot walked field

For your requirement you can use onLoad client script to check the value and then hide

function onLoad() {

    if (g_form.getValue('allegation.allegation_type') == 'your value') {
        g_form.removeOption('outcome', 'choice value');
    }

}

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

View solution in original post

7 REPLIES 7

Ankur Bawiskar
Tera Patron
Tera Patron

@sanvi 

it won't work that way for dot walked field.

Why are you allowing to change the Allegation type dot walked field on your current form?

If it has to be updated then it should be updated in the actual record and not on the form where it's shown as dot walked field

For your requirement you can use onLoad client script to check the value and then hide

function onLoad() {

    if (g_form.getValue('allegation.allegation_type') == 'your value') {
        g_form.removeOption('outcome', 'choice value');
    }

}

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

Hi @Ankur Bawiskar ,

The Outcomes field is on Associated allegations table and the Outcomes value should be associated with each of the Allegation Type and that is the reason i am doing the checks on the 'Associated allegations' table.

And the requirement is after change in the 'Allegation type' the 'Outcome' value option needs to be changed accordingly and i think Onload Client script will not work.

@sanvi 

it won't work as I already said above.

Also not a good practice to allow changing the Dot walked field on form.

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