Skip to main content

Notifications

Announcements

No record found.

Finance | Project Operations, Human Resources, ...
Answered

Updating a Custom X++ script

(0) ShareShare
ReportReport
Posted on by 541

So, I'm giving the Custom X++ script feature a go (https://docs.microsoft.com/en-us/dynamics365/fin-ops-core/dev-itpro/deployment/run-custom-scripts)

Long story short - the customer wants to rename a warehouse (InventLocation) but they are getting errors which are related to the fact that it is used in some InventDim records - which can't be simply renamed due to the SHA hash codes - so I need to fix them manually.

I create a deployable package for a new model with 1 runnable class as per the instructions, and uploaded it to the custom scripts screen.

I then realized that I wanted to do an additional change, so I did the change and tried to upload a second time.  Now I get the following message when I try to upload:

A deployable package with the assembly signature 'Dynamics.AX.InventLocationTransferScript, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' already exists. The system will reuse the implementation from the existing package. Do you want to continue?

If I press cancel the process is abandoned, if I press Ok and continue, the process will keep on running my old script.

  • My model version is 1.0.0.0 but even if I change it to up to 2.1.1.1 - so all versions, the assembly is still 0.0.0.0 and there is no way to specify it in the creation of the package or in the descriptor.  The dll, if I unzip the deployable package is 2.1.1.1.
  • I have checked the error and its label @AppTroubleshooting:CustomScriptDeployPackageAlreadyExists but it has no references - thus meaning its probably in a dll.
  • I have also read at this link My take on the X++ custom scripts feature - ariste.info that the original assembly has been uploaded to "DIXF temp path set in the DMF parameters".

How can I get a new package in place other than creating a new model?  Is it possible to somehow delete the file from the temporary folder or to update the assembly version?

 

  • Updating a Custom X++ script
    Even after creating the new Class, it shows the same error and we get block.
    This feature needs to be refine.
  • nunomaia Profile Picture
    nunomaia 10,684 Super User 2024 Season 1 on at
    RE: Updating a Custom X++ script

    yes, all code is wrapped under a TTS. That is the solution to simulate script. Execute code and rollback TTS in simulation mode. 

  • nspiteri Profile Picture
    nspiteri 541 on at
    RE: Updating a Custom X++ script

    one other thing I found out - in your script don't put any prompts because since the test run automatically wraps the script around a tts, you'll get tts errors and cannot continue after that.

  • nspiteri Profile Picture
    nspiteri 541 on at
    RE: Updating a Custom X++ script

    that's the only solution I found.. its a bit silly but it works

  • Verified answer
    nunomaia Profile Picture
    nunomaia 10,684 Super User 2024 Season 1 on at
    RE: Updating a Custom X++ script

    You need to create a new model to avoid conflicts 

  • nspiteri Profile Picture
    nspiteri 541 on at
    RE: Updating a Custom X++ script

    Thanks Andre,

    Unfortunately I do not think this fixes the issue.  The way the functionality appears to work is that you first create a deployable package with 1 class.  This deployable package is then uploaded to a storage on the drive in order to run, however it only is uploaded if there isn't already a deployable package with the same version.

    As we are unable to specify the version on the creation of the deployable package, the system will assume that we are uploading the same file and thus not upload it at all.  

    In order to get this to work it should either be possible to either:

    a) force the upload - but there doesn't seem to be an option

    b) change the assembly version of the deployable package - but the UI does not seem to let you do it and I can't find a command line way of doing this

    c) empty the folder where the deployable packages are installed (which according the the blog I quoted earlier is in DMF Parameters

    Other than that, I think I have to create a new model every time.

  • André Arnaud de Calavon Profile Picture
    André Arnaud de Cal... 291,431 Super User 2024 Season 2 on at
    RE: Updating a Custom X++ script

    Hi Norbert,

    In the documentation, Microsoft mentioned that you should use a unique class name in each of the custom scripts. I wouldn't try to delete anything as renaming the object would be the quickest solution.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Verified Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,431 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,503 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Product updates

Dynamics 365 release plans