Field Level Validation - Empty Field Check

Posted by IramK on 08-Jan-2016 03:53

Hello,

I have field level validations on various fields and I would like to check whether the field is empty or not. I have managed to compare the field's token value with an empty value and that works when I am on the form, however if I try to create a record using rbf_createRecord(), the field validation kicks in and fails the record creation process because the empty value it is looking for is "null" and not an empty string "". So my question is, what is the best way of approaching this empty field value comparison in a field validation such that I can cater for both these (or any other) situations? Kindly let me know.

Cheers.

Iram

All Replies

Posted by Nitin Kumar Singh on 08-Jan-2016 04:59

Hi Iram,

What are the Trigger Timings for your field validation ?

If it's Before Create and you do not want records to be created with field "abc" being empty, you can check :  'Always require a value in this field in order to save a record' in Advanced Field Properties under Field "abc" : Edit page.

For trigger timings: Before Update you could use result from rbv_api.isFieldEmpty(objName, objId, fieldName) to check if your field is empty.

Regards,

Nitin

Posted by IramK on 08-Jan-2016 05:06

Hello Nitin,

I never mentioned that I am using triggers to validate fields. Its the validation on the field itself.

I cannot use the Advanced Field Properties because the validation is based on a condition i.e. the field is required only if a condition is satisfied.

I have used rbv_api.isFieldEmpty(), but like I mentioned above, it returns "null" and cannot be used to compare it with empty strings on the page.

Any other suggestions?

Iram

Posted by Mohammed Siraj on 10-Jan-2016 12:34

As discussed, rbv_api.isFieldEmpty is not supported in validation scriptts.

However, empty field check is broken for numeric fields as an UNSET numeric field is returning value '0' when used in validation server-side rules. Will treat this as a defect & address it in forthcoming releases.

Posted by IramK on 11-Jan-2016 03:26

Hello Siraj,

Thanks for your reply. So I should be using ("{!fieldIntegrationName}" === "") to compare against all empty fields, correct? Also what would be an alternative solution for numeric fields for now?

Cheers.

Iram

This thread is closed