Just curious what the best practice is with node assignment and dealing with null or undefined values. We have a capital req approval flow that is based upon the reqline_PO_CODE -- We assign reqline_PO_CODE to a variable called PO_CODE and then in a branch node check the value for that variable. In the assignment node we had:
Variable name: PO_CODE
Variable type: String
Variable value: reqline_PO_CODE
This would work fine when the requisition had a PO_CODE but would error with "Error evaluating expression..." if the requisition didn't have a value. Basically it was null. So I was going to change the Variable value to :
Variable value:
if (typeof reqline_PO_CODE == "undefined") { null } else { reqline_PO_CODE }
Or should I use some other method?
function DataCheck(queryField) { var goodValue = String(queryField); if (typeof(goodValue)=='undefined' || goodValue=='null') { goodValue = ''; } return goodValue; }