>>
>>At a glance it looks like an appropriate way to do it. You may want however for strong typing to loop through the actual entities though. A foreach loop on each entity in the entityList collection. Then you can refer directly to the entity.property. Not sure why it isn't saving unless the rules are being broken. You may want to wrap the save in a test of mmSaveDataResult so you can verify the rules are getting broken.
>>Tim
>
>Hi Tim,
>
>I just realised that the HookPreSave... may not be the place I really want to do this. My code will run before the rules code gets run so if a rule fails after my code runs then I've got records added to the commissions table but nothing added to the receipt details.
>
>Is there a place that I can run this code after all the rules have passed?
Deja Vu for me Frank. I just struggled with this trying to implement audit logging and the short answer is not really. There is a post save hook but there isn't the same data available as before the save. What I ended up doing is using the PreSaveHook to create my records and then committing them with the post save hook. You may want to do this also. If you need some ideas on that, let me know and I can send you some code snippets for that.
Tim
Timothy Bryan