Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
This article provides a workaround that allows the Asset ID to be edited in Microsoft Dynamics 365 Supply Chain Management.
Symptoms
A user creates a new asset using the Asset Management page. The asset is created with an Asset ID value that the system generates based on the number sequence selected on the Asset management parameters page. However, the Asset ID value can't be edited later, even though the related number sequence is set to Manual on the Number sequences details page.
Cause
This behavior is by design. A user can't edit an existing Asset ID because the Asset ID is the natural key for the asset. Editing it can cause data corruption and unexpected behavior in case of integrations.
Workaround
To allow a user to edit the Asset ID on an existing asset despite the risk of data corruption, a developer needs to extend the EntAssetObjectTable
form and change the property of the field.
Use Chain of Command (CoC) to change the control property by calling the
allowEdit()
method of the control and passingfalse
as an argument.Create an extension class and extend the
init()
form method to programmatically allow the field to be edited after thenext()
call.
For a detailed explanation of the approach, see Class extension - Method wrapping and Chain of Command.