Hi everyone,
I have a field named Project/Contract on Invoices and Memos (AR301000)
and I want bring this field to Grid on Customer Details screen
Could you please help me?
Thanks,
Khoi
Best answer by Naveen Boga
View originalHi everyone,
I have a field named Project/Contract on Invoices and Memos (AR301000)
and I want bring this field to Grid on Customer Details screen
Could you please help me?
Thanks,
Khoi
Best answer by Naveen Boga
View originalHi
Hi
public class ARDocumentResultExt : PXCacheExtension<ARDocumentResult>
{
#region UsrCustomerOrderNbr
[PXString(50, IsUnicode = true)]
[PXUIField(DisplayName = "Customer Order Nbr")]
public virtual string UsrCustomerOrderNbr { get; set; }
public abstract class usrCustomerOrderNbr : PX.Data.BQL.BqlString.Field<usrCustomerOrderNbr> { }
#endregion
}
public class ARDocumentEnqExt : PXGraphExtension<ARDocumentEnq>
{
protected void ARDocumentResult_UsrCustomerOrderNbr_FieldSelecting(PXCache cache, PXFieldSelectingEventArgs e)
{
ARDocumentResult row = (ARDocumentResult)e.Row;
if (row != null)
{
ARDocumentResultExt resext = row.GetExtension<ARDocumentResultExt>();
ARInvoice invoiceObj = PXSelect<ARInvoice, Where<ARInvoice.docType, Equal<Required<ARInvoice.docType>>,
And<ARInvoice.refNbr, Equal<Required<ARInvoice.refNbr>>>>>.Select(Base, row.DocType, row.RefNbr);
if (invoiceObj != null)
{
e.ReturnValue = invoiceObj.InvoiceNbr;
}
}
}
}
Hi
Thank you for your hint but I the field isn’t shown data. Could you please advise me?
I tried with a simple field (single line of text) as an example with following step:
public class ARDocumentResultExt : PXCacheExtension<PX.Objects.AR.ARDocumentEnq.ARDocumentResult>
{
#region UsrCustomerOrderNbr
[PXString(50, IsUnicode = true)]
[PXUIField(DisplayName = "Customer Order Nbr")]
public virtual string UsrCustomerOrderNbr { get; set; }
public abstract class usrCustomerOrderNbr : PX.Data.BQL.BqlString.Field<usrCustomerOrderNbr> { }
#endregion
}
protected void ARDocumentResult_UsrCustomerOrderNbr_FieldSelecting(PXCache cache, PXFieldSelectingEventArgs e)
{
var row = (ARDocumentResult)e.Row;
if (row == null)
{
return;
}
ARDocumentResultExt resext = row.GetExtension<ARDocumentResultExt>();
ARInvoice invoiceObj = PXSelect<ARInvoice,
Where<ARInvoice.docType, Equal<Required<ARInvoice.docType>>,
And<ARInvoice.refNbr, Equal<Required<ARInvoice.refNbr>>>>>.Select(Base, row.DocType, row.RefNbr);
if (invoiceObj == null) { return; }
resext.UsrCustomerOrderNbr = invoiceObj.InvoiceNbr;
}
This field is always empty
Hi
I found that the event handling in extension library isn’t registered successfully.
I extended Graph in Visual Studio
Then upload the file .dll but somehow this handling isn’t applied
If I go with create event handler directly in Customization Project Editor, it works fine.
Do you have any idea why the event handling in .dll file didn’t work?
Thank you very much,
I found that I didn’t set property as CommitChanges =true for the field so it doesn’t work in my code
Hi
I do the same way to bring the field Customer->BillContact->FullName to Customer Details Screen with following code:
protected void ARDocumentResult_UsrAccountName_FieldSelecting(PXCache cache, PXFieldSelectingEventArgs e)
{
var row = (ARDocumentResult)e.Row;
if (row == null)
{
return;
}
Customer customer = PXSelect<Customer,
Where<Customer.bAccountID, Equal<Required<Customer.bAccountID>>>>.Select(Base, row.CustomerID);
if (customer == null) { return; }
Contact billContact = PXSelect<Contact,
Where<Contact.contactID, Equal<Required<Contact.contactID>>>>.Select(Base, customer.DefBillContactID);
if (billContact == null) { return; }
e.ReturnValue = billContact.FullName;
}
When I select the Customer for the first run, the result is correct as following:
Note: Account Name is display name of UsrAccountName
However, if I select another Customer, the value of Account Name didn’t update (the value is from previous Customer)
Then I refresh the page, I got the correct one:
Somehow the event FieldSelecting is not affected immediately when I change the Customer.
Could you please advise me?
Enter your username or e-mail address. We'll send you an e-mail with instructions to reset your password.