cancel
Showing results for 
Search instead for 
Did you mean: 

Multified Key on Relation

Creator
Creator

Hello,

 

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.

e.g

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.

 

Regards

Priti

8 REPLIES

Re: Multified Key on Relation

Pioneer
Pioneer

Hi

 

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.

 

BR

Frank

Re: Multified Key on Relation

Creator
Creator

Thank you Frank.

 

But I need to do it through configuration, no customisation.

 

Regards

Priti

Re: Multified Key on Relation

Valued Contributor
Valued Contributor

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..

Re: Multified Key on Relation

Creator
Creator

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.

 

Regards

Priti

 

 

Re: Multified Key on Relation

Valued Contributor
Valued Contributor

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..

Re: Multified Key on Relation

Creator
Creator

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.

 

Thank you.

 

Regards

Priti

Re: Multified Key on Relation

Valued Contributor
Valued Contributor

Thanks for posting the results...

I think not using MFK for this is the right decision...

Re: Multified Key on Relation

Creator
Creator

Hello MSS,

 

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.

 

Regards

Priti.