We are on TC 10.1.4.2
I have two custom relations Rel1 and Rel2 between same primary and secondary object types with GRM rule set to 1 to many for both relations, which works fine.
But I have additional requirement - disallow having both relations Rel1 and Rel2 with same primary and secondary objects i.e. at give point of time only one relation can exist between same primary and secondary.
P1 related to S1,S2, S3 with relation Rel1 so now P1 cant have relation Rel2 with S1, S2 and S3; vice versa.
I tried to add a multifield key on relation - Primary object + Secondary object assuming it would be applied across all relations for given primary and secondary as i have not added object_type. But when i deploy this key, teamcenter by defaults adds object_type to key making it unique only for given relation. Not sure i am doing anything wrong here ?
Is there any way i can achieve this through configuration ?
Thank you in advance.
What about using the precondition extention on GRM_create(I think) for each relation.
GRM_create for Rel1 would have a precondition extension saying that if rel2 already exist on object then return false and vice versa.
Note : I have not tried this myself..
How about creating Rel1 and Rel2 as a subtype of another RelType, lets say ParentRelType and define the MFK on the ParentRelType?
Caution - What you are trying to achive is sort of a complex requirement... Typical MFK use is at the Item level, though nothing prevents you from using at other object level..
Thank you for the input.
I did thought of this approach but i suspected if MFK adds object_type on relation by default then even parent relation will have object type and will be inherited by the subtypes leading to same problem again.
I have not tried it yet, I will do it and post the result, just to confirm how it works.
Yes, keeping in mind the complexity of this approach, I am now exploring options to handle it in a workflow as this Primary is send to some approval workflows.
MFK consists of a domain and key value. Domain is taken from the object type where MFK is defined. Subtypes will inherit the MFKs of parent types unless it explicitly overridden.
So if you define the MFK at ParentRelType, Domain for Rel1 and Rel2 will still be ParentRelType.
Other concern is how TC or APIs will react to such data conditions when the user is about to create such a relation.. Error message may not be intuitive for end user..
This approach did work i.e. creating a parent relation and adding MFK on parent.
But as discussed, this is a little complex requirement so rather than using MFK on relation, I have managed to handle this requirement in one of our release workflows.
Extremely Sorry, this MFK did not work. It restricted relation creation due to a other GRM rule which i missed to check. My bad !!
So even if we add MFK (Primary + Secondary + relation type) on parent, system adds object_type in MFK of created relation making it unique for selected relation only i.e. child relation.
Anyway thank you for suggestion.
Apologies again for this confusion.