Hide Fields in the section based on the field value on the record producer form

KC9138345891171
Tera Contributor

we have record producer which will create a record in target table upon submission and now my requirement is to hide particular fields in the section on the form based on the other filed value on the form for the new records which will be creating from now.

For that I have written a onload catalog client script as below but still is not hiding the field as expected, your help with your expertise would be helpful.

Thanks in advance!!

function onLoad() {
    //Type appropriate comment here, and begin script below

    if (g_form.isNewRecord() && g_form.getValue('u_approval_type') == 'Process Exception Request') {
        g_form.setDisplay('u_standard_azl_solution_arch', false);
    }


}
16 REPLIES 16

"u_standard_azl_solution_arch" is a field under section called "Process exception" on the target table form. please find the below screenshot

KC9138345891171_0-1762513473929.png

 

 

@KC9138345891171 

then as mentioned create normal onLoad client script on your target table and use the logic I shared above

Ensure you use correct variable name and if variable is choice then give correct choice value to compare

💡 If my response helped, please mark it as correct and close the thread 🔒— this helps future readers find the solution faster! 🙏

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

Approval type is just a string field on the target table Ankur and I have written client as below but still no luck !!

KC9138345891171_0-1762516860314.png

 

@KC9138345891171 

your syntax is wrong.

you missed to add this in quotes

function onLoad() {
    //Type appropriate comment here, and begin script below

    if (g_form.isNewRecord() && g_form.getValue('variables.u_approval_type') == 'Process Exception Request') {
        g_form.setDisplay('u_standard_azl_solution_arch', false);
    }
}

💡 If my response helped, please mark it as correct and close the thread 🔒— this helps future readers find the solution faster! 🙏

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

No luck Ankur, still it is not working!!
I updated the script with dictionary backend name of the filed as well, please find the below

KC9138345891171_0-1762519560814.png

KC9138345891171_1-1762519584076.png