Posts

Showing posts from February, 2025

Get current User subOrdinates (Reportees) in d365 fo x++

1). i want get a Subordinates of current user or Reportees of current user who are directly reporting to a peron who are currently logged in.    2). call this method by getting current users  3).this.getListOfSubordinates(HcmWorker::userId2Worker(curUserId())) 4). public List getListOfSubordinates(HcmWorkerRecId _recid)     {         List  responsibleWorkers  =   new List(Types::Int64);         int64 PositionId  =   HcmPositionDetail::findByPrimaryPositionForWorker(_recid).Position;         HcmWorker                   hcmWorker;         HcmPositionWorkerAssignment workerAssignment;         HcmPosition                 hcmPosition;         HcmPositionDetail           hcmPositionDetail; ...

Line number autoincremented in form in d365 fo x++

  Override the initValue method of the table and add the below code to increment value of LineNum field whenever new record is created. public void initValue() { YourTableName tableName; super(); select firstonly maxof(LineNum) from tableName; this.LineNum = tableName.LineNum + 1; }

Get Conversion Factor Value of item in d365 fo x++

   public real ProductConversionFactor(ItemId _itemid)    {         InventTable inventTable;         UnitOfMeasureConversion MeasureConversion;         UnitOfMeasure fromUnitOfMeasure, toUnitOfMeasure;         RecId productId       =   InventTable::itemProduct(_itemId);                     select * from          MeasureConversion         join fromUnitOfMeasure          where fromUnitOfMeasure.RecId       == MeasureConversion.FromUnitOfMeasure         join toUnitOfMeasure         where toUnitOfMeasure.RecId         == MeasureConversion.TOUNITOFMEASURE         &&  MeasureConversion.Product       == productId...

Jumpref Method in form The table does not exist as a root FormDataSource for the form in d365 fo x++

  The table does not exist as a root FormDataSource for the form Posted by  ajdoering  on  March 28, 2012 If you are Receiving this error: “Could not process the lookupTable value on the Args instance. The table ‘TableName’ does not exist as a root FormDataSource for the form ‘TableNameForm’” I may have found a solution for you. AX 2012 gets very angry when you call a form using a record from a datasource that is not the main form datasource. For example, if you have a form with SalesTable and SalesLine joined to it, and you call the form with a SalesLine record, this error message will pop-up. If this is for View Details, The easiest way to fix this is as follows: 1. Override the jumpRef() on the datasource field 2. Create Args and MenuFunction variables 3. Find the record for the main datasource table 4. Set args.record() to the main datasource record 5. Set menuFunction to the menu item that would be called if you went to View Details 6. Call the menu item wi...