Devi
Devi

Reputation: 1

Need to fetch multi enum value for every work item

In my report i need to print yes or no values by fetching values from multi select enum custom field for every work item ,if work item's custom field has value then need to print as yes into the column ,else print as No, similarly need to check for each for each work item .

I am using the below code snippet , but its not working , can anyone please help me to resolve this As soon as possible .

#foreach($ref in $refList)

  #set($refWi = $transaction.workItems().getBy().oldApiObject($ref))
  #set($arr=[$refWi.fields().get("Values")])

  #foreach($item in $arr)   
    #if($item == "Tablets")
      #set($isTablet = "YES")
    #else
      #set($isTablet = "NO")
    #end
  #end
#end

Printing the YES/No value .

Upvotes: 0

Views: 143

Answers (1)

vksep2
vksep2

Reputation: 1

By doing below it seems to me that you put an array into another one, therefore $arr is a matrix of a single $item that will be what $arr should have been.

#set($arr=[$refWi.fields().get("Values")])

Considering this is an old topic and probably you fixed the issue already, it would be nice to know for others that may come to this topic, which was the solution.

Upvotes: 0

Related Questions