Friday, November 5, 2021

Dynamic SSRS report name in D365 F&O

 When there is a requirement to generate dynamic report name. For example when saving report, the report name should be appended with Customer ID, Invoice ID etc. To do this in the controller class we have to write code for parmDialogCaption() method shown below:-

 

class DemoController extends SrsReportRunController
{
 
    public void prePromptModifyContract()
    {
        ProjInvoiceJour              projInvoiceJour;
        DemoContract             contract;
        FormDataSource               fds;
        
        contract    = this.parmReportContract().parmRdpContract() as DemoController;
        projInvoiceJour = args.record();
        fds = args.record().dataSource();
        contract.parmProjInvoiceId(projInvoiceJour.ProjInvoiceId);  
    }

    public static client void main(Args args)
    {
        DemoController             demoController;
        ProjInvoiceJour              projInvoiceJour;
        demoController= new DemoController();
        demoController.parmArgs(args);
        demoController.parmReportName(ssrsReportStr(RAR_AmazonBillingReport, Report));
        demoController.parmShowDialog(false);
       
        demoController.parmReportContract().parmReportCaption("Project Invoice Report");
        
        projInvoiceJour = args.record();
        demoController.parmDialogCaption("Project Invoice Report" + "_"+ projInvoiceJour.ProjInvoiceId); // This will generate dynamic report name        
        demoController.startOperation();
    }


when you export the report in excel, pdf or csv, the report name will be appended with ProjInvoiceId.


Source: D365FO Technical Blog: Dynamic SSRS report name in D365 FnO (axd365focode.blogspot.com)

Wednesday, October 20, 2021

Set up MT940 format for bank reconciliation in D365FO

 In D365FO advance bank reconciliation is a feature to import bank statement file and automatically reconcile with related bank accounts. There are many formats which a bank commonly used i.e. ISO20022, MT940, BAI2.


In this post, we will see how to set up the MT940 format which is commonly used in most banks nowadays.

Let's get started.

Step 1: Get sample entity template and transformation files
To transform the source file into F&O format, you need few files and these are available under 'Resources' node of AOT. Files names are as below



Step 2: Create an import project
Under Data management workspace, create an import project with name MT940. Add a new file with below details
I. Entity Name: Bank statements
II. Upload file name: SampleBankCompositeEntity (which you got from Resource node)



Once file successfully uploaded, click on view map. On next screen select BankStatementDocumentEntity from the list and click on 'View Map' and go to 'Transformation' tab. Click new and click upload file, select different XLST file one by one, in the sequence shown in below image.



Step 3: Setup Bank statement format
Navigate to Cash and Bank management > Setup > Advance bank reconciliation setup > Bank statement format.
Here create a new record as below



Step 4: Configure the bank account to use Advance reconciliation option
Navigate to Cash and Bank management  > Bank accounts. Select a Bank account to view details. Under Reconciliation tab,
I. Set the 'Advance bank reconciliation' option to 'yes'. This is a one-time setup, the system doesn't allow to undo/change once set to yes.


II. Set Statement format field to format which we have created in step 3 i.e. MT940




Step 5: Testing
Navigate to Cash and Bank management  > Bank accounts. On Reconcile tab click on Bank statements.
On the next screen click on Import statement. A dialog will pop up. Fill/select details as below

I. Import statement for multiple bank account in all entities. : Set this as Yes if your file contains more than one bank accounts.
II. Bank Account: If the source file contains a single bank, select that bank here.
III. Statement Format: Select your statement format here it must be MT940.
IV: Bank statement file import: Select source file and click upload.
V: Click ok and it must import transaction in the current form.

Note: After every DB refresh you need to redo import project. DB will break the links and you need to remove the entity from your import project and add upload the transformation files accordingly.

Thursday, September 23, 2021

Goods and Service Tax (GST) Configuration (Tax Setup) in Microsoft Dynamics 365 Finance and Operations

Goods and Service Tax (GST) Configuration in Microsoft Dynamics 365 Finance and Operations -Part-1 – Explore Microsoft Dynamics 365 Finance and Operations Together (home.blog)

 Goods and Service Tax (GST) Configuration (Required Masters) in Microsoft Dynamics 365 Finance and Operations -Part-2 – Explore Microsoft Dynamics 365 Finance and Operations Together (home.blog)

Goods and Service Tax (GST) Configuration (Tax Setup) in Microsoft Dynamics 365 Finance and Operations -Part-3 – Explore Microsoft Dynamics 365 Finance and Operations Together (home.blog)

Goods and Service Tax (GST) Configuration (Tax Setup) in Microsoft Dynamics 365 Finance and Operations -Part-4 – Explore Microsoft Dynamics 365 Finance and Operations Together (home.blog)

Goods and Service Tax (GST) Configuration (Tax Hierarchy and Set off Rules) in Microsoft Dynamics 365 Finance and Operations -Part-5 – Explore Microsoft Dynamics 365 Finance and Operations Together (home.blog)

Goods and Service Tax (GST) Transactions (Purchase Order and Invoice Journal) in Microsoft Dynamics 365 Finance and Operations -Part-6 – Explore Microsoft Dynamics 365 Finance and Operations Together (home.blog)

Goods and Service Tax (GST) Transactions (Sales Order and Free Text Invoice) in Microsoft Dynamics 365 Finance and Operations -Part-7 – Explore Microsoft Dynamics 365 Finance and Operations Together (home.blog)


Goods and Service Tax (XML) Extension for Indian Localization in Microsoft Dynamics 365 Finance and Operations- Part-9 – Explore Microsoft Dynamics 365 Finance and Operations Together (home.blog)



Withholding tax

Withholding Tax (TDS/TCS) End to End Process (Configuration, Transaction, Settlement, Authority Payment with Challan details and Report) in Microsoft Dynamics 365 Finance and Operations: Part-1 – Explore Microsoft Dynamics 365 Finance and Operations Together (home.blog)

Withholding Tax Journal in Microsoft Dynamics 365 finance and Operations: Part-2 – Explore Microsoft Dynamics 365 Finance and Operations Together (home.blog)


Thanks to Saurabh Bharthi

Sunday, July 25, 2021

Table extensions in D365FO

 Source: Customize through extension and overlayering - Finance & Operations | Dynamics 365 | Microsoft Docs

You can create a table extension to extend a table's design and logic. You can add new fields, field groups, indexes, mappings and relations. You can also add new fields to existing field groups, change the label of a table field, change the Created By, Created Date Time, Modified By, Modified Date Time properties. Using table extensions, you can also change the Extended Data Type property on fields and set it to an EDT that is derived from the current EDT (This is available as of platform update 8).

In Microsoft Dynamics AX 2012, you could override the virtual methods of a table's base class to control the behavior that occurred during table operations, such as when creating, reading, updating, or deleting. In the current version, you instead use extensions to implement event handlers that are called from the base implementations of the table methods. The following table lists each table method and its events.

TABLE EXTENSIONS
Published Table methodPreceding eventSucceeding event
validateWriteValidatingWriteValidatedWrite
validateDeleteValidatingDeleteValidatedDelete
validateFieldValidatingFieldValidatedField
validateFieldValueValidatingFieldValueValidatedFieldValue
modifiedFieldModifyingFieldModifiedField
modifiedFieldValueModifyingFieldValueModifiedFieldValue
InsertInsertingInserted
UpdateUpdatingUpdated
DeleteDeletingDeleted
InitvalueInitializingRecordInitializedRecord
FinalDeleteValidationExecuted when a delete operation is performed on a table object, before the operation is committed to the underlying database tableN/A
FinalInsertValidationExecuted when an insert operation is performed on a table object, before the operation is committed to the underlying database tableN/A
FinalReadValidationExecuted when a read operation is performed on a table object.N/A
FinalUpdateValidationExecuted when an update operation is performed on a table object, before the operation is committed to the underlying database table.N/A

Validation events capture and return results by using the DataEventArgs parameter. The display and edit method modifiers are supported on table extensions.

Form extensions in D365FO

Source:  Customize through extension and overlayering - Finance & Operations | Dynamics 365 | Microsoft Docs

You can extend the functionality of a form by extending its controls and data sources. For example, in a form extension, you can:

