- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-20-2018 08:15 AM
Hi, Following unload script is not working on new Portal. I tried to use GlidAjex and realized GlideAjex is not supporting portal too. does getRefrence also not support portal??
function onLoad() {
//Type appropriate comment here, and begin script below
var supervisorRef = g_form.getReference('bulkmail_supervisor_name', popSupervisorInfo);
function popSupervisorInfo(supervisorRef) {
if (supervisorRef.phone) {
g_form.setValue('bulkmail_supervisor_phone', supervisorRef.phone);
}
}
Thank you!
Dilini
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-20-2018 10:51 AM
If you run this do you see an alert with the supervisor name?
function onLoad() {
// Query for the supervisor
var supervisorRef = new GlideRecord('sys_user');
supervisorRef.addQuery('sys_id', g_form.getValue('bulkmail_supervisor_name'));
supervisorRef.query(popSupervisorInfo);
}
function popSupervisorInfo(supervisorRef) {
if (supervisorRef.next()) {
alert('Supervisor: ' + supervisorRef.name);
if (supervisorRef.phone) {
g_form.setValue('bulkmail_supervisor_phone', supervisorRef.phone);
}
}
}

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-20-2018 12:48 PM
Ok..Got it...Your Supervisor field should be a reference. Looks like you have set it as Lookup Select Box
Please mark this response as correct or helpful if it assisted you with your question.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-20-2018 12:57 PM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-20-2018 01:10 PM
Ok..Lets do this
function onChange(control, oldValue, newValue, isLoading) {
if (isLoading || newValue == '') {
return;
}
var rec = new GlideRecord('sys_user');
rec.addQuery('sys_id',g_form.getValue('bulkmail_supervisor_name'));
rec.query(recResponse);
function recResponse(rec)
{
if (rec.next()) { g_form.setValue('bulkmail_supervisor_phone',rec.phone);
}
}
}
Please mark this response as correct or helpful if it assisted you with your question.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-20-2018 01:17 PM
Sanjiv, It's really confusing to have you always jumping in on threads like this. I've already suggested this exact thing 3 separate times but people can't quickly identify that response because you're muddying the waters. If someone else is already answering a question you need to back off until it's clear that they need your help. I appreciate that you're trying to help answer questions, but hijacking threads like this just isn't helping.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-20-2018 01:32 PM
Mark, I don't think I am hijacking any of your threads. I am replying If I have an alternate solution. I can't wait for someone to respond . And if someone is already answering, it doesn't mean I can't put my points.
I will give you an example of what I am doing and may be you are not realizing when you are doing it,
Please mark this response as correct or helpful if it assisted you with your question.