Best way to set value of field to null/blank?

  • 2
  • Question
  • Updated 3 years ago
  • Answered
Archived and Closed

This conversation is no longer open for comments or replies and is no longer visible to community members. The community moderator provided the following reason for archiving: This has been resolved in Rockaway 8.11

I'm trying to use an update field on row action to set a text field to blank or null, but it doesn't seem to be working. The value doesn't change. What am I missing? Is there a better way to set values to blank/null?

<action type="updateRow" fieldmodel="UrsulaAppointment" field="Baby_1_BPD__c" enclosevalueinquotes="false" value=""/>
Photo of Matt Sones

Matt Sones, Champion

  • 31,954 Points 20k badge 2x thumb

Posted 4 years ago

  • 2
Photo of Rob Hatch

Rob Hatch, Official Rep

  • 44,588 Points 20k badge 2x thumb
Currently you cannot update the reference field to a blank value just with the use of the action framework.  You need to write a snippet to do this. 

Somthing like this: 

var $ = skuid.$,
     model = skuid.model.getModel('Opportunity'),
     row = model.getFirstRow();
model.updateRow(row, {AccountId:''});
Photo of Matt Sones

Matt Sones, Champion

  • 31,954 Points 20k badge 2x thumb
Thanks, Rob. Is that same true for text fields?
Photo of Rob Hatch

Rob Hatch, Official Rep

  • 44,588 Points 20k badge 2x thumb
Yes it is true for all types of fields where you want to remove the values completely.  Booleans will probably want to be set to false, numeric fields will want to be set to 0,  but everything else will need the javascript. 

We'll fix it. Don't worry.  It just might be a while. 
Photo of Matt Sones

Matt Sones, Champion

  • 31,954 Points 20k badge 2x thumb
Thanks! Not worried. Javascript is no longer as fearsome as it once was.
Photo of Chandra V

Chandra V, Champion

  • 7,526 Points 5k badge 2x thumb
Hi Rob, I am using UI fields for a fancy multi-model analytics filter.  My user can pick a filter value and "search" (uses a snippet to activate conditions on multiple models) but if they clear the value from the UI picklist or Ref field they get no results instead of the expected ALL results.  It sounds like properly setting the fields to Null is my problem.  You mentioned that this would be fixed... has it yet?  If not, I'll try the javascript approach.  Thanks!
Photo of Rob Hatch

Rob Hatch, Official Rep

  • 44,588 Points 20k badge 2x thumb
So,  we haven't made a direct change to the update field value action.  But Pat Vachon has pioneered a method we though was ingenious. 

1. Create a UI only field that has a blank value. 
2. Have your action that is intended to blank out the filter value actually copy the value of the "blank" value UI field. 

Otherwize the snippet above works
Photo of Matt Sones

Matt Sones, Champion

  • 31,954 Points 20k badge 2x thumb
Pat is a genius.
Photo of Pablo Martinez

Pablo Martinez

  • 2,468 Points 2k badge 2x thumb
you can also update directly to {{blank}} (also Pat's idea)

(Edited)
Photo of Irvin Waldman

Irvin Waldman, Champion

  • 9,016 Points 5k badge 2x thumb
There are valid use cases to clear out fields.  We should not have to resort to JavaScript in order to support this use case. 

+1
Photo of Kailas

Kailas

  • 330 Points 250 badge 2x thumb
Hi Rob,

Can u plz help me on below scenario which is similar to this thread

Want to make lookup field(Client) value as blank when user select picklist field (Is client dependent) value as 'No'.

tried with above snippet & model action to update the field to 'blank' but here the client field considering field value as 'blank' and the same reflecting in email notification.

Requirement: When user select "Is client depent" picklist value as 'No' then 'client' field should become null (empty value) and email notification should not show any string.

Thanks
Kailas
Photo of Karen Waldschmitt

Karen Waldschmitt, Official Rep

  • 8,710 Points 5k badge 2x thumb
Hi all~

This has been resolved in Rockaway 8.11 which is available at skuid.com/releases.

Thanks again for reporting this!
Karen

This conversation is no longer open for comments or replies.