trying to achieve this ask in PA.. what are the exact steps to achieve
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-26-2025 10:28 AM
Function to recursively fetch subordinates
function getAllSubordinates(managerId, subordinates)
var gr = new GLideRecord('sys_user');
gr. addQuery ( 'manager'
, managerId);
gr - query);
while (gr.next()) (
var userid = gr. sys_id.tostring();
if (!subordinates.includes(userId)) {
subordinates. push(userId);
getAllSubordinates(userId, subordinates); // Recursively go deeper in hierarchy
// Function to execute within the Scheduled Job
function executeScheduledJob) {
var loggedInUser = gs getUserID(): // Get logged-in user
var subordinates = [3
getAllSubordinates(loggedInUser, subordinates); // Retrieve hierarchical subordinates gs. info( 'Logged-in User (' + loggedInUser + ') has subordinates: ' + subordinates join(',*) gs. info('Length - '+subordinates.length);
// Run the Scheduled Job (for the logged-in user only)
executeScheduledJob;
Need to convert this into PA please can one can help me with steps this
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-26-2025 10:49 PM
What is your business case? Why do you need this data to show in PA? What are you exactly expected to be showing? PA is for reporting over time.
And your scheduled job sounds weird. It is scheduled, but you want it to run as the logged in user. How then are you triggering it on schedule? Why isn't this a script include that is called from something else?
Please mark any helpful or correct solutions as such. That helps others find their solutions.
Mark