25.01.2019, 09:11 | #1 |
Участник
|
dynamicsaxinsight: D365: Create lookup in X++
Источник: https://dynamicsaxinsight.wordpress....lookup-in-xpp/
============== Product: Dynamics 365 for Finance and Operations Purpose: The purpose of this document is to demonstrate how we can create a lookup in X++ and attach it to an extension field added to the form extension of standard Sales order form. This is a good example to see how we can use event handling to achieve our goal without modifying the standard code. Business requirement: Display contacts of the customer in a lookup for which the sales order has been raised. Development: You can find the event handler below which handles the lookup event of a form control. This form control is added to the extension of SalesTable standard AX form. [FormControlEventHandler(formControlStr(SalesTable, SixSalesOrderConfirmation_SixCustContactPersonId), FormControlEventType::Lookup)]public static void SixSalesOrderConfirmation_SixCustContactPersonId_OnLookup(FormControl sender, FormControlEventArgs e){ Query query; QueryBuildDataSource qbdsContactPerson; QueryBuildDataSource qbdsCustTable; QueryBuildDataSource qbdsSalesTable; SysTableLookup sysTableLookup; SalesId salesId; FormControlCancelableSuperEventArgs event; event = e as FormControlCancelableSuperEventArgs; salesId = sender.formRun().design().controlName(formControlStr(SalesTable, SalesTable_SalesId)).valueStr(); query = new Query(); qbdsContactPerson = query.addDataSource(tableNum(ContactPerson)); qbdsCustTable = qbdsContactPerson.addDataSource(tableNum(CustTable)); qbdsCustTable.joinMode(JoinMode::InnerJoin); qbdsCustTable.relations(false); qbdsCustTable.addLink( fieldNum(ContactPerson, ContactForParty), fieldNum(CustTable, Party)); qbdsSalesTable = qbdsCustTable.addDataSource(tableNum(SalesTable)); qbdsSalesTable.joinMode(JoinMode::InnerJoin); qbdsSalesTable.relations(false); qbdsSalesTable.addLink( fieldNum(CustTable, AccountNum), fieldNum(SalesTable, CustAccount)); qbdsSalesTable.addRange(fieldNum(SalesTable, SalesId)).value(SysQuery::value(salesId)); sysTableLookup = SysTableLookup::newParameters(tableNum(ContactPerson), sender); sysTableLookup.addLookupfield(fieldNum(ContactPerson, ContactPersonId)); sysTableLookup.addLookupfield(fieldNum(ContactPerson, Party)); sysTableLookup.parmQuery(query); sysTableLookup.performFormLookup(); event.CancelSuperCall();} Источник: https://dynamicsaxinsight.wordpress....lookup-in-xpp/
__________________
Расскажите о новых и интересных блогах по Microsoft Dynamics, напишите личное сообщение администратору. |
|
|
|