Workflow (connect) javascript or vbscript

Hi guys,

I need to add a attachment file to an email, the file depends on the language of the document.

Some sample code:



Dim docLang
Dim generalTerms
docLang = %{lang}

Select Case docLang
Case "en-us"
        generalTerms = "D:\1_PlanetPressDEV\workdir\sources\GeneralTermsUS.pdf"
Case else
        generalTerms = "D:\1_PlanetPressDEV\workdir\sources\GeneralTerms.pdf"
End Select

%{termsVaue} = generalTerms


${termsValue} is not recognised in the script. How can i write to a local variable within the workflow?

celox,

Please refer to the Workflow user guide for using Scripts. You also need the proper syntax to retreive the value from your local variable %{lang}.

Here is the link.

Hope this helps!

Regards,

JF

Hi JF,

Just got it to work! Thank you!

Script that works:

Dim docLang

doclang = Watch.getvariable(“lang”)

Select Case docLang
Case “en-us”
watch.setvariable “termsValue”, “D:\1_PlanetPressDEV\workdir\sources\GeneralTermsUS.pdf”
Case else
watch.setvariable “termsValue”, “D:\1_PlanetPressDEV\workdir\sources\GeneralTerms.pdf”
End Select

Hi celox,

As further information about attachments in an Email context, there are 2 tips that could help you out (if you hadn’t already figured them out):

You could also do this directly in the Designer without needing the script in Workflow, if the language field is added to your record, by the way.

Hi Evie,

Thanks for the extra tip!

Kind regards,

J