I have created a gate exit form displaying sales order details in it. I have a field as Customer account number, this field must contain a lookup displaying customer details. But for me the lookup is displayed empty I would like to know where is the problem. And if I enter a customer account number the corresponding customer’s sales details must be added in the respective sales order no and name fields. I use Ax 2009 version.
Thanks & Regards,
Have you drag and drop AccountNum field of CustTable datasource onto the form??
Then please check LookupButton properties set to Always as it will display lookup information for the customer account field.
Please let me know if you find this as your solution or you face any difficulties further.
Actually the problem was with the EDT I have resolved it but now my problem is if I enter the customer account num the relavant sales order no and sales order name should be displayed in the respective fields, what should I do for that.
Thanks & Regards,
You can write the code in modified field of table. As you select the customer account num, you can get the sales id and sales name
case fieldNum(TestTable, CustAccount);
select * from sales where sales.CustAccount == this.CustAccount;
this.AccountName = sales.SalesName;
this.SalesOrderNum = Sales.SalesId;
In this case you can write code in Modified field method of AccountNum. But my question is which Sales Id and Sales name you want to populate??
As per the above answer, over here the case will be like for a customer there can be multiple sales orders. So, if you are going to populate sales id and sales name using select statement then it will give always first sales order details.
Do You have any other criteria to populate sales order details by using that you can find a unique sales order details in your case??
Thanks Vijay for your suggestion but in that case I also don’t no whether to display the first sales order no and name in it my lead just simply asked me to create a lookup like this even i dont no that a single cust account may have many sales num’s and name’s.
Sales order,Customer 1:1 relation
Customer ,Sales order 1:n relation
so you have to select Sales order first., based on this we could populate customer details
you need to provide the lookup for sales order (assosiated with the customer ) based on customer selection ,so user could select the the sales order which he needed
Write code in Modified method of the CustTable’s AccountNum field. Based on the account number fetch the firstonly sales order record. and populate that sales order details in your sales id and sales name textbox controls.
I have written sample code snippet in the modified field and populate the SalesId in a salesid string edit control.
public boolean modified()
ret = super();
select firstOnly * from sales where sales.CustAccount == this.text();