Skip to Content
Former Member
Jul 08, 2014 at 06:05 PM

How to Redeclare a Relationship?


I am wondering how one might go about redeclaring a relationship in order to make one side of it no longer optional. Is there an equivalent for relations to the redeclare="true" option with attributes?

Our example is that we've created a subtype of SubscriptionProduct called MySubsProduct. Our subtype requires that a SubscriptionEntitlement be set for the site to work correctly, but it is not defined with in its original definition in subscriptionservices-items.xml. I have tried copy/pasting the relation definition from subscriptionservices-items.xml into my custom-items.xml, adding the optional modifier to the SubscriptionEntitlement side, building, and running an Update, but when viewing from the MySubsProduct or SubscriptionProduct Properties in "Types" in the hMC, they are both still considered optional.

Code snippet of what I added to my custom-items.xml:

 <relation localized="false" generate="false" code="SubscriptionProduct2SubscriptionEntitlementsRelation" autocreate="false">
     <sourceElement type="SubscriptionProduct" qualifier="subscriptionProduct" cardinality="one">
         <modifiers optional="false"/>
     <targetElement type="SubscriptionEntitlement" qualifier="subscriptionEntitlements" cardinality="many">
         <modifiers optional="false"/>

I am fine either way if we make the SubscriptionEntitlement required on MySubsProduct only, or if it is required on both SubscriptionProduct as well as its subtypes (including MySubsProduct), but I can't seem to figure out how to do this without having to change the original relationship definition in subscriptionservices-items.xml.