Issue change (shortcut menu server call) - SmartPlant Foundation - IM Update 44 - Customization & Programming - Hexagon

SmartPlant Foundation Customization

Language
English
Product
SmartPlant Foundation
Search by Category
Customization & Programming
SmartPlant Foundation / SDx Version
10

For part of the customization we have configured a Change object. This is a non-classified object with a ChangeStatus property.

To show how to call the server and support multi-select, we developed an Issue change Client API.

The new Client API IssueChanges displays the above confirmation message and then sends the selected objects to the Server API IssueChanges.

On the server side the new Server API shows how to handle transactions using the Begin and Commit methods. It handles exceptions and rolls back the transaction when required.

OnHandlerBody method queries for the objects sent to the client and then loops around each one and calls the IssueChange MethodDef. We have configured a primary MethodDef on the ITRNChange interface. To call the MethodDef we always use the ToInterface function, which ensures the most specialized interface that contains this method is called first.

The MethodDef is written on the ITRNChangeDefault class and sets the change status property to Issued. To update an object you have to call the BeginUpdateWithImplicitClaim method, which will lock the object and also ensure that it doesn't have to be claimed before it is updated. If it does need to be claimed, then the claimed object will be returned and you must update that.