Friday, June 5, 2026

Azure Function Apps

Content copied from AI.

Azure Function Apps provide a serverless, event-driven compute service that lets you run code in languages like C#, Python, JavaScript, and Java without managing infrastructure. They scale automatically, offering a cost-effective "pay-per-use" model suitable for processing data, integrating systems, and building APIs.

Key Aspects:

  • Serverless Architecture: You focus solely on code, while Azure handles infrastructure, provisioning, and maintenance.
  • Event-Driven Triggers: Functions run in response to events, such as HTTP requests, queue messages, or timer schedules.
  • Development Flexibility: Supports multiple languages including C#, Java, JavaScript, PowerShell, Python, TypeScript, and more.
  • Integration: Easily connects to other services using triggers and bindings without writing extensive code.
  • Deployment Options: Allows deployment via the Azure portal, Visual Studio Code, GitHub, and Azure DevOps.
  • Task Automation: Executing scheduled tasks or timer-based jobs.
  • Security: Inherits security features from Azure App Service, including Azure Active Directory (AD) integration.
  • Hosting Plans: Options include Consumption (pay-per-use), Premium (enhanced performance), and Dedicated (App Service plan)

Prerequisites:

  1. Visual Studio
  2. Azure Subscription

Azure Functions => Trigger types (Most commonly used triggers)

  1. HTTP trigger: Triggers your function via HTTP requests.
  2. Timer trigger: Executes your function at specified time intervals.
  3. Blob trigger: Executes your function on any creation or modification of a blob in Azure Storage.
  4. Queue trigger: Executes your function when a new message is added to an Azure Storage queue.
  5. Event Grid trigger: Listens for events published by Azure services or custom applications via Azure Event Grid.
  6. Service Bus trigger: Listens for messages on an Azure Service Bus queue or topic subscription.
  7. Event Hub trigger: Processes events from an Azure Event Hub.
  8. Durable Functions: Provides patterns for long running and stateful workflows, including orchestration and chaining of multiple function calls. 
  9. Etc, Lof of other trigger also availables.

 

 


Friday, May 8, 2026

Get or set adjust tax calculated amount using TAXDOCUMENT framework (Tax calculation service) in D365FO

 //Get or adjust tax calculation using TAXDOCUMENT framework (Tax calculation service)

TaxRegulation taxRegulationDetail;

TmpTaxRegulation  tmpTaxRegulationDetail;

SalesTotals salesTotals;


salesTotals = SalesTotals::construct(SalesTable::find(salesLineParentPOl.SalesId), SalesUpdate::All);

salesTotals.calc();


taxRegulationDetail = TaxRegulation::newTaxRegulation(salesTotals.tax());

tmpTaxRegulationDetail.setTmpData(taxRegulationDetail.tmpTaxRegulation()); // Get all current tax by order wise


//Get this buffer "tmpTaxRegulationDetail" to get all tax related data

//To adjust

TaxTable    taxTable;

select firstonly tmpTaxRegulationDetail

    where tmpTaxRegulationDetail.TaxCode

    join taxTable

        where taxTable.TaxCode == 'SAN_IPI';

if(tmpTaxRegulationDetail)

{

    taxRegulationDetail.updateTaxRegulationAmount(tmpTaxRegulationDetail, (<Updated tax amount after adjustment>), true); // to adjust use this call to do

    taxRegulationDetail.saveTaxRegulation(); //

}

Monday, May 4, 2026

Get Vendor & Warehouse primary address using query

 --Vendor default primary address

Select  vt.AccountNum, vt.Party, vt.RecId, lpd.RECID, dpl.LOCATION, lpd.ADDRESS from VENDTABLE vt

join DirPartyLocation dpl on dpl.Party = vt.Party

join LogisticsPostalAddress lpd on dpl.LOCATION = lpd.LOCATION

where vt.DataAreaId = 'usrt' and dpl.ISPRIMARY =1 and lpd.VALIDTO = '2154-12-31 23:59:59.000'


--Warehouse default primary address

Select  it.InventLocationId, it.INVENTSITEID, it.RecId, lpd.RECID,  lpd.ADDRESS

from INVENTLOCATION it

join InventLocationLogisticsLocation illl on illl.INVENTLOCATION = it.RECID

join LogisticsPostalAddress lpd on lpd.LOCATION = illl.LOCATION

where it.DataAreaId = 'usrt' --and dpl.ISPRIMARY =1 

and illl.IsPostalAddress =1 and illl.IsPrimary =1 and lpd.VALIDTO = '2154-12-31 23:59:59.000'


Wednesday, April 1, 2026

WMS Mobile app flow - Adding Detour fields for Process guided framework custom implementation

 WMS Mobile app flow

=> Adding Detour fields for Process guided framework custom implementation

Before fix:



Adding code fix to get thos requires field.

/// <summary>

/// WHS APP FLOW Detour fields implementation SAN_WHSMobileAppFlowPOLMovementLPCreation

/// Run Create Default setup from Mobile device steps

/// </summary>

[WHSWorkExecuteMode(WHSWorkExecuteMode::SAN_MovementLP)]

