Create new record with specific view on UI Action?

ericeger
Tera Guru

Hello all,

I have created a new table that is on a related list and when it comes to creating new records on the related list, I woulld like to be able to do it two ways.   One would be for a user to click on 'New' and go to the Default view.   Another would be to click on a UI Action and have it go to the form with another view.   I have tried creating the UI Action with a redirect to the table using 'action.setRedirectURL('table.do?sys_id=-1&sysparm_view=new_view') and it gives me an error of 'No records selected'.  

I've looked on the forums and found suggestions when it came to switching views on already created records, but this would be for going to a brand new record with a forced view.   Is there another way for me to do this? Thanks!

-Eric

10 REPLIES 10

Chuck Tomasi
Tera Patron

That's odd. I just did one like this and it worked fine.


find_real_file.png


Hi Chuck,



One of the differences that I have on mind is that the UI Action is that 'List Banner Button' is checked and not 'Form Link'   The UI Action is on a related list.


I was able to reproduce this from a related list with a List Banner button and List Link UI action.



There's a New button on the global table specifically for related lists. You may be able to adapt it to your needs (or make a copy of it and override.)



Change INSTANCE in the URL below to your instance name and take a look.



https://INSTANCE.service-now.com/nav_to.do?uri=sys_ui_action.do?sys_id=7b37cc370a0a0b34005bd7d7c7255...


I don't know if this would be an issue as well, but the UI Action I have created to force the record to be in a specific view is in a scoped application