Hi Everyone:
I've got a weird one here. The situation: I'm trying to open the original invoice to which a payment has been applied, and I want to open it right after a receipt report that I've built (custom) is run for the payment. You can assume a one-to-?one relationship between the payment and the invoice. So basically, I run my receipt (report) for payment 123, it prints the receipt, and I want a copy of the invoice to which payment 123 was applied which is number ABC4.
I'm not averse to trying to put these into the same report and conditionally hiding the invoice portion if the payment was unapplied - that unfortunately presents an almost vertical barrier to entry on this because my client has multiple invoice types and I really don't feel like messing around replicating logic.
What I've tried is this:
trigger OnPostDataItem()
begin
if "Applies-to Doc. No." <> '' then begin
// replacement token initializations
ReplacementToken := '%INVOICE_NUMBER%';
// semi-constant initializations
CoreParameterString := '<parameters here that run this report>';
CoreParameterString := CoreParameterString.Replace(ReplacementToken, "Applies-to Doc. No.");
Report.Execute(Report::"Standard Sales - Invoice", CoreParameterString);
end
end;
But it simply does nothing - if I had to guess, it might spawn a report in a background session and never present it to the user, or it just ignores the code. Either way, it's effectively telling me to go stuff myself.
Is there a way to actually do what I'm thinking? Anyone got any ideas?
Thanks.
-J