Posts

Showing posts from September, 2024

overcut calculate & item explode in d365fo x++

overcut calculate & item explode in d365fo x++ Code:  class SLD_CalculateOvercut { SLD_TmpBOMExplode tmpBOM; SLD_RecipeIDEDT recipeID; public static void main(Args _args) { FormRun formRun = _args.caller(); SLD_CalculateOvercut SLD_CalculateOvercut = new SLD_CalculateOvercut(); SalesTable salesTable; SalesLine salesLine, salesLineUpd; real overcutPercentage, RemainingSalesQty; List LineList = new List(Types::Real); enumerator enumerator = LineList.getEnumerator(); if(_args.record() && _args.record().TableId == TableNum(SalesTable)) { salesTable = _args.record(); } while select ItemId, sum(SalesQty) from salesLine group by salesLine.ItemId where salesLine.SalesId == salesTable.SalesId { s...

Form name Lookup in d365fo x++

Form name  Lookup in d365fo x++ Code:  Lookup for Formnames public void lookup() {     DSPUtil dspUtil = new DSPUtil();     FormStringControl formControl;     List FormNames;     FormRun formrun;     container lookupContainer;     str caption;     super();     formControl = this;     caption = 'Select Form Name';     System.Type axMenuItemTypeDisplay = new Microsoft.Dynamics.AX.Metadata.MetaModel.AxForm ().GetType ();     System.Collections.Specialized.StringEnumerator FormDisplayName = Microsoft.Dynamics.Ax.Xpp.MetadataSupport::FormNames();     while (FormDisplayName.moveNext ())     {         lookupContainer += any2Str(FormDisplayName.get_current ());         //Get Model Name for the display menu it...

Item id Lookup on search criteria in d365fo x++

 Item id Lookup on search criteria in d365fo x++ Code:  public void overridenItemIDLookup(FormStringControl _formControl) { MCRFullTextIndexField MCRFullTextIndexField; Query query; QueryBuildDataSource qbds, qbds1; QueryBuildRange queryBuildRange; SysTableLookup sysTableLookup; query = new Query(); container con = [DHSS_ProductType::PurchasableItem, DHSS_ProductType::Both]; sysTableLookup = SysTableLookup::newParameters(tableNum(MCRProductSearchView), _formControl); sysTableLookup.addLookupField(fieldNum(MCRProductSearchView, DisplayProductNumber), true); while select MCRFullTextIndexField where MCRFullTextIndexField.SOURCE == 'MCRProductSearchView' { sysTableLookup.addLookupField(fieldName2Id(tableName2Id(tableStr(MCRProductSearchView))...

Get Dimension In D365fo X++

 Get Dimension In D365fo X++ Code:  private DimensionDisplayValue getDimensionValue(RecId defaultDimension, Name dimName) { DimensionDisplayValue dimensionValue; DimensionAttributeValueSetStorage dimStorage; dimStorage = DimensionAttributeValueSetStorage::find(defaultDimension); return dimStorage.getDisplayValueByDimensionAttribute(DimensionAttribute::findByName(dimName).RecId); } public str get_Dimension(int64 DefaultDimValue, str ReptColumn) { DEFAULTDIMENSIONVIEW DEFAULTDIMENSIONVIEW; select DEFAULTDIMENSIONVIEW where DEFAULTDIMENSIONVIEW.defaultDimension == DefaultDimValue && DEFAULTDIMENSIONVIEW.ReportColumnName == ReptColumn; return DEFAULTDIMENSIONVIEW.displayValue; } Get Dimension Value Description: public Name getDimensionAttributeValueDesc(Name _dimAttrName, DimensionDisplayValue _dimAttrValue) { DimensionAttribute dimA...