General InformationThis 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 the Properties or Instance tab of the Information panel, and then clicks either anywhere else in the tab or the Save button to save the changes. The dialog box is updated according to the rules defined in the script for properties and values. If the user clicked the Save button, the modifications are saved.
In case of multiselection, the business logic is executed once for all the selected objects if:
Recommendation:
Check that the script is
appropriate for both single selection and multiselection of different object types
(possibly common or different attributes, with the same or different values).
For
more information, see About UX Openings.
Input Objects
Context Object Parameters
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) )
In this example, the Description attribute value is updated to "number of selected objects: <N>", where <N> is an integer corresponding to the number of objects selected by the user: Let numberOfObjects(Integer)
Trace(1,"Inside UX prop_modify BL")
numberOfObjects = Parameters->GetAttributeObject("numberOfObjects")
ThisObject.SetAttributeString( "PLMEntity.V_description", "number of selected object: " + numberOfObjects)
ExamplesThis example shows how to make the Description property read-only: Trace(1,"Inside ux_init_edit_properties_modify")
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 Properties tab when the user modifies the Title to "HideDescriptionAttribute": Trace(1,"Inside ux_init_edit_properties_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_edit_properties_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_edit_properties_modify")
if (ThisObject.GetAttributeString("PLMEntity.V_Name") == "%"){
if (ThisObject.HasAttributeProperty("PLMEntity.V_description", "Notification") == true){
ThisObject.SetUIAttributeNotificationMessageAndSeverity("PLMEntity.V_description", 1, "You cannot use this character in the description: %")
}
}
This example shows how to restrict the possible values for the Difficulty property to Medium or High when the user modifies the Priority to Urgent: Let authvalueForDifficulty(List)
Let valueForPriority(String)
set valueForPriority = ThisObject.GetAttributeString("Priority")
Trace(1,"Inside ux_init_edit_properties_modify start")
if(valueForPriority == "Urgent")
{
if(ThisObject.HasAttributeProperty("Difficulty", "AuthorizedValues") == true){
authvalueForDifficulty.Append("Medium")
authvalueForDifficulty.Append("High")
ThisObject.SetUIAttributeAuthorizedValue("Difficulty", authvalueForDifficulty)
}else{
authvalueForDifficulty.Append("Low")
authvalueForDifficulty.Append("Medium")
authvalueForDifficulty.Append("High")
ThisObject.SetUIAttributeAuthorizedValue("Difficulty", authvalueForDifficulty)
}
}
Trace(1,"Inside compute_edit_modify end")
| |||||||||||||||||||||||||||||