cancel
Showing results for 
Search instead for 
Did you mean: 

How to get the latest child record from parent-child MDF

dmak
Participant
0 Kudos

Using business rules, how do you detect edit operation on a child custom mdf object (there is a parent object but all the information are stored on the child)?

We want to implement a business rule to prevent people from editing what has already been saved and only allow inserting new child objects.

On business rule, we found that both edit and insert triggers insert and correct context operations, so that didn't help.

I tried detecting if certain field is blank on save but the business rule always detects the first entry on the child object instead of the latest edition, so it's never blank.

I know the child objects are stored as a collection, is there a way to find the last object in the collection via business rule?

Accepted Solutions (0)

Answers (2)

Answers (2)

Umesh1
Participant
0 Kudos

Hi,

We followed the below approach for such scenarios.

We created an onchange rule for an mandatory child field and verified if external code of the child object is filled or not.

If the childObject-externalCode is null its an new child object

If the childObject-externalCode is not null its an edit in the old child object

Hope this helps.

Regards,

Umesh Chaudhari.

haroldyrureta
Participant
0 Kudos

Hi!

You can do the following:

1. Create a boolean or picklist field in the object definition for the child MDF, this field could be hidden in the UI. For example: Is record create?

2. Create a bussiness rule for the child MDF as always true and complete the new field with the value "Yes", then assing this rule as onSave on the child MDF object.

3. Create a rule in the UI with the if statement saying "If Is record created? equals Yes", then the other fields should be edtable as No.

4. Assing this rule as onInit in the UI.

In case any something is not completely clear feel free to reach me.

Kind regards.

egitoyo
Discoverer
0 Kudos

Hi Harold,

So I have a similar issue with this one, I already assign the rule within the UI, and it succeeds for the first child, when I have multiple child, the editable as No, only impact to first child, not to other child. Is there any missing in rule or configuration setting?

Best Regards,