UI Action to redirect from one table to another

vibee
Kilo Expert

Hi, I would like some assistance in creating a UI Action on a custom table I created.

This button needs to save the form on table 1, and then redirect the user to a second/table form.

How would I script/build this?

1 ACCEPTED SOLUTION

Chuck Tomasi
Tera Patron

Hi Vibee,



Your script will contain two basic components.



current.update(); // save the current record (from table 1)


action.setRedirectURL(url_to_table_2_record);



The details of that url_to_table_2_record are up to you. It can either be a GlideRecord or a string. For example, if you have a GlideRecord for your other table...


var t2 = new GlideRecord('u_table2');


t2.get(current.u_reference_field_to_table2);


action.setRedirectURL(t2);



The above could also be done like this:


action.setRedirectURL('u_table_2.do?sys_id=' + current.u_reference_field_to_table2);



Or if you want to create a new record on table2, it might look like this:


action.setRedirectURL('u_table2.do?sys_id=-1');



That should give you some ideas. 🙂


View solution in original post

10 REPLIES 10

Pradeep Sharma
ServiceNow Employee
ServiceNow Employee

Hi Vibee,



URL will be com.glideapp.servicecatalog_cat_item_guide_view.do?v=1&sysparm_initial=true&sysparm_guide=90d35042ef3111004c7236caa5c0fb0f' //Replace 90d35042ef3111004c7236caa5c0fb0f with the exact sys_id of your order guide you would like to redirect


Hi Chuck, I Have a similar question .

I have created a document Id field on Test Suite table and i want to create a UI action on Catalog Item form that will redirect to the test suite for the item.

 

Chuck Tomasi
Tera Patron

Hi Vibee,



I'm curious, your subject says "UI action to hide fields", but nowhere in the longer description does hiding come up. Was this an oversight in some detail or did you change your mind?


Hi Chuck,



Sorry, I changed my mind. Originally the plan was to use the 3 Step Order Guide to create a New Hire request. The issue was that we had too many questions for the user to fill out. This involved scrolling up and down to fill out variables and my management did not like that. They wanted to simulate a page by page set up without scrolling.



So originally I used UI Policies and variable triggers to hide and make visible variables. But Management did not like that either, said it was too "ugly", they wanted a button instead that simulated going to the "next page" whereas it only hid and made visible variables.



*This is why the title said what it said. We ended up changing our minds and my question but I forgot to change the title.



In the end, we had a discussion with ServiceNow directly and out account exec. and it was suggested to use this workaround which was create a custom table(s) where the user filled out the details needed, have a UI action that saved the data and transferred the user to the "next page" and then transferred them again to the order guide where they could choose the catalog items and "checkout" so that the request & workflows are created.



I also need a way to pull the data from the custom tables and display them on the Checkout page. So a way to pull only the current record data and cascade them onto the Checkout UI page and the Request as well. Request should be straightforward, use a BR to call a glide to the custom table and just pull in the record, but i'm not sure about the checkout UI page scripting.


Hi Chuck, Can you please share your thoughts on this Thread ?



How can you show a UI action button from one table in a form from another table?