🎉Community Raffle - Win $25

An exclusive raffle opportunity for active members like you! Complete your profile, answer questions and get your first accepted badge to enter the raffle.
Join and Win

Operator use "Connection" parameter to populate other parameters

User: "klin"
New Altair Community Member
Updated by Jocelyn

Hello!

 

I have an extension operator that takes a "Connection" parameter.  Once the user selects the connection, I'd like to make a call to that connection and use the results to populate a second parameter's drop-down menu choices.  Is this possible?  It seems that all the parameter choices are initialized at once in getParameterTypes().

Find more posts tagged with

Sort by:
1 - 1 of 11
    User: "ey1"
    New Altair Community Member
    Accepted Answer

    Hi @klin

     

    You can certainly populate a parameter list by invoking a call to an API using the connection object selected by the user.

     

    For this, you need to create a parameter of type ParameterTypeSuggestion and pass it an implementation of SuggestionProvider interface. In your implementation class, override the getSuggestions method. In this method, grab an instance of your connection's Configurable instance. You can do this by calling the ConfigurationManager.getInstance().lookup() method with your Configurable type_id and connection name. 

     

    Once you have the reference, you can invoke any API call your connection handling offers and return the results as List of Strings. In your case, that would be a list of languages (English, Spanish etc. whichever is supported). I would also suggest to maintain all client side calls in a separate connection class to keep Configurable class clean. In a similar fashion, you can get a handle on the connection object in your doWork() method to make any other calls on your API when the operator is executed. For all this to work, you will of course also need to register your Configurable in the PluginInit class of your extension, using ConfigurationManager.getInstance().register(new YourConfiguratorClass()) and your YourConfiguratorClass must override the getConfigurableClass() and getTypeId() methods. Please note that the TypeId must be a valid XML tag identifier and file name (use underscore, no spaces).

     

    Hope that answers your question.

     

    Best Regards,

    Edwin