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 the 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 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 to be used in the web application to generate PDFs.
Run the loop on the web application to download PDFs, one by one, and save them to the shared drive with their respective policy numbers.
However, an issue occurs when users cannot save PDFs to the shared drive based on their policy numbers.
Required resolution: users needs to get the robot code to access the <robotics-flow> plugin that should pick the dynamic variable value of the policy number. As a result, you can save all PDFs, one by one, to the shared drive together with their policy number.
This is just one use case example. However, dynamic variable values can be used in different parts of the same or another use case.
Resolution
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");