Use dynamic variable values in robotics-flow plugin
This instruction describes how to troubleshoot the issue when the robot class code taken to a variable on top of the robotics-flow plugin cannot pick a dynamic variable value used in the plugin.
Sample business case
Assume you need to download PDF notices and save them in a shared drive location, accounting for the policy numbers. This requires performing the following actions:
Extract data (policy numbers, for example, A12344455, F3445666) from SQL and save it in a WorkFusion Data Store, which is then used in the web application to generate the PDFs.
Run the loop on the web application to download the PDFs one by one and save them to the shared drive with their respective policy numbers.
However, an issue occurs when a user cannot save the PDFs to the shared drive based on their policy numbers.
Required resolution: the user needs to get the robot code to access the <robotics-flow> plugin, which should pick the dynamic variable value of the policy number. As a result, all the PDFs can be saved, one by one, to the shared drive together with their policy numbers.
note
This is just one use case example. However, the dynamic variable values can be used in different parts of the same or another use case.
Resolution
warning
The selenium-flow and selenium plugins are deprecated. Instead, use the robotics-flow and robot plugins accordingly.
The below workaround runs fine with the sample code:
<var-def name="pdf2">
//The %s will be replaced by the formatter
String theString ="\\\\USBDYNAS01B.ACEINS.COM\\landata\\RA-NOC\\Output\\NOC\\NOC-PDF
NOTICE OF CANCELLATION %s.pdf";
</var-def>
<selenium-flow>
<selenium start-in-private="true" close-on-completion="false"
browser="internet explorer" name="seleniumDriver3">
<selenium start-in-private="true" close-on-completion="false"
browser="autoit" name="autoitDriver1">
<script><![CDATA[
//String theString ="\\\\USBDYNAS01B.ACEINS.COM\\landata\\RA-NOC\\Output\\NOC\\NOC-PDF
NOTICE OF CANCELLATION "PolicyNum".pdf";
import java.util.concurrent.TimeUnit;
import com.thoughtworks.selenium.*;
.....
aiDriver = autoitDriver1.getWrappedObject();
String PolicyNum = "BPTesting11"
//Replace fromatted string:
String scriptBody = String.format(pdf2.toString(), PolicyNum)
//Execute the script with adjusted file path:
aiDriver.executeScript(scriptBody, "GROOVY");