getreference

SANNAPUREDDYV
Tera Contributor

if Caller - Manager and Assigned TO - Manager both are same,then alert message.?
"Both Caller and Assigned To Manager are same"

6 REPLIES 6

Gangadhar Ravi
Giga Sage
Giga Sage

@SANNAPUREDDYV  You can do on change client script or on submit. 

can you provide onchange client script code for this.

Mani A
Tera Guru

onsubmit client script 

Sample code

Var callerManager,assignManager;

Var cM= g_form.getReference("u_caller",callBack);

function callBack(cM)

{

CallerManger= cM.manager.toString();

}

 

Var aM= g_form.getRefence("u_assignedTo", setBack);

function setBack(aM)

{

  assignManager= aM.manager.toString();

}

if( callerManager && assignManager) 

{

If(callerManager==assignManager)

{ alert ("...");}

}

Kiran_45
Giga Guru

Hello @SANNAPUREDDYV :

 

//OnChange client script on assigned to
var callerId = g_form.getValue('caller_id'); // Get the caller ID
var assignedToId = newValue; // The new value of assigned_to (triggered on change)

// Caller's manager
    g_form.getReference('caller_id', function(callerUser) {
        var callerManagerId = callerUser.manager; // Get the manager's sys_id of the caller
        
        // Assigned_to's manager
        g_form.getReference('assigned_to', function(assignedToUser) {
            var assignedToManagerId = assignedToUser.manager; // Get the manager's sys_id of the assigned_to
            
    //Check
            if (callerManagerId === assignedToManagerId) {
                alert('The manager of the caller and the assigned to are the same!');
            }

Note: This approach avoids server-side processing, but still this will cause performance issues with user experience.

 

Please hit the thumbs up if this resolves your issue.

 

Thanks,

Kiran