Hi,
I have a custom description field sitting in the Projects screen that is replacing the original Description field. This is because I needed the field to support a larger amount of characters for reports and I wasn’t able to achieve the correct result with the original description field sinc the reports would grab the original length the Description field rather than the new length.
Back to the main issue, when invoices are generated, the Transaction Description is grabbing content from the original Description field, but I would like this to come from the new custom description field I created.
I have tried something like the below to achieve this, but I can’t seem to get it working. I am trying to match an invoice line from the grid with the relevant project task in the Projects screen so that I can transfer the the content from the custom field to the invoice field.
What would you recommend to achieve this? I should note that this customisation is be published against the Invoices screen as I want the description to be brought in when an invoice is opened.
You will notice I am trying to update the invoice’s description field with a test string. I am unable to see this text appear in the description field, so I was wondering if there was something specific I needed to do to get both screens connected.
Let me know if I can provide any further information.
Kind regards,
Andrew
namespace PX.Objects.AR
{
public class ARInvoiceEntry_Extension : PXGraphExtension<PX.Objects.AR.ARInvoiceEntry>
{
#region Event Handlers
protected void ARTran_TranDesc_FieldSelecting(PXCache cache, PXFieldSelectingEventArgs e)
{
var row = (ARTran)e.Row;
var selectRevenueBudget = new PXSelect<PMRevenueBudget,
Where<PMRevenueBudget.projectID, Equal<Current<ARInvoice.projectID>>,
And<PMRevenueBudget.projectTaskID, Equal<Required<PMRevenueBudget.projectTaskID>>,
And<PMRevenueBudget.type, Equal<GL.AccountType.income>>>>>(this.Base);
var selectInvoiceLine = new PXSelect<ARTran,
Where<ARTran.projectID, Equal<Current<ARInvoice.projectID>>,
And<ARTran.taskID, Equal<Required<ARTran.taskID>>>>>(this.Base);
foreach (ARTran line in selectInvoiceLine.Select(row.TaskID))
{
line.TranDesc = "This is a test";
selectInvoiceLine.Update(line);
}
}
#endregion
}
}