Saving UI only field result in a SF Field

  • 2
  • Question
  • Updated 3 years ago
  • Answered
Can't find an answer to that question anywhere, so thought it would be worth a shot asking.

I've created some sort of Calculator, using a couple aggregate fields and Mostly UI only field to be able to get results live (without having to save)

Now, i'm trying to find a way (if even possible) to be able to send that info when necessary to normal SF fields on an object, so we can capture the data.

Would anyone know if even possible, and If yes, maybe point me in the right direction?

Thank you
Photo of Dave

Dave

  • 5,538 Points 5k badge 2x thumb

Posted 3 years ago

  • 2
Photo of Anna Wiersema

Anna Wiersema

  • 10,890 Points 10k badge 2x thumb
Hmm... I don't think it would be to difficult to do something with the Action Framework where when a button is pushed, the real salesforce fields are fed those values, for example through "Update row on Model" conditions using templates, e.g. if your Ui Only field is "Discount"  you could pull in the value using merge syntax {{Discount}}  and use that to update the SF field.


Does that make sense?
Photo of Zach McElrath

Zach McElrath, Employee

  • 48,984 Points 20k badge 2x thumb
Yes this is totally possible --- the way I usually do this is through Model Actions.

Let's say your Ui-Only field is called "Amount_Formula" and you've got a real SF field called "Amount". Here's what you do:

Add a Model Action on your Model. Set "Initiating Events" to "Row in Model updated" and for Fields, select "Amount_Formula". Then add a single Action, "Update row(s) in Model", where Model is set to the same Model and the value is set to {{{Amount_Formula}}}

What this means is that whenever your "Amount_Formula" Ui-Only Field changes, its value will be dumped into the "Amount" real SF Field.
Photo of Dave

Dave

  • 5,538 Points 5k badge 2x thumb
Ty for info both of you,

My use case is closer to the one that Anna proposed, as I do not need to always save the data from ui fields. Therefore a button will be very useful

I'm thinking to do the following when the button is pushed, hopefully it will be doable. I want the button to create a new record on a related object each time it's pushed

I will try it soon, but here's Action logic I'm thinking of using, pls let me know if you see any problems, as this is still new to me

1-Create a new row in another model , let's call it "snapshot".
2 Update row fields with all fields necessary  (there will be about 10-12 different fields needed to be dumped over + Account ID) -{DO I need to create 1 action per field I want to update?)
3-Save Model


Thx
Photo of Dave

Dave

  • 5,538 Points 5k badge 2x thumb
Just for posterity, in case someone needs it in the future

The logic I listed above worked, but 1 important details that took me a little while to figure out

In order to call in the value from another model i had to use a different syntax, then what was proposed above

{{$Model.YOURMODELNAME.data.0.YOURFIELD}}
Photo of Matt Sones

Matt Sones, Champion

  • 31,478 Points 20k badge 2x thumb
Dave,

Just a quick note... you can pass the values to the new row within the "Create new row" action. You'll notice a + sign next to the create new row action in the framework, which allows you to specify "conditions" for that new row. Instead of creating a dozen update field actions, you can do it all in one create row action.
Photo of Dave

Dave

  • 5,538 Points 5k badge 2x thumb
Ty Matt,

That is actually what I did yesterday , but tyvm for info :)