- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-21-2023 05:33 AM
Hello,
I have a RITM that is related to vendor risk managment .. this ritm sets up a vendor on the core_company table.
On the RITM form, there is the a reference field that allows user to select vendor; and if the vendor is not already on the core_company table, we have a checkbox that says "vendor not found". If that is checked, the user enters the Vendor name in a free form text field and then the vendor record is created on the core_company table. The problem is, people aren't checking the reference field to see if the vendor exists, they are usign the free form field. so, many duplicate vendors are being created.
Does anyone have any ideas on how to write a script to prevent this - ideally if someone types in "VEndor A" in the free form, i'd like a message that says "Vendor A already exits, please select that from the field above".
Thanks
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-25-2023 07:54 AM
Hi @Ankur Bawiskar and @Mayur2109 ,
Thanks for all of the valuable feedback. Turns out all I needed was the following client script - no script includes was required:
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-21-2023 07:42 AM
Thank you @Ankur Bawiskar I update the scripts and it still doesn't seem to be working. I will continue to try and pinpoint what is wrong. If you have any other ideas let me know. Thank you!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-21-2023 07:55 AM
unless you debug by adding alert in client side and log in server side you won't know.
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-25-2023 07:54 AM
Hi @Ankur Bawiskar and @Mayur2109 ,
Thanks for all of the valuable feedback. Turns out all I needed was the following client script - no script includes was required:
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-31-2025 03:03 PM - edited 07-31-2025 03:04 PM
I know this is old... but I wanted to call out a couple of things...
1. While doing a gliderecord look up client side CAN work... it's not suggested or best practice to do so
2. In your first post of code, you said
here is my script includes:
var checkvendor = Class.create();
checkvendor.prototype = {
initialize: function() {
var name = this.getParameter('sysparm_company');
var gr = new GlideRecord('core_company');
gr.addQuery('name', name);
and later you said it "IS" client callable... but you never posted your full script again only the method itself.
While you may have checked the box for Client Callable... if the prototype line didn't update to this and stayed as it is above...
checkRecords.prototype = Object.extendsObject(AbstractAjaxProcessor, {
it would not have worked.