CONTEXT_RELATIONSHIP NAME

While adding a new record and executing the “newrecord” rulebase, the CONTEXT_RELATIONSHIP variable contains the name of a relationship if the record is added by selecting the “add” action and then the relationship name on an existing record.

For example, if you are keeping a Vendor repository which has a relationship for multiple addresses, then you can automatically set the “RECORD_TYPE” to address if the user is adding a new address relationship.

<constraint>
		<name>Vendor_Record_Type</name>
		<condition>
			<undefined>
				<var>CONTEXT_RELATIONSHIP/NAME</var>
			</undefined>
		</condition>
		<action>
			<assign>
				<var>RECORD_TYPE</var>
				<const type="string">VENDOR</const>
			</assign>
		</action>
	</constraint>
	<constraint>
		<name>Address_Record_Type</name>
		<condition>
			<eq>
				<var>CONTEXT_RELATIONSHIP/NAME</var>
				<const type="string">ADDRESS_REL</const>
			</eq>
		</condition>
		<action>
			<assign>
				<var>RECORD_TYPE</var>
				<const type="string">ADDRESS</const>
			</assign>
		</action>
	</constraint>

The following is another example of assigning the RECORD_TYPE based on the Context Relationship.

<constraint>
		<name>PRODUCT</name>
		<condition>
			<undefined>
				<var>CONTEXT_RELATIONSHIP/NAME</var>
			</undefined>
		</condition>
		<action>
			<assign>
				<var>RECORD_TYPE</var>
				<const type="string">PRODUCT</const>
			</assign>
		</action>
	</constraint>
	<constraint>
		<name>SKU</name>
		<condition>
			<eq>
				<var>CONTEXT_RELATIONSHIP/NAME</var>
				<const type="string">PRODUCT_TO_SKU_REL</const>
			</eq>
		</condition>
		<action>
			<assign>
				<var>RECORD_TYPE</var>
				<const type="string">SKU</const>
			</assign>
		</action>
</constraint>