
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-06-2023 10:33 PM
Hi,
I'm needing to do a check on a catalog item as it is being filled in.
I have a text field called:
group_name
What I want to do is after the field is filled in have it check the sys_user_group to see if a group name already exists that is the same.
I was thinking that I'd be able to do it via an onchange client script, but can't seem to get that to work.
Ultimately I want a message to come up advising that the name is already being used if it is found and to just let the person carry on if it is not found.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-07-2023 11:26 PM
it means the value is not getting passed
Also I have updated the client script line as this
if(answer.toString() == 'true'){
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-07-2023 11:26 PM
it means the value is not getting passed
Also I have updated the client script line as this
if(answer.toString() == 'true'){
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-07-2023 11:37 PM
Ok that appears to be very close now.
When I add a new value that is not an active group it accepts it.
When I add an existing value it just blanks out the field - as in it clears the typed text
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-08-2023 12:17 AM
So I consider the script is working as expected
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

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-08-2023 11:01 PM
Isn't this line meant to add a message so the user knows why the field is now blank?
if(answer.toString() == 'true'){
var message = 'This group is already present in groups table';
g_form.clearValue('group_name');
g_form.showFieldMsg('group_name ',message,'error',
true);