- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-15-2024 12:15 AM
Hi Team,
How to restrict a newly created custom view only on existing records not on new Record( form view) on resource form
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-15-2024 07:59 AM - edited 01-15-2024 08:00 AM
Hello @Ramu8 ,
try below code in your view rule script to check if the current record is new or existing based on that you can hide the view.
var uri = gs.action.getGlideURI();
var sysId = uri.get('sys_id');
if(sysId != '-1'){ // if the sys_id is not "-1" then the record is existing record.
answer = 'view_name';
}
Kindly mark the answer ✔️Correct or Helpful ✔️If it addresses your concern.
Regards,
Siddhesh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-15-2024 12:41 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-15-2024 01:06 AM
Hi @Ramu8
What is the use case of same?
If my response proves useful, please indicate its helpfulness by selecting " Accept as Solution" and " Helpful." This action benefits both the community and me.
Regards
Dr. Atul G. - Learn N Grow Together
ServiceNow Techno - Functional Trainer
LinkedIn: https://www.linkedin.com/in/dratulgrover
YouTube: https://www.youtube.com/@LearnNGrowTogetherwithAtulG
Topmate: https://topmate.io/atul_grover_lng [ Connect for 1-1 Session]
****************************************************************************************************************
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-15-2024 03:03 AM - edited 01-15-2024 07:14 AM
Thanks for quick Response @Dr Atul G- LNG
Actually my requirement is based on logged in user group i need to show different from view for table resource_plan
1.for existing records based on group am able to show newly created custom "resource test" form view using view rule below
2.For new record the view should be different not the custom view which we used for existing records on resource plan form view please advice
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-15-2024 06:22 AM
Hi,
you can go through below link:
https://www.servicenow.com/community/developer-forum/view-rule-to-apply-to-new-records-only/m-p/1739...
It will help to solve your query,