pass jobinfo /email addres to pdf document

Hi all,

I have some flows created, the structure like below.
(1) Email input flow, M365 input… some dirty code…save pdf attachement to different folders
(2) Folder capture from (1) then execute datamapping, output the xml to a folder.

I can gather the email sender /subject from (1),
and I want the output xml file contain the email sender/subject information in the extract data.
is there any method to get it done under workflow ?

Best regards,
Joey Tsui

Add the email sender/subject to the PDF metadata using a Workflow script.
Then when you pick up those PDF, extract the metadata from it and pass it as a runtime parameters to the Datamapper.

Add keywords to PDF metadata:

set MyPDFInfos = CreateObject(“AlambicEdit.PdfInfos”)
set MyPDF = Watch.GetPDFEditObject
MyPDF.Open Watch.GetJobFilename, False

MyPDFInfos.Keywords = “KeyWord1;Keyword2”

MyPDF.SetInfos MyPDFInfos
MyPDF.Save False
MyPDF.Close

Extract keyword from PDF metadata:

var myPDF = Watch.GetPDFEditObject();
myPDF.open(Watch.GetJobFileName(),false);

var meta = myPDF.GetInfos();
Watch.SetVariable("keywords",meta.keywords);

myPDF.Close();

Of course, if you kept all of this inside a single process, you could do the following:

1- Email input flow, M365 input… some dirty code…
2- Add the email sender/subject to local variables
3- Call the Datamapper and pass it the email sender/subject as runtime parameters
4- Voila!

thank you so much. i will try it.

the email input flow

set MyPDFInfos = CreateObject("AlambicEdit.PdfInfos")
set MyPDF = Watch.GetPDFEditObject
dim myVar
myVar = Watch.GetVariable("varEmail") &";" & Watch.GetVariable("varSubject")
MyPDF.Open Watch.GetJobFilename, False

MyPDFInfos.Keywords = myVar

MyPDF.SetInfos MyPDFInfos
MyPDF.Save False
MyPDF.Close

the folder pdf capture flow

var myPDF = Watch.GetPDFEditObject();
myPDF.open(Watch.GetJobFileName(),false);

var meta = myPDF.GetInfos();
//Watch.SetVariable("keywords",meta.keywords);

var str = meta.keywords;
var str_array = str.split(';');

Watch.SetVariable("varEmail", str_array[0]);
Watch.SetVariable("varSubject", str_array[1]);

myPDF.Close();

It’s work, thank you very much.

then, i pass the variable to jobinfo, and get it from data mapper, right ?

No need, simply put the variable as runtime parameters.

1 Like

sorry, i have 1 more question, is the below config in datamapper correct ?

Does it work? then yes :wink:

Can’t really tell you if the config is good as I have no idea what you want from it but you dont really need to put the content of a runtime parameter into a field in the Datamapper.

You can simply call it when needed by calling it through a script.

You then need to ask yourself, do you need it in your Datamapper or in your Template? If the latter, then pass it to the runtime parameter of the Template, not the Datamapper.

the way you have done it now is that the paramter will be available only if the Condition2 is met.