class SAN_WHSMobileAppFlowPOLMovementLPCreation extends WHSMobileAppFlow

{

    protected void initValues()

    {

        // add available fields

        this.addAvailableField(extendedTypeNum(InventSerialId));

        this.addAvailableField(extendedTypeNum(WHSLicensePlateId));

        this.addAvailableField(extendedTypeNum(ItemId));

    }

}


Post fix:



Wednesday, March 4, 2026

Error readable from string in D365FO

 Reference class: RetailSyncOrdersSchedulerTask

Error readable:

private str generateHumanReadableErrorDetail(System.Exception _exception, str _errorDetail = '')

{

    str errorDetail, exceptionType, stackTrace, exceptionMessage;


    errorDetail = _errorDetail;

    // When the CLR error encounters it gets the inner exception message, call stack and stores in Database.

    if (_exception && _exception.InnerException)

    {

        if (_exception.InnerException.InnerException && _exception.InnerException.StackTrace)

        {

            // Use inner exception if it is available as it is often more descriptive.

            errorDetail = errorDetail ? errorDetail +

                        _exception.InnerException.InnerException.Message : _exception.InnerException.InnerException.Message +

                         _exception.InnerException.StackTrace.ToString();

        }

        else if (_exception.InnerException.StackTrace)

        {

            errorDetail = _exception.InnerException.Message +  _exception.InnerException.StackTrace.ToString();

        }

        else

        {

            // When the exeption not returns a call stack, we get the call stack from the <c>Xsession<c> object.

            errorDetail = _exception.InnerException.Message + con2str(xSession::xppCallStack());

        }

    }


    return errorDetail;

}

Sunday, February 1, 2026

Replaces the value of the specified dimension attribute from source to target in D365FO


Replaces the value of the specified dimension attribute from source to target =>

LedgerDimensionDefaultFacade::serviceReplaceAttributeValue(<source dimension>, <target dimension>, DimensionAttribute::findByName("<Dimension name>").RecId);

Thursday, January 1, 2026

Dynamically setting entire Form security access through Extension in D365FO

/// <summary>

/// To check if user can get access to the Parameter form

/// </summary>

class SAN_ParamFormsAccessCtrl

{

    protected void new()

    {

        super();

    }


    static SAN_ParamFormsAccessCtrl construct()

    {

        return new SAN_ParamFormsAccessCtrl();

    }


    public boolean validateUserRoleAccess()

    { 

        #characters

        UserId                  userId = curUserId();

        container               tmpValues; 

        SecurityRole            securityRole;

        SecurityUserRole        securityUserRole;

        int                     idx;

        boolean                 isValidated = false;

        Str                     secRoleList;

        //Created new custom parameter to have which roles alone should have EDIT access, apart from this any roles would have only READ access even System admin

        secRoleList = SAN_IntegrationParameters::find().ParametersAccessSecurityRole;


        if(secRoleList)

        {

            tmpValues = str2con(secRoleList, #semicolon);


            for(idx=1; idx<=conLen(tmpValues); idx++)

            {

                securityRole.clear();

                select firstonly securityRole

                where securityRole.Name == conPeek(tmpValues, idx);


                if(securityRole.RecId && !isValidated)

                {

                    securityUserRole.clear();

                    select firstonly RecId from securityUserRole

                    where securityUserRole.User == userId

                        && securityUserRole.SecurityRole == securityRole.RecId;


                    if (securityUserRole.RecId)

                    {

                        isValidated = true;

                    }

                }

            }

        }


        return isValidated;

    }


    public void disableFormDataSources(FormRun _callingForm)

    {


        FormBuildDataSource frmBuildDS;

        int i;

        for(i = 1; i<= _callingForm.form().dataSourceCount(); i++)

        {

            frmBuildDS = _callingForm.form().dataSource(i);

            frmBuildDS.allowEdit(false);

        }


    }


    public boolean checkRoleCtrlAccess(FormRun _callingForm)

    {

        boolean userHasAccess = this.validateUserRoleAccess();


        if(!userHasAccess)

        {

            this.disableFormDataSources(_callingForm);

        }


        return userHasAccess;

    }


}



[ExtensionOf(formStr(LedgerParameters))]

final class LedgerParametersFrm_SAN_Extension

{

    public void init()

    {

        next init();


        SAN_ParamFormsAccessCtrl paramFormsAccessCtrl;

        paramFormsAccessCtrl = SAN_ParamFormsAccessCtrl::construct();


        if(!paramFormsAccessCtrl.checkRoleCtrlAccess(this))

        {

            this.san_lockControls();

        }

    }


    void san_lockControls()

    {

        FormBuildControl  formBuildControl;

        int i;


        for (i=1;i<=this.form().design().controlCount(); i++)

        {

            formBuildControl = this.form().design().controlNum(i);

            this.control(formBuildControl.id()).enabled(false);

        }

    }


}

Azure Function Apps

Content copied from AI. Azure Function Apps provide a serverless, event-driven compute service that lets you run code in languages like C#, ...