Is there a way to create a view rule that will apply to incident form that will change the view to one that includes the Incident tasks item?

Andrew Dzierla
Kilo Contributor

I'm working on creating Incident tasks that will be automatically added to tickets based on conditions within the incident information. I have the tasks being created successfully, but the default view for the incident form does not include incident tasks. I've created a secondary view ("Tasks Required View") that is basically the same as the default view but with the "Incident Task->Incident" form item added.

Ideally I would like it to only display the Tasks Required View if there are tasks associated to an incident, otherwise it just adds a bunch of empty space in the Default View if there's nothing there.  

So far I've tried creating a View Rule based on the [Incident_Task] with the condition that if there's anything in the Number field it would trigger the view, but that doesn't appear to apply to the Incident form as it doesn't change the view. Problem is that unless I'm missing something I can't find an identifiable field in the [Incident] table to use as the condition if there are tasks associated to the incident.

Here's the example of the [Incident_Task] table rule so you know what tool in the platform I'm trying to use to create this view.

1 ACCEPTED SOLUTION

Hello,

Thanks, the screenshot is what helped provide more information. So the view is important because you're using an embedded list, instead of the normal related list solution. I assume you're going this route to help point this out to the user easier? Otherwise, normally, the instance is set up for simple related lists at the bottom of the page that don't take up prime real estate and widely used elsewhere in the platform.

Regardless of that, if you wish to use the view when the incident has child tasks, then you can review this thread where it includes how to parse the URL, get the parent incident sys_id, then you can query the task table for parent is that sys_id and if the count is greater than 0, answer with your view that has the embedded list, otherwise, answer with the other view.

Example: https://community.servicenow.com/community?id=community_question&sys_id=8f1f7e29db58dbc01dcaf3231f96...

Please mark reply as Helpful/Correct, if applicable. Thanks!


Please consider marking my reply as Helpful and/or Accept Solution, if applicable. Thanks!

View solution in original post

3 REPLIES 3

Allen Andreas
Administrator
Administrator

Hi,

Sorry, your post is a bit confusing. Additionally, the image you have isn't showing.

If you don't mind, can we back up a bit and clarify what you're trying to do?

Are you saying you want to see a related list of incident tasks when looking at an incident form?

Not sure what you mean by the "incident form does not include incident tasks".

Do you mean a field on the form to show related incident tasks?

Please mark reply as Helpful/Correct, if applicable. Thanks!


Please consider marking my reply as Helpful and/or Accept Solution, if applicable. Thanks!

Let me see if I can explain this a little bit better. Maybe I'm getting some of my verbiage mixed up. I'll start with some background information so possibly it'll clear up the actual question more.

Background information:

I'm working on creating workflow automation that depending upon certain triggers will create incident tasks that need to be completed before the parent ticket can be closed. These tasks automatically get generated by service now with a TASK prefix, example being TASK0020144, and are associated to the incident parent incident. These parent incidents are generated with the prefix INC, example INC0193776.  

 

 

I can create a view that includes the Incident tasks to be completed, but if there are no tasks associated with the Incident then there is just wasted space on the Incident Form view. I'd like to be able to create a view rule that can be applied to only use the "Tasks Required View" if there are incident tasks associated to the parent incident. The problem I am having is that the [Incident Tasks] table are a separate child table from the [Incidents] table and I'm not seeing a way to reference that specific kind of child record when creating the condition to determine if there are child tasks. 

Test view that shows the Incident tasks that need to be completed (note: there are elements after this in the view):
find_real_file.png

 

I'd like to be able to create a view rule that will automatically only show this view if there are the Incident tasks and if there are not to use the current default view that does not include this form element. 

 

Make more sense?

Hello,

Thanks, the screenshot is what helped provide more information. So the view is important because you're using an embedded list, instead of the normal related list solution. I assume you're going this route to help point this out to the user easier? Otherwise, normally, the instance is set up for simple related lists at the bottom of the page that don't take up prime real estate and widely used elsewhere in the platform.

Regardless of that, if you wish to use the view when the incident has child tasks, then you can review this thread where it includes how to parse the URL, get the parent incident sys_id, then you can query the task table for parent is that sys_id and if the count is greater than 0, answer with your view that has the embedded list, otherwise, answer with the other view.

Example: https://community.servicenow.com/community?id=community_question&sys_id=8f1f7e29db58dbc01dcaf3231f96...

Please mark reply as Helpful/Correct, if applicable. Thanks!


Please consider marking my reply as Helpful and/or Accept Solution, if applicable. Thanks!