How to add a user to a discount group in Hybris - sap-commerce-cloud

I am creating a discount group for employee of the store.
I could create the discount row and assign it to a user, but I can't assign the employee discount group to a specific user.
What I need to proper assign the discount group to a customer.
These are the lines from my impex files.
essential-data.impex
INSERT_UPDATE Discount;code[unique=true];value;currency(isocode)
;employee-discount;15
INSERT_UPDATE UserDiscountGroup;code[unique=true]
;employees
catalog.impex
INSERT_UPDATE DiscountRow;$catalogVersion;discount(code)[unique=true];pg(code)[unique=true];ug(code)[unique=true];value
; ;employee-discount ; ;employees ;15

I was missing one command to make a relation between Usergroups and DiscountGroup.
Also my error was to refer directly, inside discount row, a user group instead of a discount group.
The user group employees is already define in user-groups.impex
essential-data.impex
INSERT_UPDATE Discount;code[unique=true];value;currency(isocode)
;employee-discount;15
INSERT_UPDATE UserDiscountGroup;code[unique=true]
;employee-discount-group
UPDATE Usergroup;uid[unique=true];userDiscountGroup(code)
;employees;employee-discount-group
catalog.impex
INSERT_UPDATE DiscountRow;$catalogVersion;discount(code)[unique=true];ug(code)[unique=true] ;value
; ;employee-discount ;employee-discount-group;15

Related

How can I assign multiple "departments" to a single user in Azure that can be dynamically assigned in different M365 groups?

Details of the Issue:
As far as I know, dynamic membership rules can be assigned based off of properties that pertain to a single user. That is, department, object ID, job title, etc.
The limitation is that there can only be one assigned department, one assigned object ID, one assigned job title, etc. for a single user.
How can I assign multiple "departments" to a single user in Azure that can be dynamically assigned in different M365 groups? For example:
User 1 belongs to Department A and Department B
User 2 belongs to Department A and Department C
If Group A only allows users from Department A Then:
User 1 and User 2 is assigned
If Group B only allows users from Department C Then:
User 2 is assigned
The issue is that I cannot seem to find a way to assign multiple departments to a single user that can later be used to dynamically assign users to M365 groups.
You can assign a single department to a single user, thus setting a dynamic membership rule to add all users from that specific department to the M365 group, however this only works if you're okay with a user belonging to a single department.
What I Tried:
My users may belong to multiple departments, so to remedy this issue, I decided to use Azure's Assigned Roles as "departments". That is, I create a custom assigned role for each department allowing each user to be assigned multiple roles (i.e., departments.)
Why It Didn't Work:
However, when setting up the dynamic membership rule, to assign users to a M365 group, I am not able to find a user property that corresponds to their assigned role(s).
Is this a valid approach? Or is there an alternative that I'm missing?
Update:
This relation question runs into the same issue, however the given answer does not address my issue.
This could entirely be a limitation on Azure's side and my goal may not be achievable through AAD.
Answering my own question with a potential, and simple, alternative to this issue:
Listing out all of the departments in any of the user's property fields and using the following dynamic membership rule to find it:
user.department -contains "Department A"
Example:
User 1 belongs to Department A and Department B.
So, Set Department to:
"Department A, Department B"
Group looks for users from Department B.
So, Set M365 Dynamic Rule Membership to:
user.department -contains "Department B"
Azure has a 64 property-character-limit, so contracting your department names to unique ID's, such as:
Department A: DA-001
Department B: DB-001
Works, too.
User 1 belongs to Department A and Department B.
So, Set Department to: "[DA-001],[DB-001]"
user.department -contains "DB-001"

Create a Report in SAP Hybris to Fetch Employees based on a User Group

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'

Is there a way to connect a contact's category to their roles?

I am setting up a company for lead nurturing and marketing automation and I'm in the process of scrubbing up all of the contacts, customers, and leads. The way that we are using NetSuite right now, we don't have any need for a separate contact category and role.
So I want to set up a script to connect the category and role fields, or have the role field always copy what's in the category field.
Is there any way to achieve this?
The "Contact Category" and "Contact Role" fields in NetSuite are two different CRM list fields. Which means that:
In order to create a new "Contact Category", navigate to: Setup -->
Sales --> CRM Lists --> New --> Contact Category
And In order to create a new "Contact Role", navigate to: Setup -->
Sales --> CRM Lists --> New --> Contact Role
And because they are two different list fields, you need to have a 1 to 1 link of both these list values before populating it in your entity record.
One efficient way to do it would be by using a custom record as a reference. Please follow the below procedure to achieve the same:
Create a "Custom Record" titled "Contact Category & Roles" [or any appropriate name] with two fields in it: Contact Category (list/record of contact category) and Contact Role (list/record of contact role)
Now create each of these "Contact Category & Roles" custom record. For every record, select the Contact Category and the corresponding Contact Role.
Hence, in this way you will now have a list of this custom record that gives the Contact Category and its corresponding Contact Role.
This custom record can now be used as a reference in scripts.
For new records that are created, have a client script deployed. And in the "fieldChanged()" event of the script, write the logic to populate the role field based on what the category field is selected. [So here, when the category field is selected, reference the custom record and see if the category field has a corresponding role value and set it accordingly]
And since you are doing a scrub of already existing records, you can achieve the same by writing the above logic (point 5) in a schedule or map/reduce script (i.e by loading each record, getting the category value, referencing the custom record and getting the corresponding role and setting the role value).
Additional Note: If the Category values need to be cleaned up, a csv import could be done to achieve the same. You can then run the schedule script to set the role values.

Discount for group of users in Kentico?

am new in Kentico and am working on project that will be like E-book store want to ask if there is any way to make Group of users and assign discount for them like 10% on all purchase or something i notice that i can assign discount on product level as Kentico Discount Doc but this is not my desire .. i just want to create group of users and assign them all discount i think in making it as a role but i don't think it will work like that .. any one has idea?
Yes, you can create an order discount and specify for which user role the discount will be available. https://docs.kentico.com/display/K8/Working+with+order+discounts#Workingwithorderdiscounts-Addingorderdiscountstargetedonselectedcustomers
Also you can use macro rules for configuration https://docs.kentico.com/display/K81/Configuring+discount+rules
Or you can create a custom ShoppingCartInfoProvider and check a user role, if it's correct, you will add discount to an order.

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