- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-05-2022 09:51 AM
We would like to use the following conditions that would allow a Catalog Task to be created by clicking the NEW button on the RITM related Catalog Task list
- The User has the ITIL role
- The RITM was created after a certain date
We are considering a couple of options and would like to know if either option will work and how to apply one or the other.
- Option 1.
Show the NEW button always for ITIL Users
On button click, if the RITM created date is before a certain date, pop an alert with a message that the Catalog Task cannot be created because of the RITM date. Prevent Catalog Task from being created. - Option 2.
Hide the NEW button unless the RITM was created after a certain date.
Show the button for ITIL users to create an "Ad-Hoc" Catalog Task, but only if the RITM was created after a certain date.
The reason we need Option 1 or 2:
We are going to add a "Wait for Condition" Activity to every Catalog Item workflow. That condition will check for active Catalog Tasks and not move to the next activty to Close the RITM if active tasks are found. The problem is that the workflow cannot be applied retroactively to previously created RITM's, so we only want the NEW button to allow creation of a Catalog Task if the RITM is recently created and has the new workflow with the "Wait for Condition" activity.
If we allow the NEW button to create a Catalog Task without the conditions, then we run the risk of having active (Ad-Hoc) Catalog Tasks related to RITM's that are closed. The RITM will get closed becuase the old workflow already attached to the RITM doesn't have the "Wait for Condition" to check for active (Ad-Hoc) Catalog Tasks.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-05-2022 12:32 PM
Hi Mike,
You can hide the New button on the related list by supplying an Omit new condition. To do this right-click on the related list column headers and select Configure -> List Control. If this form does not display the Omit new condition field, add it by right-clicking the gray header area and selecting Configure > Form Layout. The Omit new condition field is looking for a variable named answer to be true (button will be hidden) or false (button will be shown). It sounds like a script similar to this will accomplish what you are looking for:
var dt = new GlideDateTime('2022-01-01 00:00:00');
if (gs.hasRole('itil') && parent.sys_created_on >= dt) {
answer = false;
} else {
answer = true;
}
note that this will also work for users with the admin role as gs.hasRole always returns true for users with the admin role.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-05-2022 12:32 PM
Hi Mike,
You can hide the New button on the related list by supplying an Omit new condition. To do this right-click on the related list column headers and select Configure -> List Control. If this form does not display the Omit new condition field, add it by right-clicking the gray header area and selecting Configure > Form Layout. The Omit new condition field is looking for a variable named answer to be true (button will be hidden) or false (button will be shown). It sounds like a script similar to this will accomplish what you are looking for:
var dt = new GlideDateTime('2022-01-01 00:00:00');
if (gs.hasRole('itil') && parent.sys_created_on >= dt) {
answer = false;
} else {
answer = true;
}
note that this will also work for users with the admin role as gs.hasRole always returns true for users with the admin role.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-06-2022 07:57 AM
Thank you Brad, it works great. I found that I did have to add the ITIL role to the sc_task.Create ACL in order for it to work. After adding the ITIL role to the ACL it works perfectly!