- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-17-2022 07:38 PM
Hi,
I have created a custom table for our Role Base Access. This table contains what access to grant a user based on their job roles. The current project that I am working on involves job changes, where a user joins another position within the company.
The goal is to use the custom table to retrieve what access they were granted based on their previous job role. Then retrieve the access they should be granted for their new role. Now that we have both list, I need do the following:
1. compare both list and find a match based on 2 fields on the table.
2. A list of the items in the previous job role, that didn't match.
3. A list for the items in the new job role, that didn't match.
Does anyone know how I can accomplish this?
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-17-2022 10:01 PM
@Dazler Use below script:
ServiceNow Community Rising Star, Class of 2023
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-17-2022 10:00 PM
Hi @Dazler
Can you please elaborate on the use case, what are the common fields in both of these tables?
Do you want to print the list of fields on each table that didn't match or the values of the fields?
An example of the scenario would help us to help you with the resolution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-18-2022 07:41 AM
I have 1 custom table called Role Base Access and this is what I need to do.
- I query the Role Base Access table to return the records associated with the users previous job role.
- Next, I query the Role Base Access table again to return the records associated with the users new job role.
- Now that I have both list of records, on the Role Base Access table there are two fields:
- (1) A reference field to the CMDB
- (2) A multi-line field
- First, I need to compare both the query records for the previous job role and new job role to find the matches based on the 2 fields from above.
- Next, I need to determine the records from the previous job role that were NOT a match.
- Finally, I need to determine the records from the new job role that were NOT a match.
I would prefer to print out the records sys_id into an array for each of these options.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-19-2022 11:39 AM
Hi, I wanted to follow up to see if you had a chance to look at my need in the reply.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-17-2022 10:01 PM
@Dazler Use below script:
ServiceNow Community Rising Star, Class of 2023