Today, I want to write a short blog post on how to use the Change ID action that Acumatica offers to developers. It has on some entities such as the Customer, Vendor, or Inventory Items. This action allows users to change the ID of a record to a new one while keeping all the related records in the system. You can see below that it opens a small pop-up window and simply requests a new ID.
The Inventory ID will be set to the value that the user specifies after the user clicks OK.
It a pretty simple and useful feature.
Now, let us see how we can add this feature to any page without it. Let’s try to add it to the Fixed Assets page which doesn’t have this action out-of-box.
First, we need to extend the AssetMaint graph to add our action. But we will not add a regular PXAction in this case. The Acumatica Framework has a special action called PXChangeID and we will use it.
GIST: https://gist.github.com/sampetrosov/2fc2a44de6274ce5c276ae889d5462ea
Now that we have the code part, we need to add the UI part. As you remember the action shows a pop-up dialog and we need to add it to the Fixed Assets page. We need to add the below Smart Panel to the page.
GIST: https://gist.github.com/sampetrosov/72600857fbd8184f0f66164ba65215a9
And this is all that you need to do. Now you get the Change ID action under the Actions menu and can change the ID of the Fixed Asset.
Below, I am providing a recording link to demonstrate this functionality further:
https://github.com/sampetrosov/Acumatica-ChangeID/blob/main/Recording/Acumatica_ChangeID_Demo.mp4
Besides the GISTs of the snippets of code above, I have also have provided the complete source code for you and an installation package link that you can use for your own code:
GitHub Install-Package: https://github.com/sampetrosov/Acumatica-ChangeID.git
Hopefully, you have found this information useful in your own development work and it will make your efforts a bit easier with respect to using the Acumatica Frameworks features.
Happy Coding!