How to add a method in a lookup in form's field

Hi All,

Can anyone give an idea oh how to add a method to the lookup() in a forms field .

i.e usually we use lookup.addlookupfield(fieldnum(tablename, fieldname));

Now my requirement is i need to bring a method from the table to the lookup…so how should i write code???

i.e lookup.(???)


Use lookUp.addLookupMethod(‘method1’); //here method1 is a display method on the table u lookup

Hi Lilly,

Here is one sample Look Up Method Code

void lookupItemId(FormControl control)


Query query = new Query();

QueryBuildDataSource queryBuildDataSource;

QueryBuildRange queryBuildRange;

SysTableLookup sysTableLookup;


//Create an instance of SysTableLookup with the form control passed in

sysTableLookup = SysTableLookup::newParameters(tablenum(Purchline), control);

//Add the fields to be shown in the lookup form

sysTableLookup.addLookupfield(fieldnum(Purchline,Itemid), true);


//Code Added 29 - 03

//sysTableLookup.addLookupfield(fieldnum(Purchline, Linenum), false);

sysTableLookup.addLookupMethod(“IFRBRAND”); --------------------------------------> This is how i use method in a look up from the Datasource PurchLine

sysTableLookup.addLookupfield(fieldnum(Purchline, QtyOrdered), false);

//create the query datasource

queryBuildDataSource = query.addDataSource(tablenum(Purchline));

queryBuildRange = queryBuildDataSource.addRange(fieldnum(Purchline, Purchid));


//add the query to the lookup form


// Perform lookup



Hi Lilly,

try below code hope it’ll helpfull 4 u


hi Mayank k,

Thanks for your reply… Indeed i solved the issue by myself.

is there any way to add a empid(by field), name(by method) in a form’s init() method???

i tried using [tablenum(tablename, field1), tablemethodstr(tablename, methodname)], but i am getting an error… how to solve this? i need to get the display method name next to the emplid???


What you need in your init method? look up field ? On what basis?

Thanks and Regards,


Hi Kevin,

I am using this in SysListPanelRelationTableCallback::newForm() …