Solved

Workflow: Create PopupInput with Java?

  • 25 August 2023
  • 4 replies
  • 35 views

Badge +3

Hi community.

 

I would like to know how I can dynamically create a PopupInput with java code. Example use case: At first I fill a variable (list) with values (e.g. from a db query). Let’s assume the value of this variable is: Value1, Value2, Value3. Now I need to ask the for information for each single value with a PopupInput like in the screenshot below.

 

 

 

I would guess that I need to start like this:

import commvault.cte.workflow.dom.WorkflowElement;

WorkflowElement PopupInput = WorkflowElement.parse(...

 

But honestly I have no idea how to continue from here on.

 

Best regards

Pasqual

icon

Best answer by Yeshwanth 1 September 2023, 10:56

View original

4 replies

Badge +2

Hi @Pasqual Döhring ,

Can you try something like this?

 

import commvault.msgs.App.XMLSchema;
import commvault.msgs.App.InputControlType;
variableInputs = xpath:{/workflow/variables/popupInputs};
int serial = 1;
for(int i=0; i < variableInputs.size(); i++){
        XMLSchema input = new XMLSchema();
        displayName = variableInputs.get(i);
        name = "INPUT" + Integer.toString(serial);
        input.setInputName(name);
        input.setHidden(false);
        input.setControlType(InputControlType.TEXTBOX);
        input.setDisplayName(displayName);
        input.setRequired(true);
        activity.getForm().getEntries().add(input);        
        serial++;
    }

 

Thanks,

Yeshwanth

Badge +3

Hi Yeshwanth,

 

thank you for the code. In general this looks promising. Unfortunately it fails at the point when it tries to add the “input” to the PopupInput because we never created that. So I still need a possibility to create the PopupInput at all. And of course I need to show it and need a way to catch the results.

 

I get this error message when executing this code “activity.getForm().getEntries().add(input);”:

 

Thank you.

Pasqual

Badge +2

Hi Pasqual,

 

You need to create a Popupinput activity by dragging and dropping it. Then you can add this code in onStartScript of that activity. 

 

Thanks,

Yeshwanth

Badge +3

Hi Yeshwanth.

 

Sorry for the delayed answer but I was a little busy.

You solution works very well. Thanks alot.

 

Pasqual

Reply