Hi,
I have a template that uses three images. These images need to change based on the filename containing a certain keyword. I created a preprocessor field/extract step that is set to automation.variables.dataName. I then created the following script.
var data;
data = record.fields[“dataName”];
if (data.includes(“Current”)){
results.attr(“src”, “images/Flysheet_INTERNAIONAL_CURRENT.pdf”);
} else if (data.includes(“Last Copy”)){
results.attr(“src”, “images/Flysheet_INTERNATIONAL_last issue”);
} else if (data.includes(“2 to go”)){
results.attr(“src”, “images/Flysheet_INTERNAIONAL_2_to_go.pdf”);
}
The script has a selector called #dynamicImage. I dragged a image to the templates print context section 1 and added dynamicImage to its ID in the attributes pane. If I change the default value of field to Current, then in the designer the image changes to the Current image when previewing.
However from workflow it does not change the image, it instead uses the first image that I added to the template. I did add a local variable in workflow called dataName and set its value from a jobinfos in a script like this.
var dataFileName = Watch.GetJobInfo(9);
Watch.SetVariable(“dataName”, dataFileName);
The jobinfo 9 above is populated with %O.
I’m not sure what is wrong here, you advice will be appreciated.
Regards,
S