Update:
Since you are using Workflow, you can use the functions listed on the following page:
http://www.salesforce.com/us/developer/docs/pages/Content/pages_variables_functions.htm
Try using the ISBLANK
function: pass any field into it, and if it is NULL
or empty (""
), i.e. has LENGTH = 0
, the function will result to true
, else it yields false
.
EDIT : This answer is for Apex, not Workflow.
You can use comparison operators or a nifty String
instance method
Examples:
string t1='';
string t2=null;
string t3='i am not blank';
// so you can see the results
if(t1==null)
system.debug('t1 is null');
else
system.debug('t1 is not null');
system.assertEquals(false,t1==null);
// so you can see the results
if(t2==null)
system.debug('t2 is null');
else
system.debug('t2 is not null');
system.assertEquals(true,t2==null);
// try this nifty string method
system.debug('t1 = "'+t1+'" -- String.isBlank(t1) = '+string.valueOf(String.isBlank(t1)));
system.assertEquals(true,String.isBlank(t1));
system.debug('t2 = "'+t2+'" -- String.isBlank(t2) = '+string.valueOf(String.isBlank(t2)));
system.assertEquals(true,String.isBlank(t2));
system.debug('t3 = "'+t3+'" -- String.isBlank(t3) = '+string.valueOf(String.isBlank(t3)));
system.assertEquals(false,String.isBlank(t1));
See here for String Instance Methods.