The CreatorCon Call for Content is officially open! Get started here.

Agent Chat Queues

Rkanodia
Tera Contributor

Hi 

Can someone help me in setting up queues based on the payroll country vale from HR profile table. Have written a script below, please let me know if I am missing at something. 

Rkanodia_0-1714583406585.png

(function executeCondition(/* glide record */ current) {
    if ('interaction_json_blob' != current.context_table || !current.context_document) return false;

    var grBlob = new GlideRecord('interaction_json_blob');
    if (grBlob.get(current.context_document)) {
        try {
            var value = JSON.parse(grBlob.getValue('value'));
            var userName = value['opened_for'];

            var hrProfile = new GlideRecord('sn_hr_core_profile');
            hrProfile.addQuery('name', userName);
            hrProfile.query();

            if (hrProfile.next()) {
                var hrPayrollCountry = hrProfile.getValue('u_payroll_country');
                if (hrPayrollCountry.toUpperCase() === 'INDIA') {
                    return true;
                }
            }
        } catch (e) {
            return false;
        }
    }
    return false;
})(current);
 
Rkanodia_1-1714583454070.png

 

0 REPLIES 0