Thursday, May 16, 2024

Dynamics Community 101

Microsoft Dynamics 365 F&O


Dynamicscommunity101 best blog Atul

Dynamics Community 101 is a blog dedicated to share insights on Microsoft Dynamics 365 Finance and Operations, Microsoft Azure, and Microsoft Power Automate. Authored by Atul Yadav(Me), a Microsoft Dynamics 365 F&O Technical consultant, this blog offers in-depth articles, tutorials, and best practices to help professionals navigate the complexities of Microsoft platforms. From customization tips to integration, Dynamics Community 101 serves as a valuable resource for those looking to enhance their knowledge and skills. If you want to stay updated with the latest trends and advancements of Microsoft Technologies keep visiting Dynamics Community 101. So all in all Expert Insights on Dynamics 365 FO, Azure DevOps, LCS and Power Platform on Dynamics Community 101 by Atul Yadav.



What's new or changed in Microsoft Dynamics 365 F&O

To see what's new or changed in each and every release of Microsoft Dynamics 365 Finance, see. Link



What's new or changed in Platform updates of Microsoft Dynamics 365 F&O

As of February 19, 2024, the maximum number of consecutive updates that can be paused is being reduced from three to one. However, because release durations are being extended, the same minimum of two service updates per year is maintained.

To enable the new release cadence to be introduced with the first 2024 service update, some release milestones for 10.0.38 were adjusted. More



Copilot in Microsoft Dynamics 365 F&O

Copilot gives users access to AI capabilities that augment the application experiences and functionality of finance and operations apps. Copilot brings a growing set of skills that help users complete various tasks. It can appear in many different user experiences. More



Explore the ecosystem and main components of finance and operations apps

Explore the Dynamics 365 ecosystem. Here


Find Microsoft Dynamics 365 Partner

Access an industry-leading Microsoft partner ecosystem that offers expert guidance and support in buying, implementing, and optimizing your Dynamics 365 applications. More



Pricing for Microsoft Dynamics 365 F&O

Understanding the pricing structure of Microsoft Dynamics 365 licenses is crucial for organizations planning to implement this powerful ERP solution. Microsoft offers a flexible licensing model tailored to meet various business needs, ensuring scalability and cost-effectiveness. The licenses are available on a per-user, per-month basis, with different plans catering to diverse functionalities such as Finance, Supply Chain, and Human Resources. By selecting the appropriate license type, businesses can optimize their investment and leverage the full potential of Dynamics 365. More



Top blogs of Dynamics 365 FO and Azure

Daxdude


Dynamics365musings


TheAxapta


Goshoom


Kurthatlevik


Kishoredynamics11


Azureintegrations


Alexdmeyer


Fernitudela


Axtechsolutions


Dynamics365finop


Axraja


Axvigneshvaran


D365fokartik


Sheriffayed23


D365snippets

Like operator in Dynamics 365 F&O

Using the 'Like' and 'Not Like' Operators in Dynamics 365 F&O for Efficient Data Filtering


The `like` and `not like` operators in Dynamics 365 Finance and Operations provide powerful querying capabilities for pattern matching within data fields. The `like` operator allows for the selection of records that match a specified pattern, as demonstrated in the `LSSelectClaimRecordsWithIn` class, which retrieves claim records starting with "in". Conversely, the `not like` operator enables the exclusion of records matching a pattern, as shown in the `SelectClaimRecordsNotStartingWithIn` class, which selects claim records that do not start with "In". These operators are instrumental in filtering and retrieving relevant data from large datasets efficiently. Proper utilization of these operators can significantly enhance data querying and reporting capabilities within the ERP system.


Like operator :

class LSSelectClaimRecordsWithIn extends RunBase
{
    public static void main(Args _args)
    {
        SelectClaimRecordsWith obj = new SelectClaimRecordsWith();
        obj.run();
    }

    public void run()
    {
        ClaimTable claimTable;
        select * from claimTable
            where claimTable.ClaimNumber like 'in%';

        while (select * from claimTable
            where claimTable.ClaimNumber like 'in%')
        {
            info(strFmt("ClaimNumber: %1, ClaimDate: %2, ClaimAmount: %3", 
                        claimTable.ClaimNumber, 
                        claimTable.ClaimDate, 
                        claimTable.ClaimAmount));
        }
    }
}



Not Like operator :

