The trick is to override datasetLookup() on Dataset > data source > field > methods. You will not find this method in the list of override methods so just create this as new method. the table which we are using for lookup should be in the Dataset public void dataSetLookup(SysDataSetLookup sysDataSetLookup) { List list = new List(Types::String); Query query = new Query(); QueryBuildDataSource queryBuildDataSource; QueryBuildRange qbr; // Add the table to the query. queryBuildDataSource = query.addDataSource(tableNum(HcmWorker)); //add the range qbr = queryBuildDataSource.addRange( fieldnum(HcmWorker, PersonnelNumber)); // qbr.value(DirPersonUser::currentWorkerPersonnelNumber()); // qbr.status(RangeStatus::Locked); // Specify the fields to use for the lookup. list.addEnd(fieldStr(HcmWorker,PersonnelNumber)); list.addEnd(fieldStr(HcmWorker,Name())); sysDataSetLookup.parmLookupFields(list); // Specify the field that is returned from the lookup. sysDataSetLookup.parmSelectField('PersonnelNumber'); // Pass the query to the SysDataSetLookup so that the query is used. sysDataSetLookup.parmQuery(query); }
This blog is contains coding reference related to Microsoft AX 2012 and D365 finance and operations and Power platform
Wednesday, April 22, 2020
Add Custom lookup on EP
Table browser URL in D365FO
https://usnconeboxax1aos.cloud.onebox.dynamics.com/?mi=SysTableBrowser&prt=initial&limitednav=false&cmp=usmf&tablename=CustTable
Unit conversions using X++ , Standard and Intra-class conversions in AX
Standard conversion RefRecId unitOfMeasureFromRecId = UnitOfMeasure::findBySymbol(inventTable.salesUnitId()).RecId; RefRecId unitOfMeasureToRecId = UnitOfMeasure::findBySymbol(salesLine.SalesUnit).RecId; real defaultUnitConvertedQty = UnitOfMeasureConverter::convert(abs(inventTrans.Qty), unitOfMeasureFromRecId,//from unitOfMeasureToRecId,//To NoYes::No); Intra-class conversion real unitConvertedQty = EcoResProductUnitConverter::convertGivenUnitSymbolsForReleasedProduct(inventTable.ItemId, salesLine.InventDimId, abs(inventTrans.Qty), inventTable.salesUnitId(),//from salesLine.SalesUnit,//To NoYes::No);
Show Information in Action center in D365 finance and operations instead of using infolog
class RunnableClass1 { /// <summary> /// Runs the class with the specified arguments. /// </summary> /// <param name = "_args">The specified arguments.</param> public static void main(Args _args) { SystemNotificationDataContract notification = new SystemNotificationDataContract(); notification.Users().value(1, curUserId()); notification.Title("@ApplicationPlatform:ExportToExcel_ActionCenterCompletedTitle"); notification.RuleId('ExcelStaticExport'); str formCaption = "Your text"; notification.Severity(SystemNotificationSeverity::Warning); notification.Message(strFmt("@ApplicationPlatform:ExportToExcel_ActionCenterCompletedMessage", formCaption)); // Set the expiration an hour less than the expiration of the blob to avoid a condition where the blob expires before the message notification.ExpirationDateTime(DateTimeUtil::addHours(DateTimeUtil::utcNow(), 48)); SystemNotificationsManager::AddNotification(notification); } }
Subscribe to:
Posts (Atom)