AX2012 jobs are back in D365 (kind of)

MarijanFinance & Operations3 years ago20 Views

Disclaimer: I do not encourage anyone on using this feature. And if you use it, please be careful with manipulating data using this feature.

With the release of the PEAP version for 10.0.25 Microsoft reintroduced the ability to execute jobs without having a downtime for the needed deployment:
https://docs.microsoft.com/en-us/dynamics365/fin-ops-core/dev-itpro/deployment/run-custom-scripts
While I wouldn’t recommend anyone to use this, I decided to show you a small overview of the current state of the feature.

Enable the flighting

So the feature is shipped as a flighting feature which we need to enable: AppConsistencyCustomScriptFlight
Easiest way is to use the d365fo.tools to enable the flight: d365fo.tools/Enable-D365Flight.md at development · d365collaborative/d365fo.tools · GitHub
Remember to restart the IIS after enabling it.

When everything succeeded you should be able to see a new form under the System Administration – Periodic tasks – Database – Custom scripts:

Prepare the job and upload the deployable package

The job is just a runnable class which needs to be the only element in the containing model. Here you can have look on the sample code:

Nothing fancy there, just a simple update. I observed, that updating the SalesTable or another table which is using the cache can not be updated right now.
Next step would be to create a deployable package and to upload it using the upload button in the custom scripts form giving the script a meaningful name:

Approve, test and run the script

Now we need to approve an test the script. These steps can’t be executed by the same user who uploaded the script. So you need a co-conspirator for your update job from hell.
In the details form you can execute the desired tasks:

When you test the script the log in the form will be filled and if the script fails, the script remains in a failed state and can not be run again.

The sample script ran through without any issues. So we are good to go and execute the script. When the script has finished we can check the updated record in the table browser:

So basically it’s not that much of an effort. But be aware, that you really need to know which data you’re updating and that you possibly could be destroying the production database.

Original Post https://d365fostuff.wordpress.com/2022/02/01/ax2012-jobs-are-back-in-d365-kind-of/

0 Votes: 0 Upvotes, 0 Downvotes (0 Points)

Leave a reply

Join Us
  • X Network2.1K
  • LinkedIn3.8k
  • Bluesky0.5K
Support The Site
Events
March 2025
MTWTFSS
      1 2
3 4 5 6 7 8 9
10 11 12 13 14 15 16
17 18 19 20 21 22 23
24 25 26 27 28 29 30
31       
« Feb   Apr »
Follow
Sign In/Sign Up Sidebar Search
Popular Now
Loading

Signing-in 3 seconds...

Signing-up 3 seconds...