Impersonation on my catalog item requested for user should be editable.

dhineshkumar
Tera Guru

Hi Experts 

I have catalog item "Order computer" When Impersonate any other user on my catalog item I want my requested by field should editable and If I selected the Impersonate user on the requested by field I should popup the info message.
 Example : If I impersonate able tutor and go to catalog item(Order computer) requested by field should be editable and If I select the able tutor it should popup the info message.

Thanks In advance.  

2 REPLIES 2

GopikaP
Mega Sage

Hi @dhineshkumar ,

create an onload catalog client script and add this script - 

function onLoad() {
    //Type appropriate comment here, and begin script below
    var ga = new GlideAjax('test');
    ga.addParam('sysparm_name', 'getImpersonate');
    ga.getXML(updateCampus);
}

function updateCampus(response) {
    var answer = response.responseXML.documentElement.getAttribute("answer");
    if (answer == 'false') {
        g_form.setReadOnly('requested_for',true);
    } else {
		g_form.showFieldMsg('requested_for','test message for abel tutor');
    }
}

and then a client callable script include - test

var test = Class.create();
test.prototype = Object.extendsObject(AbstractAjaxProcessor, {
	getImpersonate:function(){
		return new GlideImpersonate().isImpersonating();
	},
    type: 'test'
});

Adjust the script as needed to fit your requirements.

If this isn't what you meant, please clarify for me. (See the screenshots please)

Ankur Bawiskar
Tera Patron
Tera Patron

@dhineshkumar 

your requirement is not clear.

what script did you try so far and what's not working?

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader