Reset A Password OOTB UI Action to open in new window

jlaue
Kilo Sage

Hello -

There is an OOTB UI Action called Reset a Password which is enabled as part of the Password Reset Plugin.   We will be using this so our Agents can easily get to the Help Desk password reset process.   The UI action works great - I copied it and put it on the Incident table so we could use it as a link right on the form.   I slightly modified it so it would pass through the Caller IDs sysID into the URL.    

The only issue is that it opens in the same window and trying to get back from that Password reset screen is less than ideal.   I would like for this to open in a new Window.   I have looked through previous posts about using window.open by using Client script, but it I am struggling getting the code right to actually pass through that sysID for the caller in the URL.  

Here is the UI action where it opens in the same window (using setredirect):

action.setRedirectURL('$pwd_reset_serviceDesk.do?sysparm_user=' + current.caller_id.sys_id);

Could someone please help me out so that I can get this exact same functionality, but have it open in a new window?

Thanks!

1 ACCEPTED SOLUTION

I am not sure, if it will be g_user.caller_id. can you print g_user.caller_id and see what value you are getting. I think it should be g_form.getValue('caller_id')



Please mark this response as correct or helpful if it assisted you with your question.

View solution in original post

7 REPLIES 7

SanjivMeher
Kilo Patron
Kilo Patron

What happens when you add target="_blank" to the end of your link



Please mark this response as correct or helpful if it assisted you with your question.

Chuck Tomasi
Tera Patron

action.setRedirectURL() is to redirect after the UI action is done doing what it needs to. While I don't see a way to target a new window, have you considered using action.setReturnURL() to bring you back where you were?



Reference:


UI actions


Thanks for the quick responses!  



I could not get the _blank to work.  



I added action.setReturnURL(current) in hopes to bring them back to the incident record they clicked the link from, but I have a feeling that since it is taking them to the Password Reset process, it won't be able to trigger that, as the analyst needs to step through the process as attached.   I am able to hit back on the browser 4 times (after the password reset is complete) to get back to the record where the UI action link was clicked from, but looking to avoid that.



Capture.JPG



Thanks!


Hello -



I did try changing this to run on Client side, and I can get the URL to open in a new window, but it is not populating the caller information in the URL, everything else is good.   I imagine I need to declare this, just not sure how?



function pwOpen(){


var url = '$pwd_reset_serviceDesk.do?sysparm_user=' + g_user.caller_id;


g_navigation.open(url,"_blank");


}



This open a new tab and the URL is this:



instanceurl/$pwd_reset_serviceDesk.do?sysparm_user=undefined