cancel
Showing results for 
Search instead for 
Did you mean: 

How to use a field using the user suggestion widget ?

pibou_Bouvret
Elite Collaborator
Elite Collaborator

I have a field called reviewers (multi valued string) it is populated thanks to the user suggestion widget i d like to use its content for a setACE operation in a chain but i get a casting error :

No type adapter found for input: class [Ljava.lang.String; and output class java.lang.String

I already made it, but can't remember how 😞

1 ACCEPTED ANSWER

Benjamin_Jalon1
Elite Collaborator
Elite Collaborator

So if you are on 5.4.2, you have 2 solutions :

  • Upgrade your Nuxeo to 5.6 😄
  • Or if you have some development skills create your operation with Nuxeo IDE.

With Nuxeo IDE it will be really quick to do that :

  • I let you look the Nuxeo IDE installation documentation : http://doc.nuxeo.com/x/ZYKE

  • Then you create a new Nuxeo Plugin Project (click on the yellow button > new Nuxeo Plugin name it > next > next )

  • Create a new Operation (click on the yellow button > new Operation > name it > Next > Next )

  • And finally you fill the operation :

    @Operation(id = YourOpertion.ID, category = Constants.CAT_SUBCHAIN_EXECUTION, label = "Run For Each", description = "") public class YourOpertion {

     public static final String ID = "YourOpertion";
    
     @Context
     protected OperationContext ctx;
    
     @Context
     protected AutomationService service;
    
     @Param(name = "id")
     protected String chainId;
    
     @Param(name = "list")
     protected String listName;
    
     @Param(name = "item", required = false, values = "item")
     protected String itemName = "item";
    
     @Param(name = "isolate", required = false, values = "true")
     protected boolean isolate = true;
    
     @OperationMethod
     public void run() throws Exception {
         Map<String, Object> vars = isolate ? new HashMap<String, Object>(
                 ctx.getVars()) : ctx.getVars();
         OperationContext subctx = new OperationContext(ctx.getCoreSession(),
                 vars);
         subctx.setInput(ctx.getInput());
         for (Object value : (Collection<?>) ctx.get(listName)) {
             subctx.put(itemName, value);
             service.run(subctx, chainId);
         }
     }
    

    }

View answer in original post

7 REPLIES 7

Benjamin_Jalon1
Elite Collaborator
Elite Collaborator

Did you try the run for each operation with a sub operation.

unforunately, i'm running a 5.4.2 project and the the "run for each " operation seems to be 5.5

Benjamin_Jalon1
Elite Collaborator
Elite Collaborator

So if you are on 5.4.2, you have 2 solutions :

  • Upgrade your Nuxeo to 5.6 😄
  • Or if you have some development skills create your operation with Nuxeo IDE.

With Nuxeo IDE it will be really quick to do that :

  • I let you look the Nuxeo IDE installation documentation : http://doc.nuxeo.com/x/ZYKE

  • Then you create a new Nuxeo Plugin Project (click on the yellow button > new Nuxeo Plugin name it > next > next )

  • Create a new Operation (click on the yellow button > new Operation > name it > Next > Next )

  • And finally you fill the operation :

    @Operation(id = YourOpertion.ID, category = Constants.CAT_SUBCHAIN_EXECUTION, label = "Run For Each", description = "") public class YourOpertion {

     public static final String ID = "YourOpertion";
    
     @Context
     protected OperationContext ctx;
    
     @Context
     protected AutomationService service;
    
     @Param(name = "id")
     protected String chainId;
    
     @Param(name = "list")
     protected String listName;
    
     @Param(name = "item", required = false, values = "item")
     protected String itemName = "item";
    
     @Param(name = "isolate", required = false, values = "true")
     protected boolean isolate = true;
    
     @OperationMethod
     public void run() throws Exception {
         Map<String, Object> vars = isolate ? new HashMap<String, Object>(
                 ctx.getVars()) : ctx.getVars();
         OperationContext subctx = new OperationContext(ctx.getCoreSession(),
                 vars);
         subctx.setInput(ctx.getInput());
         for (Object value : (Collection<?>) ctx.get(listName)) {
             subctx.put(itemName, value);
             service.run(subctx, chainId);
         }
     }
    

    }

That's what i was about to do.

Backporting new feature is bad...

Feel free to contribute an addon on github for missing operations

Create a new Question please...

Getting started

Attention: Blogs & Forums are in READ-ONLY mode from Oct 9-19 as we transition to our new platform. Learn more.

Find what you came for

We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.