Omit new button for problem task related list on problem
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-19-2024 03:01 AM - edited 02-19-2024 04:14 AM
Hi,
Once the problem record is assigned to a problem coordinator, no other users should have access to create a PTASK from problem task related list except Problem Manager.
from problem task list control in omit new condition tab there is a ootb code already am trying to put my conditions as below but its not working
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-19-2024 09:01 AM
Hi @Alekhya12 ,
Please try to use below code :-
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-19-2024 10:43 AM
Answer = false means do not omit/hide the button, so you'll want to reverse your logic, use parent.assigned_to instead of current, and drop the extra =:
if (parent.assigned_to != null && !gs.hasRole('problem_manager'))
answer = true;
else if (new ProblemTaskStateUtilsSNC().canCreateProblemTask(parent))
answer = false;
If it still isn't working, try parent.assigned_to != '' instead of null
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-19-2024 08:03 PM
Hi, Thanks for your response its working as we need but it impacted ootb code. In closed state new button shouldn't come but it is always executing if and showing new button to else if it's not going. please help me on this.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-20-2024 05:12 AM
This will hide the button in the closed state, even for someone with the problem_manager role, and there is the original catch-all to hide the button if neither condition is satisfied.
if ((parent.assigned_to != null && !gs.hasRole('problem_manager')) || parent.state == 107)
answer = true;
else if (new ProblemTaskStateUtilsSNC().canCreateProblemTask(parent))
answer = false;
else
answer = true;