class SelectClaimRecordsNotStartingWithIn extends RunBase
{
    public static void main(Args _args)
    {
        SelectClaimRecordsNotStartingWithIn obj = new SelectClaimRecordsNotStartingWithIn();
        obj.run();
    }

    public void run()
    {
        ClaimTable claimTable;
        select * from claimTable
            where !(claimTable.ClaimNumber like 'In%');

        while (select * from claimTable
            where !(claimTable.ClaimNumber like 'In%'))
        {
            info(strFmt("ClaimNumber: %1, ClaimDate: %2, ClaimAmount: %3", 
                        claimTable.ClaimNumber, 
                        claimTable.ClaimDate, 
                        claimTable.ClaimAmount));
        }
    }
}

Friday, April 19, 2024

SSMS query in VS

How to run SSMS query in Visual Studio for Dynamics 365 FO


1. Open Visual Studio on your dev server

Visual studio

2. click on view then select SQL server object explorer as shown below

Visual studio home

3. SQL server object explorer will be shown on the left side in Visual Studio as shown below, click on add SQL server

SQL server object explorer

4. A new window will open as shown below

Connect visual studio

5. Fill in the server name as shown below and click connect

Visual studio ssms

6. Now you will see your DB in Visual Studio, expand your AxDB as shown in the below picture, then right-click on DB and click on new query

Visual studio

7. A new query window will open

Visual studio SQL query editor

8. write your query and click on run

SSMS query editor

In this way we can connect our DB in Visual studio instead of SSMS

Tada!!




Tuesday, April 16, 2024

User Conditional Access

Block access by location with Microsoft Entra Conditional Access

Conditional access policy azure


Below are the key points for implementing location-based access controls using Microsoft Entra Conditional Access:

1. Purpose: Enhancing security by restricting access based on user location to prevent unauthorized access.

2. Mechanism: Utilizing Conditional Access policies that analyze signals from the user, their device, and their location to make automated decisions on access.

3. Application: This affects Dynamics 365 applications where access is denied if a user logs in from a blocked location.

4. Subscription Requirement: Available for users with Microsoft Entra ID P1 or P3 subscriptions.

5. Setup Requirements: Requires a federated Microsoft Entra ID tenant.

6. Policy Enforcement: Access restrictions are enforced during user authentication but allow access until session timeout, even if the user leaves the designated location.

7. Configuration Steps:
   - Create named locations. Define location
   - Establish Conditional Access policies. Create conditional access policy
   - Select relevant Microsoft applications under Cloud apps or actions for the policies.

8. License Requirement: Conditional Access settings are accessible with a Microsoft Entra ID Premium license.


Microsoft Reference:



Monday, April 8, 2024

Send Email

How to send email via X++ code D365 FO DynamicsCommunity101

How to send email via X++ code D365 FO

1. First step on How to send email via x++ code D365 FO, we will create a class and a static method in it as shown below


