logo
logo

Set a master asset on a product

This action script example sets the last modified asset in a product as the master asset (cover image) when a new asset is added to the product.

The action executes in the pre-commit phase (in-process).

Note

Pre-commit means that the script executes before the triggering event. In our case, the script executes before the PCMProductToAsset relation is actually updated.

To set up your script, action, and trigger:

  1. Add an asset to a product.

  2. Create a script of the Action type, publish it, and enable it.

  3. Create an action of the Action script type, and link it to your script.

  4. Create a trigger:

    • In the General tab, set the Objective to Entity creation and Entity modification.

    • In the General tab, set the Execution type to In process.

    • In the Conditions tab, add a condition for the Asset (M.Asset) and Product (M.PCM.Product) entity definitions.

    • In the Asset (M.Asset) condition, add a new condition for the Products (PCMProductToAsset) relation, and set it to Has changed.

    • In the Product (M.PCM.Product) condition, add a new condition for the Assets (PCMProductToAsset) relation, and set it to Has changed.

    • In the Actions tab, add the related action under Pre-commit actions.

    • Save, and activate the trigger.

Can we improve this article ? Provide feedback