Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

Set form view through UI Action

scottangehr
Giga Guru

Good day team

I have a requirement to set the view of a form through a UI Action to a different table.

We have a UI Action on incident to create a new RITM for an equipment request.

The users have to set certain fields based on this view that was created (Equip_Request)

Is there a line of code to set the view in scripting

ie:  

function createRITM() {               //create the new Requested Item Record

  var newReq = new GlideRecord("sc_req_item");

newReq.setView("Equip_Request");

}

That's not working


Thanks

1 ACCEPTED SOLUTION

The redirect needs to include the view. Yours is simply going to the new request item record. Didn't you say you wanted to redirect to a specific view? That's where you'll have to build the URL including the sysparm_view= part I described above.


View solution in original post

7 REPLIES 7

Have you checked the System Logs for any signs of trouble?


Community Alums
Not applicable

Hi Sangehr,

 

I was following the same article for one of my requirement. Can you please try to set the redirect to:

 

action.setRedirectURL('sc_req_item.do?sys_id=' + newReq.insert + '&sysparm_view=Equip_Request');

 

Let me know if it works..

Community Alums
Not applicable

Hi Sangehr,

I was following the same article for one of my requirement. Can you please try to set the redirect to:

action.setRedirectURL('sc_req_item.do?sys_id=' + newReq.insert + '&sysparm_view=Equip_Request');

 Let me know if it works..