How to get data inside object in a array ?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-06-2023 05:55 AM
Hi Everyone,
I need to get data inside object as an array for certain requirement.
Accountable Onwer | Accountable Remediation owner | new ARO | mail recipients (AO + new ARO) | mail body | |
Adam | matt | satya | Adam,satya,venu,gopal | matt,thompson,aaron | |
Adam | thompson | venu | |||
Adam | aaron | gopal | |||
Smith | dev | harsh | Smith,harsh,gupta | dev,gill | |
Smith | gill | gupta |
where Key is Accountable onwer.
@Ankur Bawiskar
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-06-2023 06:22 AM
sorry didn't get your requirement
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-06-2023 06:33 AM - edited 06-06-2023 06:34 AM
@Ankur Bawiskar ,
My requirement is when ever user is ARO field is inactive need to place user's manager (new ARO) need to trigger email based accountable owner in same record. for example, Aaron is user he placed in ARO field on 10 records, for those 10 records accountable owner's will be different, now to need to trigger based on accountable owner and recipients will be new ARO user. In email body will be inactive user.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-06-2023 08:37 AM
Hi @venugopal s ,
I trust you are doing great.
Here's an example of how you can achieve this in ServiceNow using a Business Rule:
// Business Rule: ARO Inactive Email Notification
// Table: Your_Table_Name
(function executeRule(current, previous) {
// Check if the ARO field has been marked as inactive
if (current.aro.active === false) {
// Get the accountable owner and new ARO values
var accountableOwner = current.accountable_owner;
var newARO = current.new_aro;
// Get the email recipients
var recipients = accountableOwner + "," + newARO;
// Get the inactive user's name
var inactiveUser = current.aro.name;
// Compose the email body
var mailBody = "Inactive user: " + inactiveUser;
// Send the email
gs.eventQueue("email.send", current, recipients, "ARO Inactive Notification", mailBody);
}
})(current, previous);
Was this answer helpful?
Please consider marking it correct or helpful.
Your feedback helps us improve!
Thank you!
Regards,
Amit Gujrathi
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-06-2023 08:56 AM - edited 06-06-2023 09:04 AM
Hi @Amit Gujarathi ,
created a scheduled job as per requirements, but problem is not able to group accountable owners recipients as per table mentioned above.
Scheduled job: