New Modify (ux_init_new_modify)

An opening ID is an entry point used to customize business logic. ux_init_new_modify lets you customize the properties displayed in the New ... or Insert New...dialog box, and define messages displayed to users.

Note: For more information about customization by business rules, see Customization by Business Rules.

This page discusses:

See Also
About UX Openings

General Information

This opening ID is an init opening. For more information about the specificities of an init opening, see Init Openings.

It is triggered each time a user modifies the value of a property in a New ... or Insert New... dialog box, and then clicks either anywhere else in the dialog box or on Create to create the object.

Note: It is not triggered when the user modifies infrastructure attributes like type, template, credentials, or file name.

The dialog box is updated according to the rules defined in the script for properties and values. If the user clicked Create , the object is created.

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

Context Object Parameters

Parameter Name Type Read or Write Comments
modifiedAttributes Attribute Read The list of modified attributes that triggered the execution of the business logic.
numberOfObjects Attribute Read The number of objects on which the script is run.

For openings related to New … and Insert New ... dialog boxes, it is always 1.

In this example, the Description attribute value is updated to "modified attribute name: <internal_attribute_name>", where <internal_attribute_name> is the name of the modified attribute that triggered the execution business logic:

Let modAttrList(List)
Let modAttrName(String)
Trace(1,"Inside UX new_modify BL")
modAttrList  = Parameters->GetAttributeObject("modifiedAttributes")
modAttrName = modAttrList.GetItem(1)
ThisObject.SetAttributeString( "PLMEntity.V_description",  "modified attribute name: " + modAttrName)
Trace(1, "modAttrName: "+modAttrName  + " value: "+ThisObject.GetAttributeString(modAttrName) )

Examples

This example shows how to make the Description property read-only:

Trace(1,"Inside ux_init_new_modify")
if (ThisObject.GetAttributeString("PLMEntity.V_Name") == "RODescriptionAttribute"){
	if (ThisObject.HasAttributeProperty("PLMEntity.V_description","ReadOnly") == true){
		ThisObject.SetUIAttributeReadOnly("PLMEntity.V_description", true)
	}
}

This example shows how to remove the Description property from the New... dialog box when the user modifies the Title to "HideDescriptionAttribute":

Trace(1,"Inside ux_init_new_modify")
if (ThisObject.GetAttributeString("PLMEntity.V_Name") == "HideDescriptionAttribute"){
	if (ThisObject.HasAttributeProperty("PLMEntity.V_description","Visibility") == true){
		ThisObject.SetUIAttributeVisible("PLMEntity.V_description", false)
	}
}

This example shows how to restrict the Description property to a list of authorized values ("alpha", "beta", and "gamma") when the user modifies the Title to "setAuthValuesForDescription":

Let authvalueForDesc(List)

Trace(1,"Inside ux_init_new_modify")

if (ThisObject.GetAttributeString("PLMEntity.V_Name") == "setAuthValuesForDescription"){
	if (ThisObject.HasAttributeProperty("PLMEntity.V_description","AuthorizedValues") == true){
		authvalueForDesc.Append("alpha")
		authvalueForDesc.Append("beta")
		authvalueForDesc.Append("gamma")
		ThisObject.SetUIAttributeAuthorizedValue("PLMEntity.V_description", authvalueForDesc)
	}
}

This example shows how to display an error message and define its severity and content when the user modifies the Title to "%":

Trace(1,"Inside ux_init_new_modify")

if (ThisObject.GetAttributeString("PLMEntity.V_Name") == "%"){
	if (ThisObject.HasAttributeProperty("PLMEntity.V_Name", "Notification") == true){
		ThisObject.SetUIAttributeNotificationMessageAndSeverity("PLMEntity.V_Name", 1, "You cannot use this character in the description: %")
	}
}