Create a Report in SAP Hybris to Fetch Employees based on a User Group - sap-commerce-cloud

I need help for creating a report in SAP Hybris which essentially would be used for fetching out the names of "Employees" not "Customers" based on the "User Group" they're assigned. For example : X employee has usergroup : "admingroup". Like that I would need all the Employees with the respective usergroups. Could anyone please help me with a flexisearch query for the same to start with ? I would really appreciate that ! Thank you
I am still new to SAP Hybris and I have seen a lot of other reports but wanted to try this out.

You can use the string_agg()-method to list up the user groups, it's mentioned here: How to concatenate multiple rows in flexibleSearch query in Hybris
If the method doesn't work you can try to replace it with group_concat.
You also need to join the Employee with the PrincipalGroup. You can access the employee's user groups with the attribute groups:
SELECT
{e:displayName},
string_agg({g:locName}, ', ') AS groupNames
FROM {Employee AS e}
JOIN {Employee.groups AS g} ON {g:pk} = {e:pk}
GROUP BY {e:pk}, {e:displayName}

for this report it require join with PrincipalGroupRelation as there is no direct relation with usergroup and employee.
select {user_group:uid},{user_group:locname[en]},{emp.uid},{emp.name} from {Employee as emp JOIN PrincipalGroupRelation as group_rel ON
{group_rel:source}={emp:pk} JOIN UserGroup as user_group ON {user_group:pk}={group_rel:target} } where {user_group.uid}='customersupportagentgroup'

Related

In Acumatica, using #me inside Relations Section of Generic Inquiry

We want to have a sales order dashboard where we only show orders for certain sales people based on the logged in user. For example, we have sales people BB and CR who share an assistant TP. BB can see his orders on the dashboard. CR can see his orders on the dashboard. TP can see orders for both of them on his dashboard. We also have people outside of sales who need to see all orders. We want to do all of this without having to create a bunch of custom dashboards. We wanted to maintain 2 dashboards - one filtered one for sales people and one unfiltered one for everyone else.
We have gotten close to solution by using a generic inquiry. We created custom fields on the salesperson that point back to a logged in user (UserID1 and UserID2). Multiple custom fields were used because a single sales person could be visible to 2 people. We then joined SOOrder to SalesPerson inside our GI. We then wanted to join the Users table on (SalesPerson.UserID1 = Users.PKID AND SalesPerson.UserID1 = #me) OR (SalesPerson.UserID2 = Users.PKID AND SalesPerson.UserID2 = #me). That would allow us to create a filter where Users.PKID is not null to limit the view for sales people and then not use any filter on the non-sales dashboard.
The problem is that #me is not available on the Relations section. It is only available on the conditions section. We tried to just have the join of SalesPerson.UserID1 = Users.PKID or SalesPerson.UserID2 = Users.PKID and then creating the condition for the #me portion. The issue there is that it only shows records with a match. That won't work for non-sales people.
Is there some way to include #me or an equivalent on the relations tab? Any better way to accomplish this?
Built-in variables like '#me' aren't well documented which raises questions about support of this feature.
Try this instead:
In generic inquiry TABLES tab, add table 'PX.Data.AccessInfo'.
In PARAMETERS tab, add a new parameter (ex: 'P1') and set the Schema Field value to 'Accessinfo.UserID' (use 'Accessinfo' or the alias for that table declared in TABLES tab).
In the RELATIONS tab in the join condition Child Field you can reference the '[P1]' variable.
Accessinfo DAC contains current record of the logged in user and reflects the information you see when you click your profile in the top right of Acumatica pages. If the solution doesn't work right away you can debug it with the Request Profiler page to look up the generated SQL query for the GI.

Netsuite saved search for all contacts (Prospects, Customers) and leads

I have customers and prospects as companies and a lead can be individual or company. I need to create a saved search that returns all of the contacts of prospects, contacts of customers and all of the leads in one list. I can do a contact search where status = all available statuses and I get the primary contact of customers, primary contact of prospects and all leads (individual or company) If I add contact.name to the results tab, I get all contacts of prospects and customers but I lose all of the individual leads. I'm attaching image of the criteria and results field. This setup returns the primary contacts and all leads but I need all contacts. My goal is to get a list of every contact or lead in NetSuite to send to external system.
Do a Customer search with the following criteria:
USE EXPRESSIONS = YES
Contact : Internal ID is not none Or
Is Individual is true
In your results you can use a Formula(Text) to get the proper name and/or email:
decode({isperson},'Yes',{altname},{contact.entityid})
Finally heard back from support. It turns out you can tell NetSuite to treat individuals like contacts:
When you navigate to Setup > Company > General Preferences, you have there an option to SHOW INDIVIDUALS AS CONTACTS. When this feature is enabled, individual type customer records will now show in list of Contacts
You will need two separate searches to accomplish this. One for the Leads and one for the Contacts as these are two separate Tables in NetSuite.

showing as sublist of muliselect customers contacts on customer record

I have Multi select field(sourced with customers) on customer record, i have to show the contacts of the selected customers on multi select field as a sublist, please help me
First create the Multi-select Customer List..[ i think you did that as far as my understanding from you question]..
Second you have to trigger the Field Change Client Script on "Customer" multiselect field which will run the Search on Contacts...
In criteria search for company with customer's IDs you'll get the Search Sublist of Contacts...just show it UP...

Infopath - Create a drop-down List from Active Directory "Department" field

Is it possible to create a Drop-down list in InfoPath which connects to Active Directory and fills the list with UNIQUE Department Values only (no repeating ones)
I need this for an InfoPath so when a user entering the data can pick one of the departments listed in the drop-down. Any help would be appreciated.
I've had a look at the people picker control, which works great for User names, but the department field is a separate field and has nothing to do with the user I pick, so I simply need a control which is populated by the unique Department codes in AD.
Any help would be appreciated.
You should really contact your administrator for this sort of information. You do not want a form to query every AD user to pull their department and get the unique values just to populate a drop down list. It is very possible to obtain the list of unique directories, however you should work with your administrator to populate this data to an XML web page or other similar solution and then connect your form to THAT data source through the form. The point is you are missing a step of obtaining the queried data.
With that said you can obtain the department of the user by querying the get user profile service to obtain the department name, elinating the need to even create a populated drop down list. See this article.

LDAP Query for all owners of group

Problem
I need to write an LDAP query that given a distinguishedName for a group will return a list of all users who are owners/managers of the group
Motivation
I am writing a VBA script that will allow an excel user to input a DisplayName for a group in a cell and press a button to receive (1) a list of members and (2) a separate list of group owners.
Progress
The first part works fine. I search the directory for all users who have the group in their memberof field.
For the owners, I successfully pulled the group's managedBy field, but it only contained information for a single user. This is the same user that appears in the "Owner" field when the group is viewed in Outlook's address book. There are many more users with ownership permissions for the list.
Examples
Here are the two (slightly modified) queries I'm using now:
Query 1: Group Members (works)
<LDAP://dc=DOMAIN,dc=com>;(&(memberof=CN=GroupName));DisplayName;Subtree
Query 2: Group Owners (single user returned)
<LDAP://dc=DOMAIN,dc=com>;(&(objectCategory=group)(DisplayName="Group Name"));managedBy;Subtree
The Question
How can I modify Query 2 to return all users with management permissions for the group?
Related Questions

Resources