- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-11-2017 07:02 AM
On form load, I need a script that will prevent access and produce a pop up based on the employee number. If the employee number has a 'negative' in front, they should not be able to access the form, and a pop up message should appear with some explanatory text.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-12-2017 10:55 AM
I was able to achieve this with the following client script:
function onLoad() {
var rec = new GlideRecord('sys_user');
rec.addQuery('sys_id', "=", g_user.userID);
rec.query(recResponse);
function recResponse(rec) {
rec.next();
if(parseInt(rec.employee_number) < 0){
alert("To order this service a contractor/non employee will require a sponsor to Order On Behalf to obtain database access.");
history.go(-1);
g_form.setDisplay('addSubmitButton',false);
}
}
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-12-2017 10:55 AM
I was able to achieve this with the following client script:
function onLoad() {
var rec = new GlideRecord('sys_user');
rec.addQuery('sys_id', "=", g_user.userID);
rec.query(recResponse);
function recResponse(rec) {
rec.next();
if(parseInt(rec.employee_number) < 0){
alert("To order this service a contractor/non employee will require a sponsor to Order On Behalf to obtain database access.");
history.go(-1);
g_form.setDisplay('addSubmitButton',false);
}
}
}