Hi, I have a requirement where i need to update the checkbox from Vendor Account in PO Invoice Form.
Here is the code i have used,
[ExtensionOf(classStr(PurchFormLetter_Invoice))]
final class PurchFormLetter_Invoice_Extension
{
public void run()
{
next run();
VendInvoiceInfoTable vendInvoiceInfoTable ;
VendTable vendTable;
select firstOnly SNAdd, AccountNum
from vendTable
where vendTable.AccountNum == vendInvoiceInfoTable.InvoiceAccount;
if (vendTable && vendTable.SNAdd== NoYes::Yes)
{
vendInvoiceInfoTable.SNAdd= NoYes::Yes;
}
}
}
I believe the calling method is different and also how do i get vendInvoiceInfoTable records for current selected record?
You didn’t give us enough information. All right, you want to set the value of SNAdd
field on the selected record, but on which record(s), when and why? Why would you update the parameters used for the posting that are become irrelevant after posting? Don’t you want to update VendInvoiceJour instead?
Your code will never do anything. You never set any value to to vendInvoiceInfoTable
variable, therefore its InvoiceAccount field will always be empty and it will never find any VendTable record to update.
The idea of “selected record” makes little sense in this case, because the class may process many invoices. Don’t you rather want to update all invoices being posted? If only a single selected record is being posted, it’ll do what you asked for, but it’ll also cover other scenarios you didn’t consider.
Hi, I have added a checkbox SNAdd in the VendTable. Currently, when this checkbox is enabled for a particular vendor and the corresponding confirmed purchase order is invoiced, the intention is for the SNAdd checkbox to also be enabled in both the invoice page and the pending invoice.
Since the invoice Form (VendEditInvoice) and pending invoice Form (VendInvoiceInfoListPage) share the same table VendInvoiceInfoTable. I have added the field in VendInvoiceInfoTable.
Presently, I am trying to update the SNAdd field in the PurchFormLetter_Invoice. So that it will reflect in both Form at once.
I still don’t get it. When you post an invoice, you take the parameters for posting (pending invoice) and create an actual invoice. Creating the invoice is the point of invoicing. After invoicing, the invoice is not pending and the input parameters for invoicing are not relevant anymore, because they already were used for creating an invoice. So… why would you update the table of pending invoices.
Please forget your technical design for a moment and explain the actual business problem you’re trying to solve.
Hi, Business requirement is to add flag / checkbox on the vendor master record.
Then when the vendor invoices are being generated from within the purchase order, or the pending invoice form this flag/checkbox will be able to be seen within the invoice header to enable the user to validate if the invoice received from the vendor is marked to process, prior to invoice processing.
It sounds like you mixed up two things:
- When creating a pending invoice, the flag on the pending invoice should be set.
- When posting an invoice, the flag on the invoice should be set.
Your code is doing the first action on the trigger to the second action.
Now, you must ask business users when they need the current value on vendor and when the historical one (because it can change). For example, the flag is set on a vendor, I create a pending invoice and the flag is set there. Then I removed the flag from the vendor. Now the value on the pending invoice is different than on the vendors. Is this requested or would it be a bug?
We can make the flag as non editable in the Invoice and pending invoice form.
Yes, it must read-only to meet your requirements (the invoice can’t be edited in either case).
But that’s not what I’m talking about. My point is that if you store the value in pending invoices and invoices, you may have different values there than on the vendor. Please consider (ask business users) whether this is wanted or it would be wrong.
I can imagine that you want to see the current value from the vendor in pending invoices, which means that you shouldn’t create a new field. You should merely display the value from VendTable. And if the purpose of the value is to check something “prior to invoice processing”, then there is no point in saving it on the invoice. The result would be no new field anywhere, just a display method in those two forms.