Get field editor value on model save

  • 1
  • Question
  • Updated 4 years ago
I have a field editor where I review the detail of record stored in a model.  When I save the model, I need to update the "Status__c" field by checking all of the fields in the model.  I'm using a Snippet, but I'm not sure how to do this.  The snippet needs to review only the current record and eventually output a status based on the data.  It will need to review only the fields that I will require, so I'll need to be able to identify specific fields.  I will also need to tell if certain fields are null or not.  Can anyone start me in the right direction?
Photo of Scott

Scott

  • 2,722 Points 2k badge 2x thumb

Posted 4 years ago

  • 1
Photo of Rob Hatch

Rob Hatch, Official Rep

  • 44,006 Points 20k badge 2x thumb
Going the snippet route is correct here. 

Use our model API to call the fields from the record. 
Use basic If - Then logic in javascript to choose an appropraite status value. 
Use our field renderer to put the value into the status field.  

Code somthing like this: 
skuid.ui.fieldRenderers.TEXT[field.mode](field, value); 
Look at this forum post for more fleshed out ideas:  https://community.skuidify.com/skuid/topics/custom_field_renderer_simple_math?topic-reply-list[setti...
 
Photo of Scott

Scott

  • 2,722 Points 2k badge 2x thumb
is there a way to render the model field, rather than having to render the field in any place it appears?  The Status is displayed in multiple spots.
Photo of Rob Hatch

Rob Hatch, Official Rep

  • 44,006 Points 20k badge 2x thumb
I'm not exactly sure what you are asking.  But I think the custom renderer on the one field will actually save the calculated value to the database.  Then wherever that field is displayed on the page it will be updated.