autopopulate value based on selecting the value in other field
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-20-2023 04:12 AM
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.
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
- Labels:
-
Service Catalog
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-20-2023 04:24 AM
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
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-20-2023 07:12 AM
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-20-2023 08:27 AM
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.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader