VIP Incidents and Requests

Rahul Raja Sami
Tera Guru

We have VIP field in user Table.

when it is selected for any user, in the incident form the caller will be highlighted as below

find_real_file.png

 

bbut for Requests it is not showing any indications for Vip Caller

 

find_real_file.png

Is this OOB functionality or can we implement the same for requests as well?

Please Help.

 

 

1 ACCEPTED SOLUTION

You are very close 🙂 -- the name of the Request table is 'sc_request', so you need to replace the instances of 'request.requested_for' with 'sc_request.requested_for'. 

The below script is working for me in my PDI:

function onChange(control, oldValue, newValue, isLoading) {
    var callerLabel = $('label.sc_request.requested_for');
    var callerField = $('sys_display.sc_request.requested_for');
    if (!callerLabel || !callerField)
        return;

    if (!newValue) {
        callerLabel.setStyle({
            backgroundImage: ""
        });
        callerField.setStyle({
            color: ""
        });
        return;
    }
    g_form.getReference('requested_for', vipCallerCallback);
}

function vipCallerCallback(caller) {
    var callerLabel = $('label.sc_request.requested_for').down('label');
    var callerField = $('sys_display.sc_request.requested_for');
    if (!callerLabel || !callerField)
        return;

    //check for VIP status
    if (caller.vip == 'true') {
        var bgPosition = "95% 55%";
        if (document.documentElement.getAttribute('data-doctype') == 'true')
            bgPosition = "5% 45%";

        callerLabel.setStyle({
            backgroundImage: "url(images/icons/vip.gif)",
            backgroundRepeat: "no-repeat",
            backgroundPosition: bgPosition,
            paddingLeft: '30px'
        });
        callerField.setStyle({
            color: "red"
        });
    } else {
        callerLabel.setStyle({
            backgroundImage: ""
        });
        callerField.setStyle({
            color: ""
        });
    }
}

find_real_file.png

If this answer is helpful please mark correct and helpful!

Regards,

Christopher Perry

If this answer is helpful please mark correct and helpful!

Regards,
Chris Perry

View solution in original post

15 REPLIES 15

Please ensure the 'Isolate script' field on your new client script is set to false and that error should be resolved:

find_real_file.png

If this answer is helpful please mark correct and helpful!

Regards,

Christopher Perry

If this answer is helpful please mark correct and helpful!

Regards,
Chris Perry

i made it so but it is showing nothing

find_real_file.png

 

find_real_file.png

 

 

Could you please copy and paste the entire script? And also provide a screenshot of this part of the client script form?

find_real_file.png

If this answer is helpful please mark correct and helpful!

Regards,
Chris Perry

find_real_file.png

 

function onChange(control, oldValue, newValue, isLoading) {
var callerLabel = $('label.request.requested_for');
var callerField = $('sys_display.request.requested_for');
if (!callerLabel || !callerField)
return;

if (!newValue) {
callerLabel.setStyle({backgroundImage: ""});
callerField.setStyle({color: ""});
return;
}
g_form.getReference('requested_for', vipCallerCallback);
}

function vipCallerCallback(caller) {
var callerLabel = $('label.request.requested_for').down('label');
var callerField = $('sys_display.request.requested_for');
if (!callerLabel || !callerField)
return;

//check for VIP status
if (caller.vip == 'true') {
var bgPosition = "95% 55%";
if (document.documentElement.getAttribute('data-doctype') == 'true')
bgPosition = "5% 45%";

callerLabel.setStyle({backgroundImage: "url(images/icons/vip.gif)", backgroundRepeat: "no-repeat", backgroundPosition: bgPosition, paddingLeft: '30px' });
callerField.setStyle({color: "red"});
} else {
callerLabel.setStyle({backgroundImage: ""});
callerField.setStyle({color: ""});
}
}

under check status 

i even tried with

 if (requested_for.vip == 'true') 

instead of 

if (caller.vip == 'true')