How to remove default value when field is empty.

Le Son
Tera Contributor

Hi everyone,

I have create default value for a field.

When create new record default value is setting for this field. However, When remove value of field (field = empty) and save record, Record still save is default value.

I want when user create new record and remove default value, record will save this field is empty

1 ACCEPTED SOLUTION

Hi @Le Son 

The behavior you're observing with the Default Value is normal. It's not advisable to try to circumvent it to force the field to remain empty.

Instead, you can utilize the mentioned business rule display. Just ensure that you remove the Default Value when applying the Business Rule.

 

Cheers,

Tai Vu

View solution in original post

12 REPLIES 12

Hi @Le Son that's the first solution i shared, before insert BR,

script:

if(!gs.newRecord())
    {
        current.contact_type ='';// replace contact type to your fieldname
    }

the BR will clear the value after you hit save button, It works fine in my PDI

1.

HarishKM_0-1711081662179.png

2. Save the record. Channel field cleared out

HarishKM_1-1711081694013.png

 

Regards
Harish

Tai Vu
Kilo Patron
Kilo Patron

Hi @Le Son 

That's the expected behavior of the Default Value feature.

Specify a default field value

The default value populates the field on the blank form for a new record, and also subsequently when the new record is submitted if the field is empty. Default values can be specified as either a constant or generated through script.
 
In your case, you can achieve this by implementing a Display Business Rule with the following condition below. And then set the field value accordingly.
 

 

current.isNewRecord();

 

 

Cheers,

Tai Vu

Le Son
Tera Contributor

Hi Timi,

Can you explain in more detail?

Hi @Le Son 

There you go.

Timi_0-1711082823001.pngTimi_1-1711082827685.png

 

Cheers,

Tai Vu

Le Son
Tera Contributor

Hi Timi,

I still can't save empty values.

I create a new record, before saving I delete the value, then I save the record.

After I save the saved record value is the non-empty default value