How to set password on sys_user from script in a SCOPED APP?

corbettbrasing1
Mega Guru

I know that when in global you use setDisplayValue() to set the password and that works fine, however in a scoped app setDisplayValue() is not an option.  

How do I do this?   setValue() does not work, nor does gr.password = "blah";//with an gr.update() after it.

1 ACCEPTED SOLUTION

corbettbrasing1
Mega Guru

So the answer I found out is you have to use GlideElement.



Setting display value in scoped apps.



So this works:


var gr = new GlideRecord("sys_user");


gr.get(some_sys_id);


gr.user_password.setDisplayValue("test");//useing glide Element


gr.update();



This does NOT WORK


var gr = new GlideRecord("sys_user");


gr.get(some_sys_id);


gr.setDisplayValue("user_password", "test");//useing glideRecord


gr.update();


View solution in original post

1 REPLY 1

corbettbrasing1
Mega Guru

So the answer I found out is you have to use GlideElement.



Setting display value in scoped apps.



So this works:


var gr = new GlideRecord("sys_user");


gr.get(some_sys_id);


gr.user_password.setDisplayValue("test");//useing glide Element


gr.update();



This does NOT WORK


var gr = new GlideRecord("sys_user");


gr.get(some_sys_id);


gr.setDisplayValue("user_password", "test");//useing glideRecord


gr.update();