- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-17-2023 10:48 PM
We have an option of "insert and stay" in the form context menu, which creates a same record as current record.
I want to stop this feature on Hardware table (alm_hardware) .
When we click on the "insert and stay" on the hardware form, it creates a duplicate record in the hardware table with same asset_tag and serial_number, which is something we don't want. How can I restrict the "insert and stay" feature on Hardware Table. (alm_hardware).
I have written a BR on Hardware table (alm_hardware) to avoid entries with duplicate asset_tag and serial_number and it working on manual creation of assets in the table, but not with "insert and stay" option.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-19-2023 06:57 AM
I achieved this by adding simple condition in "insert and stay" UI's condition.
1) open the "insert and stay" UI action.
2) add this to the condition: (current.getTableName() != 'alm_hardware')
What this does is it hides the insert and stay option from the context menu when we are in "alm_hardware" tables form view.
We can easily achieve this requirement for any other table also by adding the table name in place of "alm_hardware". ie.. (current.getTableName() != '<any_table_name>').
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-17-2023 11:12 PM
You need to create a UI action with the same 'action name' as global Insert and stay button but give different condition so it doesn't show on alm_hardware table
Example: add to the conditions field current.getTableName() !='alm_hardware'
This creates a UI action override and will no more show Insert and stay button in hardware table
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-19-2023 06:57 AM
I achieved this by adding simple condition in "insert and stay" UI's condition.
1) open the "insert and stay" UI action.
2) add this to the condition: (current.getTableName() != 'alm_hardware')
What this does is it hides the insert and stay option from the context menu when we are in "alm_hardware" tables form view.
We can easily achieve this requirement for any other table also by adding the table name in place of "alm_hardware". ie.. (current.getTableName() != '<any_table_name>').
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-19-2023 07:11 AM
For future readers of the thread -
Modifying the existing OOB insert and stay button is not a good practice as you will stop receiving updates from ServiceNow for that UI action during upgrades
The better way of doing it is by creating a UI action with the same 'action name' as global Insert and stay button but give different condition so it doesn't show on alm_hardware table.
Example: add to the conditions field current.getTableName() !='alm_hardware'
This creates a UI action override and will no more show Insert and stay button in hardware table
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-19-2023 09:47 AM