Announcements
Hello,
I add create extension of form EcoResProductLifecycleState
I add new datasource , then I want to add lookup method to dataField of this dataSource :
have you any idea?
Hi, You can use on lookup control in form design (assuming you have added this field in form design)
allaboutdynamic.com/.../
If you want lookup of datasource field only then you can override it. Check this article.
ievgensaxblog.wordpress.com/.../
Hi Basma,
There won't be lookup event handler at form DataSource field level. Lookup event handler will be available at form control level only.
You can expand the control >> Events >. Copy the onLookup event and paste it in new class and add the lookup code there.
Thanks,
Girish S.
thanks for reply ,
I want to add lookup on dataField not th control
I want this structure of the lookup method :
[DataField] class FieldLabel { public void lookup(FormControl _formControl, str _filterStr) { shipCreatorSetup.performLookupField(_formControl, ITMCreatorSetupTable, _filterStr); } }
If it's a custom form, you can override the field level lookup method. Navigate to that field >> Methods >> Override Lookup.
If it's a standard form, you need to use control level lookup event handler.
its a standard form , how can I use the parameter "_filterStr" in eventHandler
Because I have a method that contains this param
It's still not clear why do you want on datasource level only, you can create lookup on design level and cancel super call.
Can you provide more details on method you are referring that contains parameter.
We can create extension on datasource field level as well but I am not sure if lookup will work.
dynamics365musings.com/.../
There isn't lookup event handler for form datasource field.
You cannot create lookup at a DataSource field level if it's a standard form.
Yes, the Lookup method will accept strFilter as a argument but in standard form there is no event handler available in form datasource field level.
Try writing COC for the form data field control.
because I add new method in custom class that contains filterStr as paramter :
public boolean performLookupField( FormStringControl _formStringControl, MandatoryFieldsTable _mandatoryFieldsTable, Range _filterStr) { boolean ok; FormRun formRun; Args args = new Args(formstr(MandatoryFieldsTableLookup)); if (_formStringControl.lookupButton() == FormLookupButton::Always) { ok = true; rangeTableId = int2str(_mandatoryFieldsTable.TableNum); if (_formStringControl.hasChanged()) { rangeLabel = _formStringControl.text(); } else { rangeLabel = ''; } this.buildAllFields(_mandatoryFieldsTable.TableNum); selectedRecord.setTmpData(allFields); select firstonly selectedRecord where selectedRecord.Table_Id == _mandatoryFieldsTable.TableNum && selectedRecord.Field_Id == _mandatoryFieldsTable.FieldNum; if (!selectedRecord) { select firstonly selectedRecord where selectedRecord.Table_Id == _mandatoryFieldsTable.TableNum && selectedRecord.FieldLabel == _filterStr; } cursor = _mandatoryFieldsTable; args.caller(this); formRun = ClassFactory::formRunClassOnClient(args); formRun.init(); _formStringControl.performFormLookup(formRun); } return ok; }
then I will call this method in lookup of dataField like this :
Try like below.
[ExtensionOf(formDataFieldStr(FormName, DataSourceName,FieldName ))] class ClassName_Extension { public void lookup(FormControl _formControl, str _filterStr) { super(_formControl,_filterStr); //add all your code here. You can use _filterStr variable anywhere in your code } }
You have two options to try, I shared before, try either creating extension class of form datasource field or create custom lookup method and use registerOverrides. Already shared both links in the first comment of this post. Let us know if both options doesn't work for you.
Under review
Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.
Jump in, show your community spirit, and win prizes!
Expanding mentorship, skilling, and AI innovation
These are the community rock stars!
Stay up to date on forum activity by subscribing.
Abhilash Warrier 461 Super User 2026 Season 1
André Arnaud de Cal... 428 Super User 2026 Season 1
Subra 428