- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-14-2016 07:33 AM
Hi,
There is a field "App Code" in one of the catalog items which has a validation to check if the user is entering already existing app code, in case he is entering the existing one it should alert "Requested app code already exists choose a different one".
I am using the below script:
var ui_app_code = g_form.getValue('u_requested_app_code');
var gr = new GlideRecord('cmdb_ci_appl');
gr.addQuery('u_application_code', ui_app_code);
gr.query();
while(gr.next())
{
alert (" Requested App code already exists. Please choose a different one...");
return false;
}
}
If I am trying to submit the catalog item using the existing app code from an ESS page I have an alert and the form does not get submitted but the same is not working in service portal. can some one help me on what modifications has to be done to the code to make it work in service portal.
Thanks,
Bargavi
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-16-2016 10:01 AM
was able to resolve it using thread Catalog Client Script asyncrhonous query to stop submission onSubmit.
Thanks for replying
-Bargavi
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-14-2016 01:45 PM
From my knowledge, alert does not work on service portal.
You should instead use g_form.addErroMessage or g_form.addInfoMessage

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-14-2016 01:56 PM
alert() still works in SP for me. I think I remember seeing somewhere that if you're using client side gliderecord in SP you have to use a callback in the query(callback) function. Can't remember where I saw that, and if you're doing it on submit making it async isn't going to help you.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-15-2016 12:53 PM
Usually using callback function will solve the problem. But in your use case, you are using onSubmit client script and you want to abort the submission based on your evaluation. CallBack will not work in this case. Did you try using GlideAjax and getXMLWait()?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-16-2016 10:01 AM
was able to resolve it using thread Catalog Client Script asyncrhonous query to stop submission onSubmit.
Thanks for replying
-Bargavi
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-16-2016 10:14 AM
If the issue is resolved,please mark this thread as answered.
Thanks in advance !