Associate Products and Containers in an Assortment Line Relationship
As an administrator, you can associate product and container with each other in assortment line relationship. They must belong to same assortment. Create triggers to ensure that product and container from different assortments can't be associated with each other.
To create triggers to ensure that products and containers from different assortments aren't associated with each other in an assortment line relationship:
-
Ensure that you're in an active sandbox.
-
Go to the Application Composer.
-
Select Common from the Application list.
-
Expand
-
Click Server Scripts.
-
Navigate to the Triggers tab and click
to create the new trigger. -
On the Create Object Trigger page, specify the following two triggers:
-
Trigger: Before Insert in Database
Trigger Name: ValidateAssortmentLineRelationship_BeforeInsert
In Trigger Definition, paste the following script from this document and click Save and Close:
def fromAssort = __ORACO__FromAssortmentLine_Obj_c?.__ORACO__ProductAssortment_Id_c def toAssort = __ORACO__ToAssortmentLine_Obj_c?.__ORACO__ProductAssortment_Id_c if(fromAssort != toAssort) { throw new oracle.jbo.ValidationException("Product and container should belong to the same assortment") }
-
Trigger: Before Update in Database
Trigger Name: ValidateAssortmentLineRelationship_BeforeUpdate
In Trigger Definition, paste the following script from this document and click Save and Close:
if(isAttributeChanged('__ORACO__FromAssortmentLine_Id_c') || isAttributeChanged('__ORACO__ToAssortmentLine_Id_c')) { def fromAssort = __ORACO__FromAssortmentLine_Obj_c?.__ORACO__ProductAssortment_Id_c def toAssort = __ORACO__ToAssortmentLine_Obj_c?.__ORACO__ProductAssortment_Id_c if(fromAssort != toAssort) { throw new oracle.jbo.ValidationException("Product and container should belong to the same assortment") } }
-
-
Publish the sandbox.
Triggers ensure that a product and a container from different assortments aren't associated with each other in an assortment line relationship.