- 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 04:52 AM
would you mind to check the console, while hitting the submit button whats coming in console log.
have you seen any error in console log?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-24-2018 04:45 AM
Do you have any variables in your record producer which are marked as mandatory on it directly?
If yes can you please remove those mandatory check at variable level and see if the submitting message dissappear?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-24-2018 04:48 AM
No, I have made all required variables mandatory via UI Policy.
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-24-2018 04:52 AM
There was known issue on service catalog related to the Submit button which was similar to your scenario and it was caused by the mandatory check. I was just checking on it.
Do you have any other record producers in development? Can you check its behavior?