Vendor management workspace
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-19-2023 08:55 AM
Hello,
I installed the Vendor Management plugin in my PDI and was playing around with the functionality when when being on an incident form, you set the state to "On Hold" and reason to "Awaiting Vendor", it should show vendor related fields on a tab. I am currently getting the error " getReference for cmdb_ci not allowed: missing callback function as parameter". Since this is out of the box, is there a fix? below is a screenshot of the client script. any thoughts? I did not want to change anything since these are out of the box.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-19-2023 10:02 AM
Because this is a client script. the way you would retrieve data is by sending a request to the server, waiting for response and then once you receive the response you are executing a function to handle that answer from the server.
Now there is an error in this script:
g_form.getReference('field_name', CALLBACK_FUNCTION_HERE);
In the script you've pasted, it is missing the function as a 2nd parameter on the getReference function.
Should look something like this:
g_form.getReference('cmdb_ci', function(record){
//do something with the response record.
});
In the case shown it's totally crazy, because then it's trying to do another gliderecord on the same thing inside of the client script. for me it looks like it's just trying to get the vendor from the ci and set the src_vendor on your current form.
here is how this script should look like:
g_form.getReference('cmdb_ci', function(record){
g_form.setValue('scr_vendor', record.vendor);
});
Mark as helpful if this helped you 🙂
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-19-2023 11:53 AM
Thank you for your response. There is something up with this script. I commented some of the code to see if it even shows the vendor fields on the incident form and doesn't seem to do that to begin with. I am not sure if I am missing something and this is very possible since I am new to ServiceNow.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-19-2023 11:24 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-19-2023 10:53 PM
I am still not able to get the vendor information from the cmdb_ci table because it gives me onChange script error: TypeError: GlideRecord is not a constructor function () { [native code] } error.