Submit button on change form

raj159
Mega Expert

Hi ,

I have a requirement to return to 'my open changes' list when we click on submit button on the change form.

'My Open Changes' is our custom module where we have applied filer to show all the open changes which are created by the logged in user.

Currently it is redirecting to the 'create new' page.

Please suggest me how to achieve this.

Thanks!

Regards,

Raj

1 ACCEPTED SOLUTION

Chuck Tomasi
Tera Patron

You can create a new UI action specific to your change request table. The definition look something like this. The secret is to use the same action name to override the global UI action. The part YOU need to provide is the URL back to that list you want to display. Put that in the last line.



Name: Submit


Action name: sysverb_insert


Table: Change Request [change_request]


Show insert: true


Show Update: false


Form button: true



Condition: current.canCreate()


Script:


answer = current.insert();


gs.include('ActionUtils');


var au = new ActionUtils();


au.postInsert(current);


action.setRedirectURL('/task.do?sysparm_view=my_work'); // REPLACE WITH YOUR URL


View solution in original post

4 REPLIES 4

Chuck Tomasi
Tera Patron

You can create a new UI action specific to your change request table. The definition look something like this. The secret is to use the same action name to override the global UI action. The part YOU need to provide is the URL back to that list you want to display. Put that in the last line.



Name: Submit


Action name: sysverb_insert


Table: Change Request [change_request]


Show insert: true


Show Update: false


Form button: true



Condition: current.canCreate()


Script:


answer = current.insert();


gs.include('ActionUtils');


var au = new ActionUtils();


au.postInsert(current);


action.setRedirectURL('/task.do?sysparm_view=my_work'); // REPLACE WITH YOUR URL


Hi Chuck,



Thanks for your inputs. Here I have a new module created which it returns only the records which are raised by the logged in user.



Can you please tell me what needs to be given in the URL?



Regards,


Raj


Hi Raj,



My recommendation is to use the existing list, or configure a new list using the list filter to get just the records you want. Using the Copy URL feature in the breadcrumbs, paste it here and we can tell you what you need to put in that last line of the UI action.



It is likely going to be something like:



action.setRedirectURL('/task.do?sysparm_query=active=true^assigned_to=javascript:gs.getUserID()');


Pradeep Sharma
ServiceNow Employee
ServiceNow Employee

Hi Raj,



To add, refer section 5 here for more info.


UI Actions - ServiceNow Wiki



Please let us know if you have any questions.