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.
But honestly I have no idea how to continue from here on.
Best regards
Pasqual
Page 1 / 1
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
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
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
Hi Yeshwanth.
Sorry for the delayed answer but I was a little busy.
You solution works very well. Thanks alot.
Pasqual
Hi @Yeshwanth.
I need help with this again. I already created a new topic on this but got now answer for 26 days.
I know this is going to be a double post but anyway I am going to copy&paste it here:
I have a workflow in which I am creating a dynamic PopupInput. Here is some pseudo code similar to that what I am using:
This works well so far. But I am struggling to get the output of the PopupInput because the entry “INPUT1” seems to not exist. I tried a few things within a “Script” activity or even in the OnComplete Script of the PopupInput. For example I iterated through “activity.getForm().getEntries()” but the entry “INPUT1” did not exist. But nothing has been working.
Does anybody know how to get the value of my entry? (Remember: That is just pseudo code. In reality I am generating many input fields completely dynamically and cannot generate a static PopupInput.)
I have found the answer myself. Have a look into this post: