Hi All

Hi All, We have a skuid detail page, in that page we have parent records displayed, for every parent record we are displaying child records in a Drawer. in Child records we have a field X(Currency), this currency field value should be equal to the field value of parent field Y(Currency). We are using inline record creation for the child records. so when user creates more then one child record he should match the value of X to Y . For this case we have written trigger, in case of insert and update trigger is working perfectly and displaying error if the values of (Sum of X) for child records is not matching with Y. But in case we try to update on e record and insert another record to match the value, this use case is not working. Could some one please assist on the same. Also when we open the drawer its just getting collapsed when user is trying to enter the value. Is there a way where we can make drawer in some way where opening and closing the drawer is in user control ?


I’m getting a little lost in the description. Perhaps some pictures would help?

From what I understand, you want the default value for a field on the child record (in the drawer) to equal the value of a field on the parent record. Is that correct?

THanks for the response Matt.

I have one currency field(X) on Child and one field on Parent(Y). Now What I want is the 
Sum of X(i.e. sum of currency field of all the child) = Parent Currency field value Y.
if Sum of all child is not equal to Y then error would be thrown.

I have writen a trigger which is working fine in the case of Insert and update. But when there is a inline creation enabled, and I am trying to insert a record and trying to update the another record at the same time, trigger is not working perfectly. My assumption is two DML can not be performed at the same time. But if there is any way we can do client side validation, it might help us.

Please let me know in case of any doubt.

You can do it client side, and there are probably a bunch of different ways to do this, but here’s the first thing that occurred to me:

Clone your child model and make it an aggregate model instead of basic. You just need one aggregation, the sum of X, and no groupings. Also ad a ui-only formula field, to return your error text if the sum of X doesn’t match the parent (for the fomula, you should be able to access the value of Y with a model_lookup function, I tried something like this: 

IF({{{sumExpectedRevenue}}}!= MODEL_LOOKUP("Account","RandomCurrencyValue","Id",{{{$Model.AgOpportunities.conditions.0.value}}}), "Error: Sum of Opportunities must match Random Currency Value of Account.", "")

You can add a field editor (or maybe a rich text component) on the Ag Model to your drawer to show the error text. Make sure that you set up your drawer to appropriately assign condition values and query models. And set a model action on the basic child model to query the Ag Model everytime a new row is created or X is changed.

I didn’t completely text, but I think something like that should work!