Lookup for the particular customers

Hi All

Just struggling with a look up form if someone could help me please.

In my form I added a customer account field and fixed deposit number field.

For each customer having so many Fd’s.

Eg:4657.Doc2.docx (136 KB)

In my form I added 4 fields.

1803.Doc3.docx (161 KB)

If I choose customer 30 in my form in customer account field. Then that particular customer Fd’s only have to show in that fixed deposit field(no need of showing all the customers).

Can you please give me a solution for this.

public void lookup()
{
Query query = new Query();
QueryBuildDataSource qbds;
QueryBuildDataSource QbdsJoin;

// Instantiate sysTableLookup object using table which will provide the visible fields
SysTableLookup sysTableLookup = sysTableLookup::newParameters(tableNum(FDT), this);
;

// Create the query.
qbds= query.addDataSource(tableNum(FDT));
qbds.addRange(fieldNum(FDT, CustomerNameField)).value(‘CUstomerFieldValue’);

// Set the query to be used by the lookup form
sysTableLookup.parmQuery(query);

// Specify the fields to show in the form.
sysTableLookup.addLookupfield(fieldNum(FDT, FiledName1));
sysTableLookup.addLookupfield(fieldNum(FDT, FiledName2));

sysTableLookup.addLookupfield(fieldNum(FDT, FiledName2));

// Perform the lookup
sysTableLookup.performFormLookup();
}

Create this method under Fixed deposot number field(in Design of form or datasource of the form)

and change the Bold text to your fixed deposit number table and required fields.

Note this a lookup method:

hope it will help you

for more ref see this:

http://dynamics-ax-prasankumar.blogspot.com/2011/07/lookup-method.html

Hi,

You can also achieve even without writing a single line of code.

Navigate to your Table(Table which you have created newly with four fields ) . By forms I realize that it is CustomerFD.

I mean, Navigate to CustomerFD Table → Relations. and follow the steps.

1). Right click on relations → new realtions and name it as customer which is realtion1.

  1. Specify the relation as the table name of the Fixed deposit number table.

  2. Right click on Customer and click on new → Normal

  3. Select customer filed to your custmer filed in CustomerFD . and relatedField to customer field in Fixed deposit number table.

  4. again right click on Customer Realtion and click new-> normal

  5. Now Select Fixed deposit number Field in CustomerFD. and relatedField to customer field in Fixed deposit number table.

save and open the form now.

It will 100% works without code, but you should be correctly followed the mentioned steps.

Lookup method