/// <summary>
/// Send mails
/// </summary>
class LSSendingMail
{
    /// <summary>
    /// Send EMail
    /// </summary>
    /// <param name = "_toEmailid">_toEmailid</param>
    /// <param name = "_template">_template</param>
    /// <param name = "_placeHolderMap">_placeHolderMap</param>
    public static void sendMail(LSEmailAddress _toEmailid, SysEmailSystemId _template , Map _placeHolderMap)
    {
        #define.language('en-us')
        SysOutgoingEmailTable   outGoingEmailTable;
        SysEmailSystemTable SysEmailSystemTable = SysEmailSystemTable::find(_template);
        SysEmailMessageSystemTable SysEmailMessageSystemTable = SysEmailMessageSystemTable::find(_template,#language);

        str messageBody = SysEmailMessageSystemTable.Mail;
        str subject = SysEmailMessageSystemTable.Subject;
      
        messageBody = SysEmailMessage::stringExpand(messageBody, _placeholderMap);
        subject     = SysEmailMessage::stringExpand(subject, _placeholderMap);
        
        outgoingEmailTable.EmailItemId                  = EventInbox::nextEventId();
        outgoingEmailTable.TemplateId                   = _template;
        outgoingEmailTable.Sender                       = SysEmailSystemTable.SenderAddr;
        outgoingEmailTable.SenderName                   = SysEmailSystemTable.SenderName;
        outgoingEmailTable.Recipient                    = _toemailid;
        outgoingEmailTable.Subject                      = subject;
        outgoingEmailTable.Message                      = messageBody;
        outgoingEmailTable.Priority                     = SysEmailSystemTable.Priority;
        outgoingEmailTable.WithRetries                  = true;
        outgoingEmailTable.RetryNum                     = 0;
        outgoingEmailTable.UserId                       = curuserid();
        outgoingEmailTable.Status                       = SysEmailStatus::Unsent;
        outgoingEmailTable.LatestStatusChangeDateTime   = DateTimeUtil::getSystemDateTime();
        outgoingEmailTable.insert();

    }

    /// <summary>
    /// Send email attachment
    /// </summary>
    /// <param name = "_toEmailid">_toEmailid</param>
    /// <param name = "_template">_template</param>
    /// <param name = "_placeHolderMap">_placeHolderMap</param>
    /// <param name = "docuRef">docuRef</param>
    /// <param name = "_fileType">_fileType</param>
    /// <returns>boolean</returns>
    public static boolean sendMailwithAttachment(LSEmailAddress _toEmailid, SysEmailSystemId _template , Map _placeHolderMap,DocuRef docuRef, Str _fileType = 'application/pdf')
    {
        boolean messageSent;
        #define.SMTP('SMTP')
        Map sysMailers = SysMailerFactory::getMailers();
        SysEmailSystemTable SysEmailSystemTable = SysEmailSystemTable::find(_template);
        SysEmailMessageSystemTable SysEmailMessageSystemTable = SysEmailMessageSystemTable::find(_template,SysEmailSystemTable.DefaultLanguage);

        str messageBody = SysEmailMessageSystemTable.Mail;
        str subject     = SysEmailMessageSystemTable.Subject;

        var messageBuilder = new SysMailerMessageBuilder();

        messageBuilder.addTo(_toEmailid);
        messageBuilder.setSubject(SysEmailMessage::stringExpand(subject, _placeholderMap));
        messageBuilder.setBody(SysEmailMessage::stringExpand(messageBody, _placeholderMap));
        messageBuilder.setFrom(SysEmailSystemTable.SenderAddr);

        //var message = messageBuilder.getMessage();

        messageBuilder.addAttachment(DocumentManagement ::getAttachmentStream(docuRef),docuRef.Name + '.pdf',_fileType);
        SysIMailer mailer;
        mailer = sysMailers.lookup(#SMTP);

        SysIMailerNonInteractive nonInteractiveMailer = mailer;
        messageSent = nonInteractiveMailer.sendNonInteractive(messageBuilder.getMessage());

        return messageSent;
    
    }

}


2. Now to show you the example of how to send email via x++ code D365 FO, we will create a runnable class

internal final class TestAY
{
    /// <summary>
    /// Class entry point. The system will call this method when a designated menu 
    /// is selected when execution starts and this class is set as the startup class.
    /// </summary>
    /// <param name = "_args">The specified arguments.</param>
    public static void main(Args _args)
    {
        #define.User('User')

        Map placeHolderMap = new Map(Types::String, Types::String);
        placeHolderMap.insert(#User, "Atul");
        LSSendingMail::sendMail('atul.yadav@lifestyles.com', 'Safety Cal', placeHolderMap);
    }
}

3. Now for 3rd step on How to send email via X++ code D365 FO, for the above code to run you need to set up an email template named "Safety Cal"

1. Go to System email templates 

Path system email template

2. You will see a form like below

email template form

3. Now click on new and create a new template as shown below

New system email template

4. I am filling as below

Filled system email template

5. Once created click on the email message as shown below

Email message button in system email template

6. once you click, you will see a new form like below

Final uploaded email template



7. Here we need to upload the HTML format of our email, I have already attached mine

My HTML sample below

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Safety Calendar Reminder</title>
</head>
<body>
    <p>Dear %user%,</p>
    <br>
    <p>A gentle reminder to promptly complete your Safety Calendar entries, due by the end of this week. Your timely contribution is vital for our collective safety and compliance.</p>
    <p>For assistance or queries, please contact us.</p>
    <br>
    <p>Best regards,</p>
    <p>Microsoft Dynamics 365</p>
</body>
</html>


4. Now for the last step on How to send email via X++ code D365 FO, you need to run an Email distributor batch, the path shown below

Email distributor batch


Now just run the runnable class that we created in Step 2




Above is the code on How to send email via X++ code D365 FO by DynamicsCommunity101

Year End Close Procedure

D365 Finance and Operations - Year End Close Procedure on DynamicsCommunity101

Wednesday, April 3, 2024

Power Platform to assign licenses

Assign Licenses with Intelligent Recommendations in Power Platform - Public Preview | DynamicsCommunity101


Power platform admin homepage
Click on the picture for the full blog


Monday, March 25, 2024

Send data into D365 FO to call recurring integration via logic apps

Send data into Dynamics 365 FO to call recurring integration via logic apps


1. Register an app in Azure: How to register Azure App for Dynamics 365 FO - Learn from Dynamicscommunity101

This step involves creating a new application registration in the Azure portal. This is a preliminary step required to authenticate and authorize your application to interact with Dynamics 365 Finance & Operations. By registering the app, you obtain an Application ID and a Directory (tenant) ID that is used in subsequent steps to grant access and establish a secure connection.


2. Give access to the Azure app in Dynamics 365: How to add Azure app ref in Dynamics 365 FO - Learn from Dynamicscommunity101

After registering your app in Azure, you need to add the Azure app reference within your Dynamics 365 F&O environment. This involves configuring Dynamics 365 F&O to recognize and authorize the Azure app, typically by specifying the Application ID and setting the necessary permissions, thus allowing the Azure app to interact with Dynamics 365 data and services.


3. Now let's go to the Azure portal: Azure portal - To learn further from Dynamicscommunity101

Navigate to the Azure portal to manage app services and configurations, including the setup for the Logic app. Begin by reviewing the Logic app's architecture, then create a Logic app with a "Recurrence" trigger for automatic execution at set intervals. Compose a JSON message for a Dynamics 365 data entity, configure an HTTP trigger for token acquisition, and parse the received JSON to process data. Finally, use an HTTP action to send the structured data to Dynamics 365 F&O, completing the integration flow.


Before starting with the Logic app, below is an overview of the whole Logic app that we created in our blog of Dynamicscommunity101

Logic App Overview Screenshot


Create a logic app with the trigger as Recurrence. You may choose as per your requirements.

Logic App Trigger

Now create a JSON to be sent to the respective Dynamics 365 data entity. In my case, it is a custom data entity.

Logic App Compose

Now we will hit the Microsoft URL to get the access token as shown below.

Logic App HTTP trigger


Now the output of the above action will be parsed using the Parse JSON action as shown below.

Logic App parse JSON


Now we will send the data to Dynamics 365 using HTTP action as shown below.

Sunday, March 24, 2024

Azure app reference in D365 FO

In this blog of DynamicsCommunity101 we will learn How to add Azure app reference in Dynamics 365 FO


Microsoft entra id application form


1. Go to your Dynamics 365 FO

Dynamcis 365 home page

2. Now go to System Administration module > Setup > Microsoft Entra ID applications as shown below

Path for Microsoft Entra ID application

3. A new form will open as shown below

Microsoft entra ID application form final

4. Now add in the client ID for the application, the name of the Microsoft Entra ID applications, and User Id under which you want to give access to this application.


Upload SSRS to blob storage

In this blog of DynamicsCommunity101 we will learn how to generate SSRS reports via code and upload them to blob storage

InventParameters    InventParametersLocal;

        select firstonly InventParametersLocal;


        if(InventParametersLocal.LSAttachmentsToAzureBlobStorage)

        {

            InventJournalTable  inventJournalTableLocal;

            select firstonly inventJournalTableLocal

                where inventJournalTableLocal.RecId == _recId;

            if(inventJournalTableLocal.WorkflowApprovalStatus == InventJournalWorkflowApprovalStatus::Submitted)

            {

                LSInventJournalTransPAContract          poContract;

                LSInventJournalTransPAController        controller  = new LSInventJournalTransPAController();

                SRSPrintDestinationSettings             settings;

                Filename                                fileName    = "Movement Journal Lines - " + inventJournalTableLocal.JournalId + ".pdf";

                controller.parmReportName(ssrsReportStr(LSInventJournalTransPA, Report));

                controller.parmShowDialog(false);

                controller.parmLoadFromSysLastValue(false);

    

                poContract          = controller.parmReportContract().parmRdpContract();

                poContract.parmInventJournalId(inventJournalTableLocal.JournalId);

        

                System.Byte[] reportBytes = new System.Byte[0]();

                SRSProxy srsProxy;

                SRSReportRunService srsReportRunService = new SrsReportRunService();

                Microsoft.Dynamics.AX.Framework.Reporting.Shared.ReportingService.ParameterValue[] parameterValueArray;

                Map reportParametersMap;

                SRSReportExecutionInfo executionInfo = new SRSReportExecutionInfo();

                ;

                controller.parmReportName(ssrsReportStr(LSInventJournalTransPA, Report));

                controller.parmShowDialog(false);

                controller.parmLoadFromSysLastValue(false);

                controller.parmReportContract().parmRdpContract(poContract);

                settings = controller.parmReportContract().parmPrintSettings();

                settings.printMediumType(SRSPrintMediumType::File);

                settings.fileName(fileName);

                settings.fileFormat(SRSReportFileFormat::PDF);


                controller.parmReportContract().parmReportServerConfig(SRSConfiguration::getDefaultServerConfiguration());

                controller.parmReportContract().parmReportExecutionInfo(executionInfo);


                srsReportRunService.getReportDataContract(controller.parmreportcontract().parmReportName());

                srsReportRunService.preRunReport(controller.parmreportcontract());

                reportParametersMap = srsReportRunService.createParamMapFromContract(controller.parmReportContract());

                parameterValueArray = SrsReportRunUtil::getParameterValueArray(reportParametersMap);

                srsProxy            = SRSProxy::constructWithConfiguration(controller.parmReportContract().parmReportServerConfig());


                reportBytes         = srsproxy.renderReportToByteArray(controller.parmreportcontract().parmreportpath(),parameterValueArray,settings.fileFormat(),settings.deviceinfo());


                if (reportBytes)

                {

                    System.IO.MemoryStream stream = new System.IO.MemoryStream(reportBytes);

                    str fileContentType = System.Web.MimeMapping::GetMimeMapping(fileName);

                    #define.dotpdf('.pdf')

                    #define.Underscore('_')

                    //StorageCredentials storageCredentials = new StorageCredentials("d365prodattachments", "+ZD2KZ/TtqjzDu/Lrvotjus3KZAhDnJqluEIpDzwcagkMY5Y3IR77M8u6pYoN9f/8bHJA1tg4mE4+AStevsK/Q==");

                    StorageCredentials storageCredentials = new StorageCredentials(InventParametersLocal.LSBlobStorageName, InventParametersLocal.LSBlobStorageConnectionString);

                    CloudStorageAccount storageAccount = new CloudStorageAccount(storageCredentials, true);

                    CloudBlobClient blobClient = storageAccount.CreateCloudBlobClient();

                    //CloudBlobContainer cont = blobClient.GetContainerReference("d365/FR40/MovementJournal");

                    //str path = 

                    CloudBlobContainer cont = blobClient.GetContainerReference(InventParametersLocal.LSBlobStoragePath + '/' +inventJournalTableLocal.JournalId);

                    CloudBlockBlob cloudBlockBlob = cont.GetBlockBlobReference(fileName);

                    cloudBlockBlob.UploadFromStream(stream, null, null, null);

                }

            }

        }


Thank you. This code of Dynamicscommunity101 is related to generate SSRS report and upload to blob storage

Friday, March 22, 2024

Rev D365FO dev experience by Dynamicscommunity101

In this blog of DynamicsCommunity101 we will learn how to Revolutionize your D365FO development experience by Dynamicscommunity101

Revolutionize your D365FO development experience

How to disable system defined buttons in standard form of d365 by Dynamicscommunity101

In this blog of DynamicsCommunity101 we will learn How to disable system-defined buttons in standard form of d365

How to disable system defined buttons in standard form of d365

How To Use Regression suite automation tool (RSAT) For Microsoft Dynamics 365 Finance and Operations

How To Use Regression suite automation tool (RSAT) For Microsoft Dynamics 365 Finance and Operations


Microsoft Link

Button Click COC standard form

In this blog of DynamicsCommunity101 we will learn Dynamics 365 FO COC for Button Click in standard form

COC for button click in standard form in Dynamics 365 FO

[ExtensionOf(FormControlStr(SalesTableListPage, NotForMRP))]

final class LSSalesTableListpage_NotForMRP_Extension

{

    public void clicked()

    {

        FormControl     formButtonControl = any2Object(this) as FormControl;

        FormDataSource  salesTable_ds = formButtonControl.formRun().dataSource(tableStr(SalesTable));

        SalesTable      salesTable = salesTable_ds.cursor(),salesTableUpdate;

        SalesLine       SalesLineLocal;

        CustParameters  CustParametersLocal = CustParameters::find();

        TransDate       LSRequestedShipDateLocal,LSRequestedReceiptDateLocal;

        boolean ret = false;

        try

        {

            ttsbegin;

            if(salesTable.LSNotForMRP == NoYes::No)

            {

                select forupdate salesTableUpdate

                    where salesTableUpdate.RecId == salesTable.RecId;

                salesTableUpdate.LSNotForMRP = NoYes::Yes;

                ttsbegin;

                salesTableUpdate.update();

                ttscommit;

                while select forupdate SalesLineLocal

                    where SalesLineLocal.SalesId == salesTable.SalesId

                {

                    LSRequestedShipDateLocal              = SalesLineLocal.ShippingDateRequested;

                    LSRequestedReceiptDateLocal           = SalesLineLocal.ReceiptDateRequested;


                    SalesLineLocal.LSRequestedShipDate    = LSRequestedShipDateLocal;

                    SalesLineLocal.LSRequestedReceiptDate = LSRequestedReceiptDateLocal;

                    SalesLineLocal.ShippingDateRequested  = CustParametersLocal.LSMRPDate;

                    SalesLineLocal.ReceiptDateRequested   = CustParametersLocal.LSMRPDate;

                    ttsbegin;

                    SalesLineLocal.update();

                    ttscommit;

                }

                info("@LS_HISOL_AY:NotForMRP");

            }

            else

            {

                select forupdate salesTableUpdate

                    where salesTableUpdate.RecId == salesTable.RecId;

                salesTableUpdate.LSNotForMRP = NoYes::No;

                ttsbegin;

                salesTableUpdate.update();

                ttscommit;

                while select forupdate SalesLineLocal

                    where SalesLineLocal.SalesId == salesTable.SalesId

                {

                    LSRequestedShipDateLocal    = SalesLineLocal.LSRequestedShipDate;

                    LSRequestedReceiptDateLocal = SalesLineLocal.LSRequestedReceiptDate;

                    

                    SalesLineLocal.ShippingDateRequested  = LSRequestedShipDateLocal;

                    SalesLineLocal.ReceiptDateRequested   = LSRequestedReceiptDateLocal;

                    SalesLineLocal.LSRequestedShipDate    = CustParametersLocal.LSMRPDate;

                    SalesLineLocal.LSRequestedReceiptDate = CustParametersLocal.LSMRPDate;

                    ttsbegin;

                    SalesLineLocal.update();

                    ttscommit;

                }

                info("@LS_HISOL_AY:ForMRP");

            }

            ttscommit;

        }

        catch

        {

            System.Exception ex = CLRInterop::getLastException();

            error(ex.Message);

        }

        salesTable_ds.reread();


        next clicked();


    }


}


D365 FO Database Explained

Main DB Explained on Dynamicscommunity101


Microsoft Dynamics 365 Finance and Operations Database Explained

Monday, March 18, 2024

Saturday, March 16, 2024

Contract methods

Difference between PrePromptModifyContract and PreRunModifyContract

Now to understand difference between PrePromptModifyContract and PreRunModifyContract in Dynamics 365, we will provide different points for both as shown below

PrePromptModifyContract:

1. Purpose: This method is used to modify the contract class before the report dialog (prompt) is shown to the user. It allows for altering the parameters or setup of the report before the user interacts with the prompt.

2. Timing: It is invoked after the contract class has been initialized but before the report parameter dialog is rendered.

3. Customization: Enables customization of the report's parameters, such as setting default values, hiding certain parameters, or modifying parameter options based on specific logic.

4. Use Case: Particularly useful for dynamically adjusting the report parameters based on the context of the report's execution, such as pre-filtering options or changing visibility of parameters.

5. Scope: Affects only the presentation and options of the parameter dialog; it does not directly influence the report's execution logic.


PreRunModifyContract:

1. Purpose: This method is used to modify the contract class after the user has filled in the parameters but before the report is run. It allows for last-minute adjustments to the contract based on user input.

2. Timing: It is executed right before the report is generated after the user has submitted the parameter dialog.

3. Customization: Provides a chance to adjust or validate the report parameters or to change the report's behavior based on the final user input.

4. Use Case: Ideal for applying business logic that needs to consider user inputs, such as validating parameter combinations or modifying the data query based on the selected parameters.

5. Scope: Directly impacts how the report runs and processes data, allowing for dynamic adjustments to the reporting logic based on user-selected parameters.


SSRS report for current record

SSRS report in Dynamics 365 FO to get the current record from the form and run for it


Contract class:

[DataContractAttribute]
class LS_SafteyCalendarReportContract
{
    str ID;

    [DataMemberAttribute('ID')]
    public str parmID(str _ID = ID)
    {
        ID = _ID;
        return ID;
    }

}




Controller class:

class LS_SafteyCalendarReportController extends SrsReportRunController
{
    public static LS_SafteyCalendarReportController construct()
    {
        return new LS_SafteyCalendarReportController();
    }

    public static void main(Args args)
    {
        LS_SafteyCalendarReportController controller = LS_SafteyCalendarReportController::construct();

        controller.parmArgs(args);
        controller.parmReportName(ssrsReportStr(LS_SafteyCalendarReport, Report));
        controller.parmShowDialog(false);
        controller.startOperation();
    }

    protected void prePromptModifyContract()
    {
        LS_SafetyCalendarHeader         LS_SafetyCalendarHeaderLocal;
        LS_SafteyCalendarReportContract contract;
        FormDataSource                  fds;
        contract = this.parmReportContract().parmRdpContract() as LS_SafteyCalendarReportContract;
        fds = args.record().dataSource();
        LS_SafetyCalendarHeaderLocal = args.record();
        contract.parmID(LS_SafetyCalendarHeaderLocal.IDD);
    }

}




DP Class:

[SRSReportParameterAttribute(classStr(LS_SafteyCalendarReportContract))]
class LS_SafteyCalendarReportDP extends SRSReportDataProviderBase
{
    LS_SafteyCalendarTmp reportTmp;

    [SRSReportDataSetAttribute(tableStr(LS_SafteyCalendarTmp))]
    public LS_SafteyCalendarTmp getTmp()
    {
        select reportTmp;
        return reportTmp;
    }

    public void processReport()
    {
        LS_SafteyCalendarReportContract contract = this.parmDataContract() as LS_SafteyCalendarReportContract;
        
        LS_SafetyCalendarHeader LS_SafetyCalendarHeaderLocal;
        
        anytype x = contract.parmID();
        
        select firstonly LS_SafetyCalendarHeaderLocal
            where LS_SafetyCalendarHeaderLocal.IDD == contract.parmID();
        
        reportTmp.clear();
        reportTmp.EmployeeName = HcmWorker::find(LS_SafetyCalendarHeaderLocal.HcmWorkerRecId).name();
        reportTmp.insert();
    }

}


Just create a report, put that report in an output menu item, and apply that menu item to the relevant form


D365 to Dataverse

How to Connect Dynamics 365 with a new Microsoft Dataverse Instance

LCS to Dataverse

Prerequisites:

A. Make sure The Power Platform environment geography is the same logical geography where your finance and operations apps are deployed.

B. You must have System Administrator permissions in Dataverse.

C. You must have an Environment Manager or Project Owner role in Lifecycle Services.

D. You must be signed in by using an account from the customer tenant that owns the Lifecycle Services project.

E. A valid Dynamics 365 Finance, Dynamics 365 Supply Chain Management, Dynamics 365 Commerce, Dynamics 365 Project Operations, Dynamics 365 Human Resources, Dynamics 365 Unified Operations Plan, or AX Enterprise license must be assigned to your account.


1. Setup on the Power Platform Integration tab

    Go to LCS, go to your environment, and select the Power Platform Integration FastTab. If the Setup button is available on it, you can configure your connection to Dataverse. [How to open an environment in LCS]

LCS environment page

a new pop-up will come as shown below

Conversion menu

Click on the template field and you will see 3 lookup values as shown below, choose according to your requirement (In my case I selected Dynamics 365 standard)

Three types

2. Confirm that you want to proceed.

A dialog box appears and indicates that the action can't be reversed. You will be asked to put in your name, then the confirm button will be enabled.

PPAC warning

Wait for some time for the provisioning to be completed

Deploying screen

Mostly after 15 minutes, it will be completed

Completed LCS screen

Once provisioning the power platform is done, you can check the Environment in PPAC

How to open the PPAC environment for Dynamics 365

Tada!!

Please note: 

Because you're using an existing Dataverse instance and linking with the finance and operations apps environment, you must remember the disconnected Power Platform environment that was created when the finance and operations environment was created isn't deleted. You'll need to manually delete the disconnected Power Platform environment.

If you plan to keep the Power Platform environment, note that there isn't a Dataverse instance on it, and you can't use Dataverse capabilities and features such as the Export to Data Lake add-in, dual-write, and virtual tables.

Microsoft reference

PPAC

Connect finance and operations apps with a new Microsoft Dataverse instance

Check user with spec role

How to check if the current user has a specific role or not via X++ in Dynamics 365

To check if the current user has a specific role we will write following code in the appropriate place as per the requirement

UserInfo                  userInfo;

SecurityUserRole    securityUserRole;

SecurityRole            Roles;

boolean                    allowed;


select id from userInfo

        join SecurityRole from securityUserRole

            where securityUserRole.User == userInfo.Id

        join Roles where Roles.RecId  == securityUserRole.SecurityRole

            && (Roles.AotName =='ROLENAME')

            && UserInfo.id == curUserId();

if(UserInfo.id == curUserId())

{

    Allowed = true;

}

Master planning in Dynamics 365 FO

Master planning in Dynamics 365 FO

Configure workspace in Visual Studio when the working folders are already mapped

Configure workspace in Visual Studio when the working folders are already mapped

PPAC environment for D365

In this blog of DynamicsCommunity101 we will learn How to open the PPAC environment for Dynamics 365

Go to PPAC, You will see as shown below

PPAC home

Click on Environments in the left side panel as shown below

PPAC environment section highlight

A new screen will open showing all the environments, it will also show the Dynamics 365 environments that you have created in LCS

PPAC environment

Click on the environment name that you would like to open, it will show the details of that environment

PPAC environment details

Open environment in LCS

In this blog of DynamicsCommunity101 we will learn How to open any environment in LCS Dynamics 365 FO


LCS sign in page

Go to LCS

click on Sign in, sign in with your credentials

Now you will see the LCS home page as shown below

LCS home page

Left side you will see the project, click on it, and you will see a window as shown below

Environment list page

Now on the right side, you can see the Production and Default Sandbox and Add-on T2 environments, click on Full details and you will see the details of that environment.

Environment detail page

Thursday, March 14, 2024

Connect D365 to Dataverse

In this blog of Dynamics Community 101 we will learn about How to Connect Dynamics 365 FO with an existing Microsoft Dataverse instance


LCS to PPAC

Prerequisites:

A. Make sure The Power Platform environment geography must be the same logical geography where your finance and operations apps are deployed.

B. You must have System Administrator permissions in Dataverse.

C. You must have an Environment Manager or Project Owner role in Lifecycle Services.

D. You must be signed in by using an account from the customer tenant that owns the Lifecycle Services project.

E. A valid Dynamics 365 Finance, Dynamics 365 Supply Chain Management, Dynamics 365 Commerce, Dynamics 365 Project Operations, Dynamics 365 Human Resources, Dynamics 365 Unified Operations Plan, or AX Enterprise license must be assigned to your account.

1. Setup on the Power Platform Integration tab

    Go to LCS, go to your environment, and select the Power Platform Integration FastTab. If the Setup button is available on it, you can configure your connection to Dataverse. [How to open an environment in LCS]

LCS environment detail page

a new pop-up will come as shown below

PPAC confirmation page

tick the button, then a new field will come for environment ID as shown below

PPAC confirmation yes dialog

Environment ID for PPAC can be taken from this Link

2. Confirm that you want to proceed.

A dialog box appears and indicates that the action can't be reversed. You will be asked to put in your name, then confirm button will be enabled.

PPAC confirmation user name dialog box

Wait for some time for the provisioning to be completed

Deploying page

Mostly after 15 minutes, it will be completed

Deployed page lcs

Once provisioning the power platform is done, you can check the Environment in PPAC

How to open PPAC environment for Dynamcis 365

Tada!!

Please note: 

Because you're using an existing Dataverse instance and linking with the finance and operations apps environment, you must remember the disconnected Power Platform environment that was created when the finance and operations environment was created isn't deleted. You'll need to manually delete the disconnected Power Platform environment.

If you plan to keep the Power Platform environment, note that there isn't a Dataverse instance on it, and you can't use Dataverse capabilities and features such as the Export to Data Lake add-in, dual-write, and virtual tables.

Microsoft reference

PPAC

Connect finance and operations apps with an existing Microsoft Dataverse instance