Modify Attribute (modifyattribute)

An opening ID is an entry point used to customize business logic. modifyattribute is triggered when an attribute of an object has been modified.

Warning: This opening is not triggered if a create opening for the same object is in the same transaction.
Note: For more information about customization by business rules, see Customization by Business Rules.

This page discusses:

General Information

This opening ID is a precommit opening. For more information about the specificities of a precommit opening, see Precommit Openings.

Definition Description
PLM Opening ID modifyattribute
Customization intent Not applicable
Execution context Server

Input Objects

Context Object Parameters

Table 1. Business Object Standard Parameters
Parameter Name Type Read or Write Comments
EVENT String Read Any of the supported events.
NAME String Read Business object name
ORGANIZATION String Read The organization that owns the business object
OWNER String Read The owner of the business object
PHYSICALID String Read The physical ID for the business object
POLICY String Read The business object policy
PROJECT String Read The project (collaborative space) that owns the business object
REVISION String Read Business object revision
TYPE String Read Business object type
Table 2. Additional Parameters for modifyattribute
Parameter Name Type Read or Write Comments
ATTRDEFAULT String Read Default value
ATTRNAME String Read Name of attribute

For local attributes, the macro includes the owner. For example, a global attributed Cost is passed as Cost, and a local attribute Cost owned by Part is passed as Part.Cost.

ATTRTYPE String Read Type (Integer, Real, String, Boolean, or Date)
ATTRTYPEKIND String Read Attribute type kind (single-value, multi-value, or range-value)
ATTRVALUE String Read Current value
NEWATTRVALUE String Read Target attribute value
AuditTags List Read Logging event of the transaction.

Sample

    

Trace(1, "Execution modifyattribute on ", ThisObject.PLM_ExternalID )
    Trace(1, "Test macro ATTRDEFAULT = ", Parameters.Macros.GetString("ATTRDEFAULT") )
    Trace(1, "Test macro ATTRNAME = ", Parameters.Macros.GetString("ATTRNAME") )
    Trace(1, "Test macro ATTRTYPE = ", Parameters.Macros.GetString("ATTRTYPE") )
    Trace(1, "Test macro ATTRTYPEKIND = ", Parameters.Macros.GetString("ATTRTYPEKIND") )
    Trace(1, "Test macro ATTRVALUE = ", Parameters.Macros.GetString("ATTRVALUE") )
    Trace(1, "Test macro NEWATTRVALUE = ", Parameters.Macros.GetString("NEWATTRVALUE") )
    
    if ("PLMInstance.V_Name" == Parameters.Macros.GetString("ATTRNAME"))
    {            
        if (ThisObject.GetAttributeString("PLMInstance.V_Name") <> Parameters.Macros.GetString("NEWATTRVALUE"))
        {
            ReportUXMessage("Macros error")
            Validation = false
        }
    }
    Report("Warning", "warnMsg", "This is a warning")
    ThisObject.SetAttributeString("PLMInstance.V_description", "modified by script 2")
    Validation = true