Tuesday, June 11, 2019

Testing custom services with POSTMAN

Create a POST type entry and enter below in the search bar.

{{resource}}/api/services/<Service Group>/<Service>/<ServiceMethod>

Testing Custom entities in D365FO using POSTMAN scripts

There is a really good article from Microsoft to configure the POSTMAN to test the custom services in D365FO. However there are some small changes here and there that could help you configure the POSTMAN to work better with D365FO.

Few more links below to understand how POSTMAN scripts can be manipulated to fetch the correct results.

vishwad365fo.blogspot.com/2018/05/custom-service-to-create-sales-order.html

axtoday.blogspot.com/2017/08/accessing-dynamics-365-for-operations_17.html


For me even after following the article from Microsoft I was getting error so I did below changes.

After we have generated the Bearer Token and it is added to your environment. Just go to the Authorization tab and select Bearer Token on the Type field. Also copy and paste the Bearer token to the token field.


On the header tab write below values

Authorization:Bearer{{bearerToken}}
Content-Type:application/json



Body tab must select Raw and select JSON from the drop down.



On the Tests Tab put the following JSON script.

var json = JSON.parse(responseBody);
tests["Get  info"] = !json.error && responseBody !== '' && responseBody !== '{}';


Monday, May 13, 2019

Vendor invoice add Requester to the hierarchy workflow in D365FO

I had a request for a development where there was a need to have a hierarchical workflow approval process in Vendor invoice. The issue was the requestor was not available in the workflow setup. To fix this I had the done the below changes.


 Create an extension for table VendInvoiceInfoTable and add new field Originator in table VendInvoiceInfoTable.




 Make sure the EDT for this new field is PurchReqRequesterRefRecId



 Extend query VendInvoiceDocument and add the new field created in table VendInvoiceInfoTable  to this query


Add the field in the form VendEditInvoice


In workflow configuration, you will find requestor, now when invoicing the PO just enter the requester user Id. 

Tuesday, February 26, 2019

Auto fill segmented control on form in D365FO


 public void setSegmentedDefaults()
    {
        DimensionStorage                    dimensionStorage;
        DimensionStorageSegment             segment;   
        DimensionAttribute                  dimensionAttribute;
        DimensionAttributeValue             dimensionAttributeValue;
        ;

        dimensionStorage = DimensionStorage::findById(this.LedgerDimension);

        dimensionAttribute = DimensionAttribute::findByName('BusinessUnit');
        dimensionAttributeValue = DimensionAttributeValue::findByDimensionAttributeAndValueNoError(dimensionAttribute, '002', false, true);
        segment = DimensionStorageSegment::constructFromValue('002', dimensionAttributeValue);
        dimensionStorage.setSegmentForHierarchy(1, 2,segment);
        this.LedgerDimension = dimensionStorage.getSavedComboRecId();

        dimensionAttribute = DimensionAttribute::findByName('Department');
        dimensionAttributeValue = DimensionAttributeValue::findByDimensionAttributeAndValueNoError(dimensionAttribute, '024', false, true);
        segment = DimensionStorageSegment::constructFromValue('024', dimensionAttributeValue);
        dimensionStorage.setSegmentForHierarchy(1, 3,segment);
        this.LedgerDimension = dimensionStorage.getSavedComboRecId();
                     
    }

Tuesday, February 19, 2019

Call stack window missing in Visual Studio D365FO


It is very crucial to have a call stack window to understand the flow of the code. To enable call stack follow below points.

1. Open visual studio and put a breakpoint.
2. Run the code and wait for the debugger to hit the breakpoint.
3. Go to Debug->windows->Call stack


Monday, February 4, 2019

How to create Retail product category in D365FO using X++


Guys we can use below code to create the retail product category using X++

 EcoResCategory ecoResCatImport

 ecoResCatImport.clear();
 ecoResCatImport.initValue();
 ecoResCatImport.initFromParent(EcoResCategory::findByName('HAL',ecoResCategory.CategoryHierarchy);
ecoResCatImport.Code = 'Test_categoryimport';
 ecoResCatImport.Name = 'Test_Categoryimport';
 ecoResCatImport.addToHierarchy();

Getting Query validation failed-FF004 error in D365FO import job

Once I was importing a package with products V2 entity. I was getting an error "Query validation failed-FF004"  the reason is the data source format in package is set to accept the the row delemeter different from what is set in D365FO.

To resolve this go to

Data Management -> configure data Source -> VerticleBarSaperated(select the source which is mentioned in the manifest file of the packge, in my case it was Vertical Bar Saperated)



Just change the Row delimiter to {LF} form {CRLF} save and import again.