Sunday, September 19, 2021

Extensible Data Security (XDS) Framework In D365FO

 

These are the object I am using to full fill the XDS concept. I have a requirement like I have to show only transfer line records which have the same 'from site' and 'to site'.

  • All objects

  • Query

  • Role
  • Policy


In the above concept, I am using Table relations. We can apply the range in the static query. Just check the below example.

Here I am applying the range in the 'InventDimId' field.

Create a new class and write the below method.

    [QueryRangeFunction] public static str GetSite() { InventDim inventDim1,inventDim2; InventJournalTrans inventJournalTrans; str text; int i = 1; container c; while select inventJournalTrans where inventJournalTrans.InventDimId && inventJournalTrans.ToInventDimId { InventSiteId siteid, Tositeid; siteid = InventDim::find(inventJournalTrans.InventDimId).InventSiteId; Tositeid = InventDim::find(inventJournalTrans.ToInventDimId).InventSiteId; if(siteid == Tositeid && !conFind(c, inventJournalTrans.InventDimId)) { //c += strfmt('(InventJournalTrans.InventDimId == "%1")',inventJournalTrans.InventDimId); c = conIns(c,i,inventJournalTrans.InventDimId); i++; } } //text = con2str(c,"||"); text = con2str(c,","); return text; }

In the static query drag the required field to ranges node. In the value property apply like this

 "(XDSClass::getSite())".

Apply the range like the below screenshot.



Keep Daxing !!

Monday, September 13, 2021

How to get Financial Dimension 'Cost Center' value for the Report in D365fo

 How to get Financial Dimension 'Cost Center' value using X++

    static void displayCostCenterDimension() { DimensionAttributeValueSetStorage dimensionAttributeValueSetStorage ; DimensionAttribute dimensionAttribute; VendTable vendTable; DimensionValue dimensionValue; ; #define.DimensionName("CostCenter") while select vendTable { dimensionAttributeValueSetStorage = dimensionAttributeValueSetStorage::find(                                                                vendTable.DefaultDimension);

dimensionAttribute = dimensionAttribute::findbyname(#DimensionName); dimensionValue = dimensionAttributeValueSetStorage.getDisplayValueByDimensionAttribute( dimensionAttribute.recId); info(dimensionValue); } }

Keep daxing!!