Question
How to export using the source file name in the name of the exported file when importing files via connector?
Answer
- Create a Service Field in the Document Definition and name it ImageSource.
- Open the field's properties and in the tab Data Source select Source: Image Source
- Open Export profile settings in the Document Definition.
- Set Filename template as <RegParam:ImageSource>:
- Save and publish Document Definition.
- Open Workflow settings for the Project or BatchType (depending on what is used).
- Set it as an Advanced workflow scheme and right before Export Stage create the Automatic stage (Create Processing Stage > Automatic > OK).
- Open Stage Properties > Script tab.
- Select Type: Document Processing and click Edit Script…
- In the script editor select C# .Net language and put the following script:
using System.IO;
string s = Document.Field("Invoice Layout\\ImageSource").Value.ToString();
s = Path.GetFileNameWithoutExtension(s);
Document.Properties.Set("ImageSource", s);
11. It is required to change the full path of the service field you created in the Document Definition in the script at the following line:
string s = Document.Field("Invoice Layout\\ImageSource").Value.ToString();
12. Save settings and try to perform export again.
The script will take value from the Service field ImageSource and then will set the registration parameter for the document with the value of the field. At the Export stage, the value of the registration parameter will be used to name exported file.
Comments
0 comments
Please sign in to leave a comment.