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.

This approach is helpful when catalog items are using generic flows and the catalog items have different delivery time. As there is no option to dynamically set the delivery time using the flow designer, the solution helps to set the due date based on catalog item delivery time.

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
Removed benefits related to SLA which was creating confusion
@WillemZeiler WillemZeiler self-assigned this Oct 7, 2025
@WillemZeiler
Copy link
Contributor

Thank you for the adjustments @AnandMahajan2799 I will mark it to account for Hacktoberfest. The script itself will not be merged, but will counts towards Hacktoberfest. Thank you for your participation and good luck on other submissions!
[If applicable: Be careful on the over use of AI. We want participants to focus on quality and while using AI is allowed, we urge participants to reflect and synthesize on it's output]

@WillemZeiler WillemZeiler added the hacktoberfest-accepted The PR is accepted for Hacktoberfest, regardless of being merged or not label Oct 7, 2025
@AnandMahajan2799
Copy link
Contributor Author

Thanks @WillemZeiler for acknowledgement.
I use AI to rephrase my statements and add better comments to my code.

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

Labels

hacktoberfest-accepted The PR is accepted for Hacktoberfest, regardless of being merged or not

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants