Shahbaz Khan, Author at Impulz Technologies LLC https://impulztech.com/author/shahbaz-khan/ Microsoft Dynamics and Power Platform consulting company Wed, 29 Nov 2023 11:52:01 +0000 en-US hourly 1 https://wordpress.org/?v=6.5.3 https://impulztech.com/wp-content/uploads/2022/08/cropped-impulz-tech-32x32.png Shahbaz Khan, Author at Impulz Technologies LLC https://impulztech.com/author/shahbaz-khan/ 32 32 Dynamics 365 Finance and Supply Chain: Implement budget check via custom logic https://impulztech.com/d365-finance-and-supply-chain-implement-custom-budget-check/ Wed, 29 Nov 2023 11:52:01 +0000 https://impulztech.com/?p=3529 Budgeting is a crucial process for any business, as it helps to plan out expenses. Budgeting helps in reaching business goals, in addition to anticipating operational changes. Without a budget, a business may experience overspending and underperformance, which could ultimately lead to the company’s closure. In this blog post, we will show you how to […]

The post Dynamics 365 Finance and Supply Chain: Implement budget check via custom logic appeared first on Impulz Technologies LLC.

]]>

Budgeting is a crucial process for any business, as it helps to plan out expenses. Budgeting helps in reaching business goals, in addition to anticipating operational changes. Without a budget, a business may experience overspending and underperformance, which could ultimately lead to the company’s closure. In this blog post, we will show you how to implement custom budget check in D365 Finance and Supply Chain using the logic of Actual vs Budget Report.

 

There is a standard report in D365 Finance and Supply Chain which shows the amount of budget allotted vs the amount of budget spent against an account. Users can use this report to see at multiple drill downed levels along with budget model. By using the main logic in this report, you can implement custom budget check in D365 on any out of the box process.

What is Actual vs Budget Report in D365?

D365 Actual vs Budget Report is a standard report that shows the difference between the budgeted and actual amounts for a financial account.  The user can access it from the Budgeting module, under Reports > Budget Reports > Actual vs Budget Report. You can also filter out or drill down to see the details of each transaction that contributes to the budget or actual amount. Alternatively, you can export the report to Excel or PDF format, or print it for further analysis

How to use Actual vs Budget Report’s logic for implementing budget check?

You need to understand the logic behind the report and the views that are used to calculate the data to use Actual vs Budget Report for budget check. Microsoft uses two main views for the calculating data for this report, which are PSNBudgetAnalysisBudgetView and PSNBudgetAnalysisActualView. One view shows the amount of budget allotted and one shows the actual spent amount. We will need a main account and a budget model ID against which the amounts will be calculated to find out the current value of budget amount from these views.

Use the following queries to get the amount of allotted and actual budget amounts from both of the views:

  • To get the allotted budget amount, use this query:

select sum(AccountingCurrencyAmount) from psnBudgetAnalysisBudgetView

where psnBudgetAnalysisBudgetView.MainAccountId == “MainAccountId”

&& psnBudgetAnalysisBudgetView.BudgetModelId == “BudgetModelId”

  • To get the actual budget amount spent, use this query:

select sum(ReportingCurrencyAmount) from psnNBudgetAnalysisActualView

where psnNBudgetAnalysisActualView.MainAccountId == “MainAccountId”

availableBudgetAmount = psnBudgetAnalysisBudgetView.AccountingCurrencyAmount – psnNBudgetAnalysisActualView.ReportingCurrencyAmount;

By taking the difference from both sum values  we will get current budget amount available for the mainAccountId.

Note:

If calculation needs to be against a specific financial dimension then add condition on the DisplayValue column in both views.

The post Dynamics 365 Finance and Supply Chain: Implement budget check via custom logic appeared first on Impulz Technologies LLC.

]]>
Microsoft Dynamics 365 Finance and Operations: Customization of non-extendable code https://impulztech.com/microsoft-dynamics-365-finance-and-operations-customization-of-non-extendable-code/ Tue, 18 Oct 2022 14:53:19 +0000 https://impulztech.com/?p=2736 In Dynamics 365 Finance and Operations customization in standard objects is done through extension-based development. But there are some scenarios where a class method which needs to be customized through CoC (Chain of Command) is having Hookable attribute set as False. In that case you cannot create a CoC of that method. For example, there […]

The post Microsoft Dynamics 365 Finance and Operations: Customization of non-extendable code appeared first on Impulz Technologies LLC.

]]>

In Dynamics 365 Finance and Operations customization in standard objects is done through extension-based development. But there are some scenarios where a class method which needs to be customized through CoC (Chain of Command) is having Hookable attribute set as False. In that case you cannot create a CoC of that method.

For example, there is a class with a run method’s Hookable property set as false.

Public class CredManCreditLimitAdjGenerate extends RunBase
{
    [Hookable(false)]
    public void run()
    {
        if (!this.validate())
        {
            throw error("@SYS18447");
        }
    if (deleteExistingLines && CredManCreditLimitAdjTrans::exist(journalId))
        {
            CredManCreditLimitAdjTrans::deleteAllJournalLines(journalId);
        }
    this.processQueryRun();
    }
}

In this scenario the requirement is to execute some logic after this class’s run method execution is done. If it was a Hookable[true] method then you can simply create an extension of the class CredManCreditLimitAdjGenerate, create a CoC of run() and perform your new logic after the next call of run method. But in this case, you cannot do so.

In order to achieve this requirement technically you just create a new class CredManCreditLimitAdjGenerate_Impulz and set it as a child of CredManCreditLimitAdjGenerate class. Then override run() and include all the parent code with your required logic in it. Below is the code:

Public class CredManCreditLimitAdjGenerate_Impulz extends CredManCreditLimitAdjGenerate
{
    [Hookable(false)]
    public void run()
    {
        if (!this.validate())
        {
            throw error("@SYS18447");
        }
        if (deleteExistingLines && CredManCreditLimitAdjTrans::exist(journalId))
        {
            CredManCreditLimitAdjTrans::deleteAllJournalLines(journalId);
        }
        this.processQueryRun();

        //Write your required new logic here
    }
}

The additional thing you have to do is to change the reference of the original class to your new class by initializing its object or if the class is called from a menu item/button, then simply hide the menu item/button and add a new one with you new class reference.

Using the above approach you can also completely remove the standard run method logic and just add new logic which cannot be possible in case of CoC as you do have to call next() before or after new logic unless the method has the attribute Replaceable[true]. Replaceable[True] allows to skip next call in the extended method.

Note: If the class is private or internal or final then it cannot be extended so in that case you have to entirely copy the class with new name and change the reference in code.

The post Microsoft Dynamics 365 Finance and Operations: Customization of non-extendable code appeared first on Impulz Technologies LLC.

]]>
Microsoft Power Apps: Code debugging in Model-driven App https://impulztech.com/microsoft-power-apps-code-debugging-in-model-driven-app/ Tue, 27 Sep 2022 15:37:18 +0000 https://impulztech.com/?p=2702 Debugging is an essential part of software development. As Microsoft Power Apps is a low code no code approach still sometimes there is need of small JavaScript code snippets for particular events e.g. onChange in Model-driven apps. In order to debug the code snippet in your deployed power app you can follow the following steps. […]

The post Microsoft Power Apps: Code debugging in Model-driven App appeared first on Impulz Technologies LLC.

]]>

Debugging is an essential part of software development. As Microsoft Power Apps is a low code no code approach still sometimes there is need of small JavaScript code snippets for particular events e.g. onChange in Model-driven apps.

In order to debug the code snippet in your deployed power app you can follow the following steps.

  1. In the code snippet add debugger keyword in the code where you want to place your debugging point.
  2. After reuploading the updated snippet start your app on Google chrome browser and press F12 to open developer tools.
  3. When you trigger the event for which the code was written debug point will hit and from there you can debug your JavaScript code embedded in your power app. Use F10 to move to next line and F11 to step into the next function.

Hope you have found it helpful. Cheers.

The post Microsoft Power Apps: Code debugging in Model-driven App appeared first on Impulz Technologies LLC.

]]>
Model-Driven Apps – Update field based on other field value using OnChange event https://impulztech.com/model-driven-apps-update-field-based-on-other-field-value-using-onchange-event/ Tue, 13 Sep 2022 17:10:30 +0000 https://impulztech.com/?p=2673 As Power Apps (Model-Driven Apps) developers, often we face this scenario of triggering a change of value in one field when a value in another field is modified. In this blog we are going to see how to apply OnChange event in a model driven app field to trigger values in another field. First of […]

