I have a form in Service Catalog that accesses an external database using a plugin and I need to pass the environment (test, QA, production) to the database query. I can determine the environment by using a ReportQuery to get the Service Catalog server name, but I am having trouble getting that derived value passed to the plugin.
What I have tried:
I use a java script function that 1) parses the server name from the ReportQuery to get the environment and 2) sets a text field in the form to that environment. I call that function in the onLoad attribute of the form. I can see the value in the text field when the form gets loaded, but the environment getting passed into the plugin is not that value. The value that gets passed is 'TEST', which is the default value on the text field.
How can I get the derived environment value to pass to the plugin?
Here are the two pertinent form components: Text field
Not sure if you already followed this document for creating the plugins but I hope this documentation could help you achieve your requirement
Hope this helps
Thanks for your input! My issue was getting the dynamic environment to correctly pass into the plug-in. Since I could not figure this out, I added logic to the plugin to determine the environment.
ca_reportQuery is an asynchronous function.
Your problem seems to be that your plugin gets the textfield value before the ca_reportQuery completes
Hope this helps.
Yes, I think you're right.