Morning Folks!
I’m using a row action on a table to create a new row whilst populating its fields with data from the original row. This is working fine except for using a formula field on the original row to populate a field on the new row.
I’ve tried re-querying the model before updating but that hasn’t fixed it - the field comes up blank.
Any ideas?
Cheers!
Louis
Is the field in the model from the original row?
Yes, just double-checked. At first I thought that Skuid was processing the row creation before Salesforce had a chance to evaluate the formula field, but even if the formula field’s determining values aren’t changed as part of the save the value still isn’t populated.
So only some values are making it into the new row?
Is the formula field visible to you? ie. field level security
All values are making it except for this formula field. And yes, I’ve got field level access.
What I’m trying to do is take the original row, click a row action which drops down a drawer which allows you to enter a number. Click a button on the drawer which then saves that row and creates two new rows: one which has a ‘Quantity’ field populated using the number entered in the drawer, another which has the same ‘Quantity’ field populated using a formula which references the number entered in the drawer.
It’s this second row that’s not populating.
er … uh … lost me. Screenshots or video would help.
Working on it! Cheers Pat.
Those fields in the drawer. What model/row do they belong to? Do they get saved?
Yeah, the fields in the drawer belong to the same model as the rows being created. The drawer fields should get saved with the first ‘Save Model’ action which proceeds the row creation actions. I’ve tried requerying the model inbetween the save and the new rows but that didn’t help.
Same model and row? I ask because the moment you make a new row in that model the context merge fields change to that row. So, prior to making rows, save the row and pull that original row into its own model and create the 2 new rows from it. Ie. {{$Model.modelname.data.0.fieldnames}}
Cheers Pat, I’ll give that a try. I get how to use {{$Model.modelname.data.0.fieldnames}} once I’ve got the row in the model, but how do I allocate the saved row into its own model?
Model
Set max records to 1.
Create condition of Id = “” Filderable Default Off
Add fields as necessary.
Actions to add before creating two new records.
I’ve changed it so that I’m saving the original row into a new model and referencing that row in creating the two new rows but it’s still populating all fields except the field that originates from the Formula field. I might try changing the formula into a workflow - see if that works any better.
No. No. The formula works. Something else is going on.
Display that new model and row on the page to ensure that you can indeed see the data. Make sure to use nothing but {{$Model.modelname.etc…}}
Yeehaa! My mistake - it does work, I’d forgotten to add the formula field to the model that the original row gets inserted into as part of the chain of actions. Looks sheepish…
Thanks for your patience Pat - you’re a stalwart and a trooper. If I could, I’d buy you beer.
Cheers!
For anyone else that tries to do things the wrong way - as I was - this here and Pat’s next post is the fix.
I second that motion. We should buy Pat beer.
You said “We should buy Pat beer”
You didn’t say “We should buy Pat a beer”
Really should say “We should buy Pat a lifetime supply of Stronbow Cider”
Just to be clear for others that had this same issue, as this can be confusing:
To use a row action to create a new row/record and default/populate a field with data from the original/parent row/record, the original/parent model needs to contain the field that you are referencing. In other words, the new/child model does NOT need to contain parent__r.source_field__c, but the parent model DOES need to contain source_field__c. The new/child model does need to contain the target field into which the default data is being populated, of course.
Thanks for the clarification Peter. You are correct.
(Nice to see you in these parts again. We’ve missed you)
Wow so glad I found this. Been pulling my hair out for a bit wondering why I couldn’t populate 2nd field on my action. Not sure I would have ended up here!
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.