Well, I've the following scenario to implement: if an user has the "L1" group, he can only see the ticktes which were set with the "WEB" option, on the created_via field. The only condition is this, independent of his/her access type.
I've been thinking of implement it using the data partition constraints, but I just can imagine how to do it, without using the conditions operators, like "IF-ELSE".
Can someone give a light with this?
First of all, If you want to use data partitions constraints, you must apply the DP either in contacts individually or in roles for contacts.
That said, I tested here and it seems DP constraints don't allow IF/ELSE structures.
You can try using a constraint like (¬A OR B) instead of (IF A THEN B), since both are logically equivalent. It should be something like:
User not in 'L1' group or Created_via == 'WEB'
I didn't test this and I don't know if it works. But a problem I see is: how to represent "User not in 'L1' group" in a constraint? The only constraint regarding groups I know is:
(group.group_list.member IN (@root.id))
that means "The group of a ticket contains the current user". Someone has an idea?
I hope this helps you
Hi Vinicius_Paulo, Unfortunately you cannot use "If This, Else That" type operators in data partition constraints in the current function set of the product. What you would have to do is ensure that those users which you want to restrict, all have a common role, and then apply the data partition to that role. However, if the users may be in multiple groups, it becomes a bit more difficult and complex - and if that is the case, I dont think it can be done. You could post an "idea" here on the community as an enhancement request for the product to ask for the ability to use "If This, Then That, Else That" functionality within data partition constraints, which would allow you to accomplish this easily. Unfortunately right now, you can only do one constraint of each type on a given object - for this you would almost need multiples or a single one that has the If this, then that operator in it.
I hope this gives you some insight.
I think this can be implemented, but you will need to use triggers and spel code.
1. You will need to add custom attribute for contact e.g zcreated_via of the same type as created_via in ticket
2. Create trigger on grpmem to fire when contact is aded or removed from group
3. Create spel that will be run by trigger, this spell should check all contacts that is in l1 group and set zcreated_via to web. Spel also should check if there is contacts that contains zcreated_via set to web, but are not group members and remove value.
4. Create dp constrain created_via = @root.zcreated_via
you may also skip steps 2 and 3 and select zcreated_value manualy from interface.
Hi.Ticket Data partition constraints are always related to the ticket . When saying the logged in user is related to the l1 group only but not to the ticket somehow, you can not achieve your goal through data partition.You could of course create a DP saying only WEB created tickets are visible, assign this DP to a role and assign this role to your 1st level analystsWould that help?Regards.....Michael
Following the scenario, this ideia was the most interesting for the user which requested the creation of the constraint.
Thanks for your help, and thanks for all who helped, with great ideas