Running Custom X++ Scripts in Tier 2 or Higher Version Production Environment Without Downtime - Microsoft Dynamics 365 Vietnam

Microsoft Dynamics 365 Vietnam

Song Nghia - Microsoft Dynamics 365 Vietnam

Breaking

Monday, June 17, 2024

Running Custom X++ Scripts in Tier 2 or Higher Version Production Environment Without Downtime

 Running Custom X++ Scripts in Tier 2 or Higher Version Production Environment Without Downtime
x






Running custom X++ scripts in a Tier 2 or higher version production environment can be essential for tasks like updating inventory transactions. Here’s a step-by-step guide on how to do it without causing any downtime:



Example Scenario:

You need to update the inventory transactions for particular items in a Tier 2 or higher version environment.

Steps to Follow:

  1. Prepare the Dev Box:

    • Create a new model and add the necessary reference packages.
    • Create a runnable class to update the specific inventory transactions.
  2. Develop the Runnable Class:

    [SysEntryPointAttribute]

    public class UpdateInventoryTransactions extends RunBaseBatch

    {

        public static void main(Args _args)

        {

            UpdateInventoryTransactions updateInventoryTransactions = new UpdateInventoryTransactions();

            updateInventoryTransactions.run();

        }


        public void run()

        {

            // Your logic to update inventory transactions

            // Example: Update inventory transactions for a particular item

            InventTrans inventTrans;

            select forUpdate inventTrans where inventTrans.ItemId == 'YourItemId';

            

            ttsBegin;

            // Perform your updates here

            inventTrans.StatusIssue = InventTransStatus::Sold;

            inventTrans.update();

            ttsCommit;

        }

    }

  3. Create a Deployable Package:

    • Build and create a deployable package for the runnable class.
  4. Upload the Deployable Package:

    • Navigate to your Tier 2 or higher version environment.
    • Go to the System Administration module.
    • Path: System AdministrationPeriodic TasksDatabaseCustom Scripts.
  5. Upload the Package:

    • Click on the Upload button and upload the deployable package you created.

  6. Approval Process:

    • Once the package is uploaded, it needs to be approved. Ensure someone with the necessary permissions approves the deployable package.

  7. Testing the Script:

    • After approval, test the process in a controlled manner to ensure it performs as expected.
  8. Run the Script:

    • If the test results are as expected, click RUN to execute the script.
    • The script will update the inventory transactions for the specified items without causing any downtime.

By following these steps, you can effectively run custom X++ scripts in a production environment, ensuring critical updates and changes are made seamlessly and without disrupting ongoing operations.


About Our Team

Our team is composed of software development and analysis experts who have worked both domestically and internationally:

  • Nghia Song (Mr.) - Technical Architect. With over 6 years of experience in implementing ERP and integration projects.
  • Jone Nguyen (Mr.) - Senior Technical Consultant. With practical experience in 25 E-invoice projects with software systems of businesses both domestically and internationally.
  • Victor (Mr.) - Senior Project Manager.With over 12 years of specialized experience in Dynamics 365 Fno.
  • Lisa Doan (Ms.) – Finance Consultant. A consultant specializing in accounting on Dynamics 365 FO and consolidated accounting systems.

Song Thành NghÄ©a                                                 
Microsoft Dynamics 365 Technical Architect
Mobile/WA: +356 7748 2386 | Web: https://www.songnghia.com/
Zalo: +84 967 324 794 | Mail: nghia@songnghia.com

No comments:

Post a Comment