I try to use dynamic background form JobInfos variables workflow to template.
For testing I use constant string since the JobInfos does’nt exist during design.
When I run the template from the workflow, the Jobinfo stay empty…
var result = “”;
result = automation.jobInfos.JobInfo2;
if (result == “”)
result = “C:\Temp\job0109OO563G20DC333AE5FB5.dat.pdf”;
result = “file:///” + result.replace(/\/g,“/”);
var background = merge.template.contexts.PRINT.sections[“Section 1”].background;
background.source = BackgroundResource.RESOURCE_IMAGE;
background.allPages = true;
background.url = result;
Are you outputting a web page? Automation.jobInfos.JobInfo2 will only work in a Web context or in your Datamapper.
Now if you want to use it in a Print context, then you can get the value from your Datamapper and then store it into a field of your datamodel. Better yet, pass it as a runtime parameter.
So, in case of Print context you need to set up the automation.jobInfos.jobInfo2 from the Datamapper to a field in the datamodel in order to have access to it from the Template.
Runtime parameters are accessible directly from the Template, which, to me, is better!!!
Ok, I create a create print action in my worflow and pass the fulname of my background PDF by parameter.
Template ignore it…
Or I don’t know where the action put the PDF result…
var result = “”;
result = merge.template.parameters.pdfDocument;
if (result == “”)
result = “C:\Temp\job0109OO563G20DC333AE5FB5.dat.pdf”;
result = “file:///” + result.replace(/\/g,“/”);
var background = merge.template.contexts.PRINT.sections[“Section 1”].background;
background.source = BackgroundResource.RESOURCE_IMAGE;
background.allPages = true;
background.url = result;
No problem…that is the reason for this forum and very often we find our own solution, we just need to explain it to someone else and we see our mistakes…I know I do!