apiAccessor in Groovy Function

1
0
-1

I'm writing a very simple Groovy Function to return a list, example below:

  1. import org.bonitasoft.engine.api.ProcessRuntimeAPI;
  2.  
  3. def static fn(String processName, String key){
  4.  
  5. ProcessRuntimeAPI processRuntimeAPI = apiAccessor.getProcessAPI();
  6. String processName = processRuntimeAPI.getProcessInstance(processInstanceId).getName();
  7.  
  8. List<Group> groupList = apiAccessor.getIdentityAPI().getGroups(0, 1, GroupCriterion.NAME_ASC);
  9.  
  10. return GroupList;
  11. }

but when I try to use apiAccessor it tells me

  1. Groovy:Apparent variable 'apiAccessor' was found in a static scope but doesn't refer to a local variable, static field or class. Possible causes:

How do I use apiAccessor within a Groovy Function?

Many thanks in advance, regards Se√°n

No answers yet.
Notifications