Copying custom values from SO to Credit  Topic is solved

Discussions relating to Jiwa 7 plugin development, and the Jiwa 7 API.

Copying custom values from SO to Credit

Postby pricerc » Tue Jul 20, 2021 10:43 am

I feel like I might be missing something obvious...

When copying a quote, I can handle SalesOrder_Created and get the source quote to populate a S/O's custom fields.

How do I copy custom data to a credit note when creating one from a sales order?
/Ryan

ERP Consultant,
Advanced ERP Limited, NZ
https://aerp.co.nz
User avatar
pricerc
Senpai
Senpai
 
Posts: 518
Joined: Mon Aug 10, 2009 12:22 pm
Location: Auckland, NZ
Topics Solved: 21

Re: Copying custom values from SO to Credit  Topic is solved

Postby Mike.Sheen » Tue Jul 20, 2021 11:53 am

pricerc wrote:I feel like I might be missing something obvious...

When copying a quote, I can handle SalesOrder_Created and get the source quote to populate a S/O's custom fields.

How do I copy custom data to a credit note when creating one from a sales order?


When a credit note is created from a sales order, the CreditNoteInvoiceHistoryID and CreditNoteInvoiceID properties contains the values of the sales order you created the credit note from.

So, in a handler of the Created event, you can inspect the NewSalesOrderType parameter and if it is e_NewSalesOrderCreditNote, and the CreditNoteInvoiceHistoryID is not null or empty, then you know you're a credit note created from a sales order and the CreditNoteInvoiceID is the SO_Main.InvoiceID and the CreditNoteInvoiceHistoryID is the SO_History.InvoiceHistoryID of the sales order.

We don't have the whole sales order as a parameter to the Created event like we do with when making a sales order from a quote, unfortunately, but it will be easy enough to create a new sales order business logic instance and read that with the CreditNoteInvoiceID and find the snapshot with the matching CreditNoteInvoiceHistoryID.
Mike Sheen
Chief Software Engineer
Jiwa Financials

If I do answer your question to your satisfaction, please mark it as the post solving the topic so others with the same issue can readily identify the solution
User avatar
Mike.Sheen
Overflow Error
Overflow Error
 
Posts: 2583
Joined: Tue Feb 12, 2008 11:12 am
Location: Perth, Republic of Western Australia
Topics Solved: 807

Re: Copying custom values from SO to Credit

Postby pricerc » Tue Jul 20, 2021 12:04 pm

Thanks Mike.
/Ryan

ERP Consultant,
Advanced ERP Limited, NZ
https://aerp.co.nz
User avatar
pricerc
Senpai
Senpai
 
Posts: 518
Joined: Mon Aug 10, 2009 12:22 pm
Location: Auckland, NZ
Topics Solved: 21


Return to Technical and or Programming

Who is online

Users browsing this forum: No registered users and 4 guests