  • Add a new control.
  • Enable or disable a control.
  • Change the text or label property of a control.
  • Change a control's visibility.
  • Change a form's help text.
  • Change a form's caption.
  • Add a new data source.
  • Add a form part.

Other ways to customize a form, such as reordering controls in the form are planned to be included in a future release. In Microsoft Dynamics AX 2012, you could override form methods. In the current version, you use extensions to implement event handlers that are called from the base implementations of form methods. The following table lists each method and its associated events.

FORM EXTENSIONS
Published form DataSource methodPreceding eventSucceeding event
activeN/AActivated
deleteDeletingDeleted
validateWriteValidatingWritingValidatedWrite
writeWritingWritten
createCreatingCreated
executeQueryN/AQueryExecuted
linkActiveN/APostLinkActive
initN/AInitialized
validateDeleteValidatingDeleteValidatedDelete
rereadN/AReread
selectionChangedN/ASelectionChanged
markChangedN/AMarkChanged
leaveRecordLeavingRecordLeftRecord
FORM EXTENSIONS
Published form Object methodPreceding eventSucceeding event
initInitializingInitialized
closeClosingN/A
runN/APostRun
activateN/AActivated
TABLE 3
Published form Control methodPreceding eventSucceeding event
modifiedN/AModified
validateValidatingValidated
leaveLeavingLostFocus
enterN/AEnter
gotFocusN/AGotFocus
clickedN/AClicked
selectionChangeSelectionChangingN/A
pageActivatedN/APageActivated
allowPageDeactivateAllowPageDeactivateN/A
expandExpandingExpanded
tabChangedN/ATabChanged
dialogClosedN/ADialogClosed

Monday, July 19, 2021

Create Deep links in D365FO

The URL Generator must be used from code running on the AOS, in an active user session or batch process. This requirement ensures that the URL can be secured through encryption specific to the instance that generates the URL. At a minimum, the following information must be specified and passed to the URL Generator in order to generate a working URL.

  • Host URL
    • The URL of the web root for the instance. For example: https://ax.dynamics.contoso.com/
  • AOT name of the Menu Item Display
    • The menu item display to be used to open the form.
  • Partition
    • The partition to use for the request.
  • Company
    • The company to use for the request.

 



// gets the generator instance

var generator     = new Microsoft.Dynamics.AX.Framework.Utilities.UrlHelper.UrlGenerator();

var currentHost   = new System.Uri(UrlUtility::getUrl());

generator.HostUrl = currentHost.GetLeftPart(System.UriPartial::Authority);

generator.Company = curext();

generator.MenuItemName = <menu item name>;

generator.Partition = getCurrentPartition(); 


// repeat this segment for each datasource to filter

var requestQueryParameterCollection = generator.RequestQueryParameterCollection;

requestQueryParameterCollection.AddRequestQueryParameter(

    <datasource name>,

    <field1>, <value1>,

    <field2>, <value2>,

    <field3>, <value3>,

    <field4>, <value4>,

    <field5>, <value5>

);


System.Uri fullURI = generator.GenerateFullUrl();


// to get the encoded URI, use the following code

fullURI.AbsoluteUri


Source: Create shareable, secured URLs (deep links) - Finance & Operations | Dynamics 365 | Microsoft Docs

Monday, July 5, 2021

dimensionDefaultingController::findBackingEntityInstance(); in D365FO

 DimensionAttributeValue dimAttrValue =

    DimensionAttributeValue::

        findByDimensionAttributeAndValueNoError(

            dimensionAttributeTable, dimensionValue);

if (dimAttrValue) {

    common = dimAttrValue.getEntityInstance();

}


Example:


dimAttrValue            = DimensionAttributeValue::find(dimAttrValueSetItem.DimensionAttributeValue);

                dimAttr                 = DimensionAttribute::find(dimAttrValue.DimensionAttribute);

             //   dimensionValueEntity    = DimensionDefaultingControllerBase::findBackingEntityInstance(curext(),dimAttr,dimAttrValue.EntityInstance);

                DimensionAttributeValue dimAttrValue = DimensionAttributeValue::

                                                            findByDimensionAttributeAndValueNoError(

                                                                dimAttr, dimAttrValue);

                                                                    if (dimAttrValue)

                                                                    {

                                                                        dimensionValueEntity = dimAttrValue.getEntityInstance();

                                                                    }

                dimensionValue          = dimAttrValue.getValue();