Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

Suggestions Around "Days Remaining" – Key Checks for a Robust Implementation

AnjalPDijo
Mega Guru

Hi everyone! 

There was a suggestion in my project to implement a functionality where the "Days Remaining" field should be automatically updated based on the Due Date. While working on it, I realized there are several aspects we need to check to make the implementation truly effective. Here's a breakdown of what I considered:


Client Script

  • A Client Script was used to calculate and update the Days Remaining field as the form is being filled.
  • If a past date is entered in the Due Date, a message is shown:
    “Due date should be a future date.”

Business Rule for Info Message

  • A Business Rule was added to display an Info Message if the Due Date has already passed, helping users stay informed about overdue tasks.

Inline Editing in List View

  • When editing records directly in the list view, the Client Script doesn't run, so Days Remaining doesn't update.
  • To handle this, a separate Business Rule is needed to recalculate the field during updates made via inline editing.

Daily Update of Days Remaining

  • Since the Days Remaining should decrease as time passes, a Scheduled Script Execution was implemented to run daily and update the field across all relevant records.

If you have anything else to add upon or have faced similar scenarios, feel free to share your thoughts! 😊

0 REPLIES 0