The post Model-Driven Apps – Update field based on other field value using OnChange event appeared first on Impulz Technologies LLC.

]]>

As Power Apps (Model-Driven Apps) developers, often we face this scenario of triggering a change of value in one field when a value in another field is modified. In this blog we are going to see how to apply OnChange event in a model driven app field to trigger values in another field.

  1. First of all, create a solution and in that solution create a table or add any existing table (here I have created a new table named TestOnChange). Then go to the table and select form options.

2. In Forms option there are multiple form designs but for our case we will use the main one which is usually used for create new records or edit record.

3. Edit the form and you will be on the following screen. From the right-side panel select event tabs and click on Add Library.

4. This will let you include already added JavaScript file which contains the OnChange event code or you can add a new one. In our case we will add a new file in which the logic is written.
Note: You can also add this file under web resources of your solutions before adding from this dialog.

 

 

5. The code in the JavaScript file is below where getAttribute refers to the logical name of the field.

Note: To check the logical name of the field you can go to the following tab.

6. After adding the file you will see OnChange option on the event tab. Select the field first on which you will apply the event and click on Event Handler.

7. Set the following properties. Function is the name of the function defined in the JavaScript file which will be called on OnChange event.

8. Once done select the table field which will trigger this OnChange event.

9. Once all steps are done just save and publish your app. Now whenever the Name values is changed the OnChange trigger will update the value in FirstName field as defined the JavaScript function.

The post Model-Driven Apps – Update field based on other field value using OnChange event appeared first on Impulz Technologies LLC.

]]>
Implement XDS in Microsoft Dynamics 365 Finance and Operations https://impulztech.com/implementing-xds-in-microsoft-dynamics-365-finance-and-operations/ Wed, 17 Aug 2022 06:43:12 +0000 https://impulztech.com/?p=2607 In this example wewill get to know how to implement XDS policy in Dynamics 365 Finance and Operations. XDS Policy XDS policy is basically a data security in Dynamics 365 which enables to show only specific data from a specific set of users that has particular role assigned to them. Lets get into the steps […]

The post Implement XDS in Microsoft Dynamics 365 Finance and Operations appeared first on Impulz Technologies LLC.

]]>

In this example wewill get to know how to implement XDS policy in Dynamics 365 Finance and Operations.

XDS Policy
XDS policy is basically a data security in Dynamics 365 which enables to show only specific data from a specific set of users that has particular role assigned to them.

Lets get into the steps to enable XDS on a table LMS_BookDetails in which data related to only those books which has status set to Available will be visible to the user.

  1. Create a query consist of the table LMS_BookDetails on which we want to apply xds.

  1. Add required data source i.e. LMS_BookDetails in the query and then apply ranges on it.

  1. This is an optional step. If you want to confirm that query is filtering data according to requirement, just create a demo view and add that query in the view. Build your project and sync database. Open the view in table browser to verify if its showing filtered data then it means it will work on xds as well. If the view does not show the desired records, go back and fix your query.
  2. After creating the query create a security policy. Go to properties and set the query created in step 1. Set the context type to role property.

The ContextString is intended to be used in x++ code to enable/disable policies.

The RoleProperty is defined as context string on the roles. You can then link multiple roles to one or more  policies with a certain context string.

The RoleName is used to have a policy enabled for just one particular form.

  1. Then set the context string to whatever string you want. In our case it is “XDSPracticePolicyString”. This context string will be used for applying xds policy to any role you want.

  1. Set the following properties as shown in the below image.

  1. Now for constraint table node in the xds policy. Constraint table is basically table record related to the primary table which will have the xds policy applied on it. It means in our case LMS_BookIssue table will also contains data for only available books status. The properties are set below in the image.

Note: You can skip constraint table if you just want to apply xds on the master table rather than other table which has master table’s primary key as foreign key.

  1. After that build your project and sync database.
  2. Then go to dynamics security configuration and select a role. Enter the xds context string in the context string text box , this will make sure that the policy is applied against this role. You can use a single context string for multiple xds security policies.

Note: XDS security will not work if the user has admin role assigned to it.

The post Implement XDS in Microsoft Dynamics 365 Finance and Operations appeared first on Impulz Technologies LLC.

]]>