How to manually add a condition to condition builder?

JordyZ
Mega Sage

Hi,

 

I'm configuring an indicator source with table task_sla. The condition, "Task. Closed on Today" is already present in the condition builder. I'd also like to add a condition that shows tasks resolved today (Task. Resolved on Today), but it's not an option.

 

JordyZ_0-1709919554897.png

How do I add this?

 

Thanks in advance!

 

1 ACCEPTED SOLUTION

AndersBGS
Tera Patron
Tera Patron

Hi @JordyZ ,

 

The resolved on today is not on the task table, but instead e.g. on the incident table. You therefor need to dot-walk to the correct table to get the "resolved on today". See example below:

AndersBGS_0-1709968659882.png

If my answer has helped with your question, please mark my answer as accepted solution and give a thumb up.

 

Best regards

Anders

 

If my answer has helped with your question, please mark my answer as the accepted solution and give a thumbs up.

Best regards
Anders

Rising star 2024
MVP 2025
linkedIn: https://www.linkedin.com/in/andersskovbjerg/

View solution in original post

5 REPLIES 5

Aravind2799
Giga Expert

Hi, 

Based on the information you've provided and the description in the image, the "Task. Resolved on Today" condition isn't a pre-built option in the condition builder for indicator sources using the task_sla table. However, you can achieve the desired functionality using a custom script within the condition builder.

Here's how to create a condition to show tasks resolved today:

  1. Access the Condition Builder: In your indicator source configuration, navigate to the condition builder where you're defining conditions for the tasks.
  2. Add Script Condition: Click the "+" button and select "Script" from the available condition types.
  3. Write the Script: Within the script editor, enter the following code:

 

current.closed_at.getDisplayValue() === gs.TODAY()

 

Explanation of the Script:

  • current.closed_at refers to the "Closed At" field of the task record.
  • getDisplayValue() method retrieves the human-readable date format of the "Closed At" field.
  • gs.TODAY() is a ServiceNow function that returns the current date in YYYY-MM-DD format.
  • The comparison (===) checks if the displayed value of the "Closed At" field matches the current date.
  1. Save and Test: Save the condition and test your indicator source to ensure it correctly identifies tasks resolved today.

Thanks

Aravind Panchanathan 

Hi @Aravind2799 ,

 

I cannot find the + button to add script condition, where is it?

 

Thanks.

Hey @JordyZ  - The location of the "+" button to add a script condition in ServiceNow might vary slightly depending on the specific version you're using. Here are two common scenarios to help you find it:

Scenario 1: Classic UI

  1. In your indicator source configuration, navigate to the section where you define conditions for tasks (often labeled "Conditions" or "Condition Builder").
  2. Look for a section with existing pre-built conditions. This section might display a list of available conditions or a visual builder with connected elements.
  3. Within this section, locate a button bar or toolbar. You should see buttons for adding and manipulating conditions.
  4. The "+" button you're looking for could be a simple plus sign (+), a button labeled "Add", or a button with an icon representing adding elements.

Scenario 2: ServiceNow Now Platform UI

  1. Access your indicator source configuration in the Now Platform UI.
  2. Locate the section for defining conditions, which might be labeled "Conditions" or "Condition Builder.
  3. This section usually displays a panel or a builder interface where you can visually construct conditions.
  4. Look for options to add new conditions. This could be a dedicated button labeled "Add Condition", a dropdown menu with options like "Add Condition", or a plus sign (+) within the builder itself.

Tips:

  • If you're unsure about the exact location, try hovering your mouse over buttons in the condition builder section. Tooltips might appear indicating the button's function.
  • Consult your ServiceNow documentation or search online for specific guidance on the UI for your version.
  • If you still have trouble finding the script condition option, consider contacting your ServiceNow administrator for assistance.

AndersBGS
Tera Patron
Tera Patron

Hi @JordyZ ,

 

The resolved on today is not on the task table, but instead e.g. on the incident table. You therefor need to dot-walk to the correct table to get the "resolved on today". See example below:

AndersBGS_0-1709968659882.png

If my answer has helped with your question, please mark my answer as accepted solution and give a thumb up.

 

Best regards

Anders

 

If my answer has helped with your question, please mark my answer as the accepted solution and give a thumbs up.

Best regards
Anders

Rising star 2024
MVP 2025
linkedIn: https://www.linkedin.com/in/andersskovbjerg/