Update field with Custom Component?

  • 1
  • Question
  • Updated 4 years ago
  • Answered
I used this posting to come up with a simple calculation in a custom component that works great! Now I would like to update a field in a new record with the result of the custom component.

I attempted to use a Multiple Actions button to create new and then update a field on row(s) with the component name as the value, which did not work. Is this possible and am I on the right track?

Thanks.
Photo of Chelsea Curtis

Chelsea Curtis

  • 1,300 Points 1k badge 2x thumb

Posted 4 years ago

  • 1
Photo of Rob Hatch

Rob Hatch, Official Rep

  • 44,006 Points 20k badge 2x thumb
Chelsea - since you are already in Javascript doing the calculation - you should just add a few more lines to update the row with the new value. 

Assuming the caculation produces a variable named "value"  you can use code that looks like this. 

var model = skuid.model.getModel('YourModelName');
var row = model.getFirstRow();
model.updateRow(row, {ReferenceFieldName:value});

(Edited)
Photo of Chelsea Curtis

Chelsea Curtis

  • 1,300 Points 1k badge 2x thumb
Awesome. Thanks Rob!