Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Best way to Add New Records in Related BO/Table
Message
From
26/11/2010 16:47:22
Timothy Bryan
Sharpline Consultants
Conroe, Texas, United States
 
 
To
26/11/2010 14:51:27
General information
Forum:
ASP.NET
Category:
The Mere Mortals .NET Framework
Miscellaneous
Thread ID:
01490394
Message ID:
01490625
Views:
35
>>
>>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
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform