- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-06-2017 03:48 AM
Hello guys,
I've a table and form for this table.
I would like to stay on a form (and proceed add new records to current table) right after new record has been added, but I'm redirecting to list of records of this table and I need clicked "New" button again in order to add new record.
Is there a way to prevent redirecting and staying in the same form?
Thanks.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-06-2017 05:09 AM
Hi Ivan,
'Submit' button is the OOB UI Button being used globally. So I won't recommend you to modify the OOB 'Submit' UI Action.
But for your particular table you can achieve this by writing a new Business rule as of below. I have cross checked in my personal instance in the Problem task table. You must select your required table and modify the script accordingly. Please navigate to System definition-->Business rules and click on the 'New' button.
Name: Give appropriate name
Table: Provide the table name
Advance: Checked
When: After
Insert: Checked
Script:
(function executeRule(current, previous /*null when async*/) {
var url = '/problem_task.do?sys_id=-1'; //Change the URL as per your requirement.
gs.setRedirect(url);
})(current, previous);
I hope this helps.Please mark correct/helpful based on impact
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-06-2017 04:03 AM
Hi Ivan,
You can use 'Save' or 'Insert and stay' also. Right click on the form header and you can find them. For more details you can refer section 3 here Configuring Forms - ServiceNow Wiki
I hope this helps.Please mark correct/helpful based on impact
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-06-2017 04:51 AM
@Amlan PalThanks for your input, but I need:
1. click on "Submit" button
2. New record should be added
3. Current form should be cleared in order to add new records to table.
Is there a way to do that by clicking on "Submit" button
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-06-2017 05:09 AM
Hi Ivan,
'Submit' button is the OOB UI Button being used globally. So I won't recommend you to modify the OOB 'Submit' UI Action.
But for your particular table you can achieve this by writing a new Business rule as of below. I have cross checked in my personal instance in the Problem task table. You must select your required table and modify the script accordingly. Please navigate to System definition-->Business rules and click on the 'New' button.
Name: Give appropriate name
Table: Provide the table name
Advance: Checked
When: After
Insert: Checked
Script:
(function executeRule(current, previous /*null when async*/) {
var url = '/problem_task.do?sys_id=-1'; //Change the URL as per your requirement.
gs.setRedirect(url);
})(current, previous);
I hope this helps.Please mark correct/helpful based on impact
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-06-2017 05:32 AM
Thanks a lot!