Adding Assign Identity in Rulebase

Procedure

  1. Define a rule and save it in the catalogvalidation.xml file for the repository. Refer to the following sample:
    <?xml version="1.0" encoding="UTF-8"?>
    <rulebase metaversion="1.0">
    <name>Catalog Validations</name>
    <description>Catalog Validations</description>
    <constraint>
        <name>identitycheck</name>
       <description>find identity and assign</description>
        <action>
    	<assignidentity>
    	<explanation>Identity is assigned.</explanation>
    	<var>AssignSequence1</var>
    	<var>FIRSTNAME</var>
    	<var>LASTNAME</var>
    	</assignidentity>
        </action>
    </constraint>
    </rulebase>
    Note: The Sequence key is a mandatory variable that generates a PRODUCTID.
  2. Create a new record and specify the values for FIRSTNAME and LASTNAME business key variables. For information on creating records, refer to Creating Records.
    • If you specify values that do not match existing records, the <assignidentity> action retrieves PRODUCTID using the specified sequence and assign it to a record. However, PRODUCTIDEXT remains null.
    • If you specify values that match an existing record, the <assignidentity> action retrieves PRODUCTID and PRODUCTIDEXT and assigns them to a record.
    • However, if <assignidentity> action locates multiple matching records, it does not assign PRODUCTID and PRODUCTIDEXT to a record.
  3. Create a rulebase file. For example, assignidentiy.xml and use it in the Rulebase parameter of the PrepareForImportCatalog activity.

    Import data without PRODUCTID and PRODUCTIDEXT and verify the result.