Hello Dojo Community,
For learning purpose, I created user defined api & deployed it successfully where I'm passing element name and action like Mask/Unmask etc. and API working fine with postman and reflecting action on my elements as well.
Now I'm creating an Web App and I want to provide GUI based app to user to perform certain allowed actions(Mask/Unmask/Change Value/etc) from App itself. I created App where Admin can configured actions which is supported by user defined api at element level.
On Element List page, I'm displaying all elements for DMA where user can select one or more elements , also user can select one action Mask/Unmask/etc. from Drop down and can click on execute button.
I'm facing below challenges, please guide me
- I'm not able to make single select drop down, currently I displayed as table as title "Perform Action", Please guide me how can I make it single select drop down.
- is there any direct way to configure button event to call User defined API / rest API or only need to select "Launch a script" option and need to call user defined api from script only?
- On custom defined "Execute Now" button click, how can I pick selected elements name & selected perform action, and how can pass them to script configured through "Launch a script" or user defined api (if & only if user defined api directly supported by button event) ?
Hi Vikas
I'm glad you succeeded in creating your first user-defined API!
To answer your second and third question, you don't actually need to call your API through the low-code app. In the background, you API call will just execute the automation script, and doing this through a user-defined API is adding some extra bloat. Executing automation scripts is supported out of the box in low code apps as the 'Launch a script' action. To pass information to that script you can use script parameters. When script parameters are defined on your automation script, you'll be able to pass them in the action as you can see in the screenshot. (https://docs.dataminer.services/user-guide/Advanced_Modules/Automation_module/Designing_Automation_scripts/Script_variables.html#creating-a-parameter).
You would have to refactor your API automation script to have two entrypoints: the entrypoint for your API that you currently have in there, and the Run method that will be executed when executing your automation script through cube or through your low-code app. Instead of then getting the user data through the rawBody of the requestData of the API entrypoint. You can use the script parameters instead.
We actually have a similar example in the documentation. This example transforms an existing automation script that uses script parameters to a script that can also be executed through a user-defined API. Please only refer to the first two menu items in the example: 'Example script' and 'Using the script with the OnApiTrigger entry point'. The last item is not recommended for your situation. https://docs.dataminer.services/user-guide/Advanced_Modules/User%20Defined%20APIs/Defining_an_API/UD_APIs_Using_existing_scripts.html
Please let me know if anything is unclear or if you have additional questions.
Thank you Wouter Van Robays. 🙂
Thank you Sebastiaan Dumoulein. It’ll be a good feature. Please keep us posted once delivered.
Do we have any work around till this feature is rolled out? like adding radio button for each row and user can select particular row, and will pick selected radio button value in parameter ? if you have any reference, please share.
Thank you for your help & support 🙂
Yes, will definitely update here. I believe you have a decent workaround in place. Another thing I can come up with, is to use a grid component instead. Where every row of your data source can become a button. This was shared during Empower I believe.
Yes, thank you
And to answer the first question, showing GQI results in a drop down is not yet possible. We do aim to have this in the near future. I’ll post an update here when this is available.