I have a workflow with a complex type attribute, default value was null for the attribute, I want to run a script task to print current workflow token's attribute values by invoking method WorkflowToken.getAttributes(). Don't say to bind attribute with input/output parameter of script task than use the attribute directly, My objective is to create a generic action to do that thing. My script is:
var token = workflow; System.debug(token); if(token == null) { throw "No workflow token found"; } System.debug("startDate: " + token.startDate); var attributes = token.getAttributes(); if(attributes == null || attributes.keys.length == 0) { throw "No attribute found for current workflow."; } System.debug("found " + attributes.keys.length + " attributes from current workflow."); var keys = attributes.keys; for (var i in keys) { var curKey = keys[i]; var curValue = attributes.get(curKey); System.debug("attribute key: " + curKey + " attribute value: " + curValue); } System.debug("attribute key: " + curKey + " attribute value: " + curValue); }
When I don't set value for the complex type attribute.
I could retrieve the attributes and get and null value of the complex type attribute.
But once I set value of the complex attribute.
I got error when running the script task.
I have tried many kinds of complex type, still get same error,I suspect if there's defect on vRO to retrieve complex type attributes from workflow token, or is there anything I missed? Can someone help me?