The CreatorCon Call for Content is officially open! Get started here.

Self not showing in Direct Reports on User Profile?

rlugo365
Tera Contributor

Kind of an odd one, when you look up your own manager on ESC (User Profile widget), you do not show up as a direct report of that person despite being one.

 

I looked in the widget and it appears that this is by design. I'd like to figure out a way to disable that so that you always show as a direct report.  Here is the relevant code snippet from the server script:

//Calculate team
		if (data.teamData.manager) {
			var teamGR = new GlideRecord("sys_user");
			teamGR.addActiveQuery();
			teamGR.orderBy("name");
			teamGR.addQuery("manager", data.teamData.manager.sys_id);
			teamGR.addQuery("sys_id", "!=", data.sysUserID);
			teamGR.query();
			while(teamGR.next())
				data.teamData.members.push(buildUser(teamGR));
		}

		//Calculate direct reports
		var directReportGR = new GlideRecord("sys_user");
		directReportGR.addActiveQuery();
		directReportGR.orderBy("name");
		directReportGR.addQuery("manager", data.sysUserID);
		directReportGR.query();

		while(directReportGR.next())
			data.teamData.direct_reports.push(buildUser(directReportGR));

 

I would have thought that simply commenting out the line teamGR.addQuery("sys_id", "!=", data.sysUserID); would do the trick but it doesn't, so I may be missing something elsewhere but haven't see any other references.

 

Any ideas?

3 REPLIES 3

RaghavSh
Kilo Patron

@rlugo365 data.sysUserID stores the sys_id of logged in user and the code eamGR.addQuery("sys_id", "!=", data.sysUserID) is written to prevent if the logged in user is manager of himself in user table, i.e. user profile and manager are same.

 

You are probably not seeing your profile under direct reports because your manager might have more than 3 reports and if you click on "my org chart" button, you will probably see your name.

 

Below is Only  for testing:

The another way to see if this is working is either have only 2 reports of your manager or change your name to start with "aa" in user profile.

 


Raghav
MVP 2023
LinkedIn

That doesn't appear to be the case, for instance in our profile we have managers that are listing 5+ direct reports without the need for clicking on my org chart.

Can you check the behaviour in PDI, I am able to see my profile after clicking on org chart and PDI is oob.


Raghav
MVP 2023
LinkedIn