Posts

Showing posts from July, 2024

QR Code in d365 fo x++

container QRCodeContainer;                    QRCodeContainer                 =   new EFDocQRCode_BR().generateQRCode(ProdTable.ItemId);             tmp.QRCode                      =   QRCodeContainer;

Unit Conversion in d365 fo x++

   public  Real convertQty(Qty _qty, UnitOfMeasureSymbol _fromUnitId,UnitOfMeasureSymbol _ToUnitId, ItemId _itemId)   public  Real convertLineQty(Qty _qty, UnitOfMeasureSymbol _fromUnitId,UnitOfMeasureSymbol _ToUnitId, ItemId _itemId)     {         Real   Qty;         Qty = UnitOfMeasureConverter::convert(_qty,UnitOfMeasure::unitOfMeasureIdBySymbol(_fromUnitId) ,UnitOfMeasure::unitOfMeasureIdBySymbol(_ToUnitId) ,NoYes::No,InventTable::itemProduct(_itemId), NoYes::No, NoYes::Yes);                 return Qty;     } call this function   real            packQty         =   this.convertQty(ProdTable.QtyStUp, _Inventtrans.inventUnit(),'PCS',_Inventtrans.ItemId);

Bar Code in d365 fo x++

 public str getItemInfo(ItemId ItemNo)     {         ProdTable   vProdtable;         str iteminfo;         #define.EmptyString('')         iteminfo = #EmptyString;         select * from vProdtable            where vProdtable.ItemId   ==  ItemNo;         iteminfo    = ItemNo;         iteminfo = BarcodeCode39::construct().encodeString(iteminfo);         return iteminfo;     }

Get Current Worker data in d365 fo x++

  In Dynamics 365 F&O, we have HcmWorkerHelper class which gives much information about worker such as department, primary position, current legal entity and so on. The code to get worker’s current position. This gives current worker record. HcmWorkerRecId hcmWorkerRecId = HcmWorker::userId2Worker(curUserId()); HcmPositionRecId hcmPositionRecId = HcmWorkerHelper::getPrimaryPosition(hcmWorkerRecId); The code to get current worker manager. HcmWorker currentWorker = HcmWorker::find(HcmWorkerLookup::currentWorker()); HcmWorker currentWorkerManager = HcmWorkerHelper::getManagerForWorker(currentWorker.RecId); The code to get current worker department. HcmWorker currentWorker = HcmWorker::find(HcmWorkerLookup::currentWorker()); OMOperatingUnit department = HcmWorkerHelper::getPrimaryDepartment(currentWorker.RecId); The code to get current worker legal entity. HcmWorker currentWorker = HcmWorker::find(HcmWorkerLookup::currentWorker()); CompanyInfo legalEntity = HcmWorkerHelper::getL...

Make dates of yaar and month add add range in dp class

   startDate                               =       mkdate(1,ORD_MONTH,ORD_YEAR);         endDate                                 =       endMth(startDate);         startyear                               =       mkDate(1,1,ORD_YEAR);         endyear                                 =       mkDate(31,12,ORD_YEAR);         query                                   =       this.parmQuery(); ...

Multi selection lookup in controller class

 public class AH_InvoiceController extends SrsReportRunController {     static void main(Args _args)     {         AH_InvoiceController controller = new AH_InvoiceController();         controller.parmReportName(ssrsReportStr(AH_InvoiceRpt, PrecisionDesign1));         controller.parmArgs(_args);         controller.parmShowDialog(false);         controller.startOperation();     }     /// <summary>     ///     /// </summary>     protected void prePromptModifyContract()     {         MultiSelectionHelper    multiSelectionHelper;         SalesTable            salesTable;         QueryBuildDataSource    qbds;         container            ...

Get Postal Address by type in d365 fo x++

  LogisticsPostalAddress getPostalAddressByType(DirPartyRecId _party, LogisticsLocationRoleType _type)     {         DirPartyLocation        partyLocation;         DirPartyLocationRole    partyLocationRole;         LogisticsLocation       location;         LogisticsLocationRole   locationRole;         LogisticsPostalAddress  postalAddress;         select firstonly postalAddress         exists join location             where location.RecId == postalAddress.Location         exists join locationRole             where locationRole.Type  == _type//LogisticsLocationRoleType::Invoice         exists join partyLocation             where   ...

Get Company Tax Registration Number in d365 fo x++

//Get Company Tax Registration Number In dynamic 365 finance and operation      public  TaxRegistrationNumber getTaxRegistrationByType(companyInfo _compInfo, str _type)     {         TaxRegistration                             taxRegistration;         DirPartyLocation                            partyLocation;         TaxRegistrationTypeApplicabilityRule        taxRegistrationRule;         TaxRegistrationType                         taxRegistrationType;       select firstonly RegistrationNumber from taxRegistration  join partyLocation join taxRegistrationRule join taxRegistrationType             wher...

Show only month and year in lookup in ssrs report in d365 fo x++

 // Contract class  [DataContractAttribute,  SysOperationContractProcessingAttribute(classStr(OrderStatusUi))] class OrderStatusContract {     int     ORD_YEAR,ORD_MONTH;     [DataMemberAttribute('ORD_YEAR'),SysOperationLabelAttribute("ORD_YEAR")]     public int ParmORD_YEAR(int _ORD_YEAR = ORD_YEAR)     {         ORD_YEAR  =  _ORD_YEAR;         return ORD_YEAR;     }     [DataMemberAttribute('ORD_MONTH'),SysOperationLabelAttribute("ORD_MONTH")]     public int ParmorderMonth(int _ORD_MONTH = ORD_MONTH)     {         ORD_MONTH  =  _ORD_MONTH;         return ORD_MONTH;     } } //Create a temp table and add two fields month and year and two methods for month and year 1. PopulateOrderYear() 2. PopulateOrderMonth() public class OrderStatusYearMonthTmp extends common {   ...

Sale Order Default dimenension with name in d365 fo x++

    public  str getDimensionDisplayValue(RecId defaultDimension, Name dimName)     {         DimensionAttributeValueSetStorage dimStorage;         dimStorage = DimensionAttributeValueSetStorage::find(defaultDimension);         return      dimStorage.getDisplayValueByDimensionAttribute(DimensionAttribute::findByName(dimName).RecId);     } //Call this method  Tmptable.SalesChannelCode           =       this.getDimensionDisplayValue(salesTable.DefaultDimension, "Sales_channel");

how to write a Display Method in d365 fo x++

    [SysClientCacheDataMethodAttribute(true)]         public  display EcoResDescription ItemDescription()     {         str                                    itemdescription;         InventSum                      inventsum;         InventTable                    inventTable;         EcoResProductTranslation    ecoResProductTranslation;         EcoResProduct               ecoResProduct;         select * from inventTable where inventTable.ItemId  == this.ItemId;         select * from EcoResProduct where EcoResProduct.RecId  == inventTable.P...