Skip to content

Conversation

@AnandMahajan2799
Copy link
Contributor

PR Description:

Created business rules to set due dates on Requested Items (RITMs) and Requests based on the delivery time defined in catalog items.

Key Changes (Business Rules):
Set Due Date on RITM : A Before Business Rule on the sc_req_item table calculates and sets the due date by adding the catalog item's delivery time to the current date.
Set Due Date on Request : A Before Business Rule on the sc_request table sets the due date as the latest due date among all associated RITMs.

Note: Keeping both files in same sub-folder as these are related with each other.

Pull Request Checklist

Overview

  • I have read and understood the CONTRIBUTING.md guidelines
  • My pull request has a descriptive title that accurately reflects the changes
  • I've included only files relevant to the changes described in the PR title and description
  • I've created a new branch in my forked repository for this contribution

Code Quality

  • My code is relevant to ServiceNow developers
  • My code snippets expand meaningfully on official ServiceNow documentation (if applicable)
  • I've disclosed use of ES2021 features (if applicable)
  • I've tested my code snippets in a ServiceNow environment (where possible)

Repository Structure Compliance

  • I've placed my code snippet(s) in one of the required top-level categories:
    • Core ServiceNow APIs/
    • Server-Side Components/
    • Client-Side Components/
    • Modern Development/
    • Integration/
    • Specialized Areas/
  • I've used appropriate sub-categories within the top-level categories
  • Each code snippet has its own folder with a descriptive name

Documentation

  • I've included a README.md file for each code snippet
  • The README.md includes:
    • Description of the code snippet functionality
    • Usage instructions or examples
    • Any prerequisites or dependencies
    • (Optional) Screenshots or diagrams if helpful

Restrictions

  • My PR does not include XML exports of ServiceNow records
  • My PR does not contain sensitive information (passwords, API keys, tokens)
  • My PR does not include changes that fall outside the described scope

Sets the "due_date" for a Request Item (RITM) based on delivery time set on catalog item record.

Follows the below step to calculate and set value:
1) Reading the delivery time (in days) from the associated Catalog Item
2) Parsing the days component from the display value (e.g. "5 Days" - 5).
3) Adding those days to the record's creation date ("sys_created_on").
4) Writing the calculated date to "due_date".
Sets the "due_date" on a Request with associated RITM with the highest "due_date".

Follows the below steps to calculate and set the field:
1) Finding the associated RITM with the highest "due_date".
2) Assigning the Request's "due_date" to match that RITM's "due_date".
CreateD README file
@rohi-v rohi-v self-assigned this Oct 7, 2025
@WillemZeiler WillemZeiler assigned WillemZeiler and unassigned rohi-v Oct 7, 2025
Copy link
Contributor

@WillemZeiler WillemZeiler left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for your submission. Your code is in conflict with OOTB SLA functionality and will therefore not be merged. If you feel your script handles a specific case that cannot be handled with OOTB SLA's feel free to update the Readme and submit the PR.


**Benefits:**
- Ensures accurate due dates for both RITMs and Requests.
- Improves SLA tracking and reporting.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A BR calculating due date is actually not enhancing SLA tracking. As you are not using SLA's in your code, it has a risk of even conflicting with OOTB SLA functionality

* When: before insert
*
* @description
* Sets the "due_date" for a Request Item (RITM) by:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The described process is already available with OOTB SLA's.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants