Tag: Programming

  • Free Access to D365FO Dev Environment (with Dev Box!) – For Training Purposes Only.

    Free Access to D365FO Dev Environment (with Dev Box!) – For Training Purposes Only.

    Hello there, fellow dynamics developers!

    Ever wanted a free dev environment to play around with Dynamics 365 Finance and Operations (D365FO) for training or development? Well, guess what? I’ve got you covered! Here’s a quick guide to accessing your very own D365FO environment with Visual Studio.

    Step 1: Get Started with Microsoft Learn

    First, head on over to Microsoft Learn (Click Me). If you’re already signed in, you’ll see a button that says “Launch VM Mode”.

    If you’re not logged in yet, don’t worry, just click on “Sign in to Learn”.

    P.S. You can either use your organization account or create a new one just for this purpose.

    Step 2: Time to Log in to the VM

    Once you’ve clicked on “Launch VM Mode”, you’re almost there! You don’t have to type in any passwords.

    You just need to click on the little icon navigate to “Type Text” and click “Type Password”, and voila – the system will automatically fill in the password for you.

    Or you could also autofill the password from Ressources – which may be faster:

    Step 3: Ready, Set, Go!

    After clicking Enter, you’ll be inside the VM in no time!

    To connect to the D365 enviroment you also need to use the url and user generated for you in the Azure Portal section of ressources.

    Step 4: Sessions and Time Limits

    Your session will last for up to 1.5 hours, after which it will automatically close. You can see the remaining time on the top right corner.

    There’s no limit to the number of sessions you can connect to in a day. So go ahead and explore as much as you want!

    That’s it! You now have access to a free dev environment for all your D365FO needs. Happy developing, and don’t forget to have some fun along the way!

  • X++ in D365 Finance and Operations: Manual prices in SalesLine/PurchLine records

    X++ in D365 Finance and Operations: Manual prices in SalesLine/PurchLine records

    To create your SalesLine/PurchLine record with manual price related fields there is a simple method to do this. You need to call the function setPriceDiscChangePolicy().

    See the SalesLine code example below:

    static void createSalesLine(){
    SalesLine salesLine;
    
    salesLine.salesId = "ThisIsSalesID";
    salesLine.ItemId = "ThisIsAnItemId";
    salesLine.SalesQty = 4;
    salesLine.SalesPrice = 4.89;
    salesLine.LineDisc = 5.00;
    salesLine.LinePercent = 2.00;
    salesLine.PriceUnit = 1.00;
    
    salesLine.setPriceDiscChangePolicy(PriceDiscSystemSource::ManualEntry, fieldNum(salesLine, SalesPrice));
    salesLine.setPriceDiscChangePolicy(PriceDiscSystemSource::ManualEntry, fieldNum(salesLine, LineDisc));
    salesLine.setPriceDiscChangePolicy(PriceDiscSystemSource::ManualEntry, fieldNum(salesLine, LinePercent));
    salesLine.setPriceDiscChangePolicy(PriceDiscSystemSource::ManualEntry, fieldNum(salesLine, PriceUnit));
    
    salesLine.createLine(true, //Validate
    true); //initFromSalesTable
    }

    Manually setting the fields means that any changes made on the form will not update the values automatically.

    I hope this helps in programming your task. Happy coding!

  • X++ in D365 Finance and Operations: Find prices the easy way

    X++ in D365 Finance and Operations: Find prices the easy way

    In X++, finding prices is made simple with a user-friendly function provided as a standard feature. This function streamlines the process, making it efficient and straightforward for developers to access and utilize pricing information within their code. See the example below how to search a price:

        public static Amount getPrice(ModuleInventPurchSales _module,
                                                CustTable              _custTable,
                                                InventTable            _inventTable,
                                                InventDim              _inventDim,
                                                TransDate              _date,
                                                Qty                    _qty)
        {
            PriceDiscParameters priceDiscParameters = PriceDiscParameters::construct();
            priceDiscParameters.parmModuleType(_module);
            priceDiscParameters.parmItemId(_inventTable.ItemId);
            priceDiscParameters.parmInventDim(_inventDim);
            priceDiscParameters.parmUnitId(_inventTable.salesUnitId());
            priceDiscParameters.parmPriceDiscDate(_date);
            priceDiscParameters.parmQty(_qty);
            priceDiscParameters.parmAccountNum(_custTable.AccountNum);
            priceDiscParameters.parmCurrencyCode(_custTable.Currency);
    
            PriceDisc priceDisc = PriceDisc::newFromPriceDiscParameters(priceDiscParameters);
    
            priceDisc.findPrice(_custTable.PriceGroup);
    
            priceDisc.findLineDisc(_inventTable.salesLineDisc(), _custTable.LineDisc);
    
            real price   = priceDisc.price(); //Returns price
            real discPct = priceDisc.lineDiscPct(); //Returns discount in percent
            real discAmt = priceDisc.lineDiscAmount(); //Returns discount amount
    
            return price;
        }

    I hope this helps you for your development task. Happy coding!