lookup contactperson

Hi everybody,

I need to lookup contact person (AX 2012), but it only shows up the contacts who have primary address.

I just used contactperson::lookupcustcontactperson() method .

can anybody help? thank in advance!




See this and create ur own lookup…

Have a look at the sales order and see how the contact person look up has been implemented.

Hi Gopinath, I have created my own query, but it only show contactperson id , i need to show the name instead

Hi Kranthi, i am going to check. thanks

do you know how to use recid as query range value? or cannot use it at all.

the contact person on sales order does not match my requirement, it shows only the contact who has primary address. I need to show all of tem

can u show the code…?

It should be showing the contact irrespective of the primary address and i don’t even see any such code in the related lookup form \Forms\ContactPersonLookup. Please try to debug.

void lookup()
Query query;
QueryRun queryRun;
QueryBuildDataSource qbdContact;
QueryBuildDataSource qbdDirPerson;
QueryBuildDataSource qbdcust;
QueryBuildDataSource qbdLogAddress;
DirPartyRecId custParty;

SysTableLookup sysTableLookup;

query = new Query(queryStr(smmContacts_NoFilter));

qbdContact = query.dataSourceTable(tableNum(ContactPerson));//.findRange(fieldNum(ContactPerson, CustAccount));
qbdContact.addRange(fieldNum(ContactPerson, CustAccount)).value(BFFProjWizTable.CustAccount);

qbdDirPerson = qbdContact.addDataSource(tableNum(DirPerson));
qbdDirPerson.addLink(fieldNum(ContactPerson, Party), fieldNum(DirPerson, RecId));

sysTableLookup = SysTableLookup::newParameters(tableNum(ContactPerson),this);



but i have two contacts for a customer, it shows only the one who has primary address

Are you using \Data Dictionary\Tables\ContactPerson\Methods\lookupCustContactPerson or the above code(code you mentioned)?

the above code

Do you have the same issue with \Data Dictionary\Tables\ContactPerson\Methods\lookupCustContactPerson?

Hi Kranthi, sorry the salesorder contact person’s lookup works fine. I need to use the same funcation on a form which has not datasource has contactpersonid, how can i make it work as salesorder

What does that mean?

Hi Kranthi, I need to show all the contacts for this customer when i use lookup, I have found very strange thing which when i add one more contact to this customer (there are 3 contacts only one of them has primary address), then the lookup shows all three, but if there are two one with primary address the other without, then the lookup only show one with primary address

Hi, i don’t see any such issue. how you are calling that method?


this may helpful to you…



this may helpful to you…