Hi guys,
I am trying to work through the materials to pass this exam, but having trouble working out where the values come from when creating one of the codeunits.....
P43 of chapter 4 states
11. Enter code in the PostJobJnlLine function trigger so that the
function performs the following tasks:
* Gets the Instructor, Resource, and Customer records that
correspond to the Seminar Registration Header record.
Instructor is simple as there is an instructor code on the Seminar Registration Header, but which field do I use to get the Resource and customer records? Are they related tables?
Thanks in advance for your help
Comments
Currently I'm alsow trying to finish this book and got stuck at the same page as you....
I think you can get the Resource from the Instructor. (Instructor."Resource No.") but I'm not sure.
About the Customer I have no idea how you can get it.
Cheers
Isitar
Thanks for your reply - i'm glad i'm not the only one! It just seems that some very straight forward things are explained in alot of detail, then some very complex items just say "go away and write the functionality for this....".
Some can be copied from existing funcionality of course, but sadly some can't. It would be good to have the code as an example to refer back to if stuck.
Thanks,
Marc
I think I found a solution
After I had a look at Codeunit 80 (Sales-Post) I found out, that the function was always called in a loop of SalesLine.
So to adapt this, this function will always be called in a loop of SeminarRegLines.
So I think this code could be a solution:
I hope this helps and it is a correct solution
I do agree that it is annoying that the objects don't come with the training material. It would be really helpful to have those.
RIS Plus, LLC
A few things to understand:
The amounts in local currency are usually calculated through the validation code. So if there is an "Amount" and an "Amount (LCY)" field, validating the "Amount" field should be sufficient, and the validation code in that field would take care of the (LCY) amount. Likewise with the "Quantity" and "Quantity (Base)" fields. The validation code in the "Quantity" field should trigger logic to calculate the base quantity. Take a look at the validation in the "Sales Line" table to see how that works. There are functions in there that update quantities and amounts, and these are called from various field validations.
This is usually only done when entering values in the unposted documents. As you can see in codeunit 80, when these values are transferred from the unposted document to the Journal for posting, the values are not actually validated. The system at this point trusts the values in the unposted document, since the field validation has already been done at that time, and the document has had a final validation through the release process.
Make sure you know the big picture: at what point in the process are values validated, and don't over validate.
RIS Plus, LLC
I see now it doesnt always make sense if it is for an instructor lead course! Although it has still been invaluable in teaching myself.
Good luck Isitar