Skip to main content

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 😵 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 ?

Rahul,

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!


Hi Rahul

If the user presses save twice the save process gets interupted and starts working on the remaining values in the metadata. What you might want to do is to set an additional action on the custom save that will update a Ui only field to true and then disable the Save button based on the true value.  This should stop the users from pressing the save button twice.  The other method, and probably the best one, would be to use multiple actions on your save button and block the Ui (with a message Saving…) until the save is complete and then unblock the Ui after.

Good luck 


Hi Gregg, thanks for you response and I have resolved the issue with the Blocking UI feature. But Still I have question in my mind that why user is allowed to click two times on Save button ?

Ideally once the Save is clicked, User shouldn’t be able to click it again, but this is something strange what I have seen on Save button. Another thing is what exaclty is Clone_1 which got appended in the ID in the URl ?

your inputs will be highly appreciated.

Regards,
Rahul


Hi Rahul


The Save button is an independent component and is customisable. To make it not active after a single execution would be limiting to some other type of functionality that it could be used for.


Clone_1 is the Salesforce backend code that generates this extension. You can use multiple actions in Skuid and when you save the record you have the opportunity to use your own naming conventions.



Good luck.


Reply