My current attempt at building this expression fails with a message
"failed to evaluate". I'm guessing this is because nothing is being
returned by my code. (It would be great if someone could explain to me
how to troubleshoot my my script by echoing values to the jboss screen.)

I have a manually structured, multi-valued attribute. I'm trying to
replace just one of the values but I have to loop through all of the
values, split the value into its elements and compare against just one
of those elements. On a positive match, I want to return the complete
attribute value so I can pass it to an Entity Activity that will remove
just this value.

I've tried a few things but this is my last attempt:

### Start Code ###
function getAssocation(resourceAssociation,currentResource)
var i;
for (i=0;i<=resourceAssociation.length;i++)
var thisAssociation = resourceAssociation[i];
var thisResouce = thisAssociation.split("#")[1];
if (thisResource == currentResource)
return thisAssociation;

var resourceAssociation = IDVault.get(recipient , 'user',
var currentResource = flowdata.get('resourceDN');

if (resourceAssociation.length > 0)
getAssociation(resourceAssociation,currentResource );
### End Code ###

Basically the attribute value has several values separated by a "#".
The second value is a DN that I want to match on. If I find a match, I
want this expression to return that entire attribute value.

Hope that makes sense and thanks in advance!!