autopopulate value based on selecting the value in other field

suuriya
Tera Contributor

Hi Community,

 

I have 2 requirements:

 1. In catalog form there are 2 fields badge access location (reference to cmn_location table) and location type (single line)...on selecting any location in badge access location field its location type needs to be auto populate in location type field.

backend names of fields: badge_access_location, location_type

But this is how location types are there in location record.

suuriya_0-1700481823208.png

For example if i select #100 location in badge access location field then pharma site need to be populate in location type field.

2.  select box field called select badge type and has 10 options...if contractor or employee is selected in the field then popup msg should display and users are not allowed to submit the form.

backend name of field: select_badge_type

How can we achieve this...please provide entire onchange and onsumbit script.

 

Thanks in advance

3 REPLIES 3

Ankur Bawiskar
Tera Patron
Tera Patron

@suuriya 

why not you start the script and share us where are you stuck?

This will help you to learn as well.

What happens if multiple checkboxes are selected? you want those field's label as Comma separated value

You can easily achieve this using onChange and GlideAjax

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

HI @Ankur Bawiskar ,

 

For second requirement i tried and it is working as expected...used onsubmit with return false; (with conditions)

 

For first can you guide me how can we do that...

 

Thanks in advance 

@suuriya 

you should use onChange client script only and not onSubmit.

onSubmit should not be used to set any 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