- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-23-2018 04:07 AM
Hi All:
I have a Record producer (table - u_visitor with fields - Name/ mobile no/ checkin time/ checkout time/ state) where I need to check mobile number and if it matches in table then user state change to "checked out" else alert user to check mobile number and abort.
I tried but not able to get else condition work to alert user & abort process. Please suggest.
—— Record Producer Script section -------
var mno = producer.u_mobile_number;
var rec = new GlideRecord('u_visitor');
rec.addQuery('u_mobile_number', mno);
rec.query();
if (rec.next()) {
rec.u_state = 'checkedout';
rec.u_checkout_time = current.u_checkout_time;
rec.update();
current.setAbortAction(true);
}
Note: All RP form fields mapped to table fields.
Thanks
Solved! Go to Solution.
- Labels:
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-23-2018 10:00 AM
I just noted that this was a record producer. You could directly with the producer script. Can you please try this once after deactivating the client script and see if it works?
var mno = producer.u_mobile_number;
var rec = new GlideRecord('u_visitor');
rec.addQuery('u_mobile_number', mno);
rec.query();
if (rec.next()) {
rec.u_state = 'checkedout';
rec.u_checkout_time = current.u_checkout_time;
rec.update();
}else{
gs.addErrorMessage("Update Mobile number First");
current.setAbortAction(true);
//producer.redirect ="";
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-24-2018 03:40 AM
Yes, even on my service portal without using redirection(which is not working actually) error message is coming and stays on the form as "submitted" which may confuse user that anyhow form is submitted so he will ignore it.
So that's why redirection is required.
Is the producer.redirect do not work on portal?
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-24-2018 03:45 AM
It does not stay submitted in my instance, I am able to submit it again in this case adding a different input.
The service portal is auto-redirecting to same form, so forced redirection is not required here. There is some other issue with your Submitted button getting locked out
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-24-2018 04:05 AM
Yes after your input I have tried in my personal instance too and noticed the same that error message is coming and submit button is not getting greyed out. So can update and submit again.
But interesting part is even when user is entering valid mobile number even then submit button is not turned to submitted.
So force redirection is must. Any idea why redirection is not working?
Thanks

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-24-2018 04:27 AM
once you hit the submit button , is your submit button showing like "submitting.." ?
can you share the screenshot?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-24-2018 04:33 AM