AnsweredAssumed Answered

Compare dropdown value in logic hook

Question asked by derrickoltmann derrickoltmann on Dec 10, 2014
Latest reply on Dec 10, 2014 by derrickoltmann derrickoltmann
How do I compare the string value of a field in a logic hook?

I'm trying to change the list view value of a field if the EIN field is empty and the account type = "Vendor"

I have the following running on a process_record logic hook, however it will set the field to "-Missing-" if the EIN field is empty, regardless of the account type.

ein_c;    $var_name = $bean->account_type;    $array = $GLOBALS['app_list_strings']['account_type_dom'];    $accountType = $array[$var_name];        if (empty($einValue)){     if($accountType = "Vendor") {      $bean->ein_c = '-MISSING-';     } else {      $bean->ein_c = $einValue;     }    }    } 

  I would also like to have it set "-ERROR-" if the EIN field is less than 9 chars, but getting stuck just trying to compare the string. 
  I've tried setting the ein_c field to the $accountType, for which it returns blank, however I'm still getting through the condition.