onload catalog client script g_form.getReference in Portal not working

dilini
Giga Expert

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

1 ACCEPTED SOLUTION

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);
        }
    }
}

View solution in original post

32 REPLIES 32

The script you just offered isn't an alternate solution.  It is the solution I already offered with different variable names.  It's true that you CAN hijack people's threads, but it's incredibly rude and usually confuses the issue.  The link you're referencing (where you imply that I do the same thing you're doing here) is about the 3rd time that person posted the exact same issue (the first 2 of which I responded to with a similar answer).  I wasn't hijacking anything, I was reinforcing a point I had already made.

You can continue to do what you want but the mess here in this thread speaks for itself.

I replied after an hour when there was no other response from anybody. And all I wanted is to help people get their answer quickly. 

 

 

I definitely see you making a mess. But I have no problem with it.


Please mark this response as correct or helpful if it assisted you with your question.

Above scrip doesn't work too. rec object is not passed to call can function.

The variable 'bulkmail_supervisor_name', is it pointing to the user table?


Please mark this response as correct or helpful if it assisted you with your question.

Yes. us_user table.