Skip to content

Comparing 2 records and show differences.#2047

Merged
rohi-v merged 3 commits intoServiceNowDevProgram:mainfrom
Rajasree2004:feature/gliderecord-compare2records
Oct 13, 2025
Merged

Comparing 2 records and show differences.#2047
rohi-v merged 3 commits intoServiceNowDevProgram:mainfrom
Rajasree2004:feature/gliderecord-compare2records

Conversation

@Rajasree2004
Copy link
Contributor

@Rajasree2004 Rajasree2004 commented Oct 12, 2025

PR Description:

This pull request adds a new GlideRecord snippet that compares two records field-by-field to identify differences between them.
The snippet helps developers quickly detect mismatched values across records for debugging, data validation, or record synchronization purposes.

Files Added:
Core ServiceNow APIs/GlideRecord/Compare_2_records/compareRecords.js
Core ServiceNow APIs/GlideRecord/Compare_2_records/README.md

Pull Request Checklist

Overview

  • Put an x inside of the square brackets to check each item.
  • I have read and understood the CONTRIBUTING.md guidelines
  • My pull request has a descriptive title that accurately reflects the changes and the description has been filled in above.
  • 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

@rohi-v rohi-v self-assigned this Oct 12, 2025
@Rajasree2004
Copy link
Contributor Author

Hi @rohi-v, I have made the changes you gave on a new commit

@rohi-v
Copy link
Contributor

rohi-v commented Oct 12, 2025

Thank you for making the changes.

I would suggest you to add one more check here if system fields should be excluded or included during comparison.

compareRecords('incident', 'sys_id_1_here', 'sys_id_2_here',<<systemfields_check>>);

systemfields_check - if true then include that check in your logic, If false then ignore the system fields comparison.

Just a suggestion, let me know your thoughts. @Rajasree2004.

@Rajasree2004
Copy link
Contributor Author

Yeah sure i will make the changes

@Rajasree2004
Copy link
Contributor Author

Hi @rohi-v, I have implemented system field check. Please let me know about any other changes.
Thank you.

@rohi-v
Copy link
Contributor

rohi-v commented Oct 12, 2025

Looks Good, Please Mention in readme file If this works for all scopes or not and change the title.

@Rajasree2004
Copy link
Contributor Author

@rohi-v I have already mentioned the scope in README file.

@rohi-v
Copy link
Contributor

rohi-v commented Oct 12, 2025

@Rajasree2004 Can you please change the title too?

@Rajasree2004
Copy link
Contributor Author

@rohi-v I changed the title previously....if it is not that good can you please suggest one for me

@rohi-v
Copy link
Contributor

rohi-v commented Oct 13, 2025

@Rajasree2004 How about 'Comparing 2 records and identify differences'

@rohi-v rohi-v changed the title Add GlideReport for comparing 2 records Comparing 2 records and show differences. Oct 13, 2025
@rohi-v rohi-v merged commit e026d5b into ServiceNowDevProgram:main Oct 13, 2025
1 check passed
@Rajasree2004
Copy link
Contributor Author

@rohi-v Sorry I wasn't available yesterday.....I will change the title now

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.

2 participants