Form with a primary BO with two registers


Author
Message
Fabian R Silva, -
Fabian R Silva, -
StrataFrame User (317 reputation)StrataFrame User (317 reputation)StrataFrame User (317 reputation)StrataFrame User (317 reputation)StrataFrame User (317 reputation)StrataFrame User (317 reputation)StrataFrame User (317 reputation)StrataFrame User (317 reputation)StrataFrame User (317 reputation)
Group: StrataFrame Users
Posts: 153, Visits: 1.2K
Hi, I need to save two records on a "primary" object,, 1 record related to some child BOs and the 2nd record to another childs.

If I have a parent-child relation it only will update the child pk with the first parent record pk?

How can I set that I like to set the 2nd record pk to be the parent pk of child BO registers?

I hope that It can be understand (sorry for me bad english)

thanks
Reply
Edhy Rijo
E
StrataFrame VIP (6.4K reputation)StrataFrame VIP (6.4K reputation)StrataFrame VIP (6.4K reputation)StrataFrame VIP (6.4K reputation)StrataFrame VIP (6.4K reputation)StrataFrame VIP (6.4K reputation)StrataFrame VIP (6.4K reputation)StrataFrame VIP (6.4K reputation)StrataFrame VIP (6.4K reputation)
Group: StrataFrame Users
Posts: 2.4K, Visits: 23K
Hi Fabian,

Yes, you are correct about the BO.RegisterForeinKey() method.  For a clear explanation check this Post by Trent where it is explained much better.

how I can set that 1st I like to save the "Invoice" BO and then "Payment" BO to make it the 2nd register every time?

Well when using
the BO.RegisterForeinKey() method, SF will take care of that for you, not matter which BO triggers the saving, it will go up to the parent bo to grab the PK.  But in your case, it would be better for you to manage this logic yourself, create your own Save method using a BusinesLayer Transaction so you can have full control on how information is saved.

Once you have this done, you will be amazed on how powerful and flexible SF Business Objects are.  Using the 2 BO instances will allow you to handle each record based on their transaction type (ex: Invoice or Payment) so you will always know which record you are managing.

Edhy Rijo

GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...





Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search