Replace Bookmarks With Text

Last Updated: 07/19/2016 Introduced in Verision: 2.0

This tutorial demonstrates how to use Replace Bookmarks With Text step from Data > Documents category in the ToolBox. This step gets bookmarks from the Constant Word Document, replaces them with a desirable Text, and returns an updated Document File.

 

Example:

We begin in the Designer Folder with clicking Create Flow on the Folder Actions panel.

 createFlow

Then, we Name our Flow and click Create to proceed to the Flow Designer.

 nameFlow

First, in the Flow Designer we add an Invoice Form. We will use this Form to get user inputs for our Bookmarks. In this Example we add this Form from Flows, Rules, Forms and Reports > Forms [Interactions] > [Parent Folder] > Replacing Bookmarks With Text category.

 addInvoiceForm

This form was designed for Replacing Bookmarks With Text (Dynamic) tutorial. It has Text Boxes and Date Pickers for user inputs, and a Submit Button control to submit the Form.

 invoiceFormDesign

Next, we add Replace Bookmarks With Text step from All Steps [Catalog] > Data > Documents category in the Flow Designer Wizard.

 addReplaceBookmarksStep

We select this step on the workspace and Step Information Layer pops up. In the Configuration section we use Pick Document File selector to pick our Word Document File.

 pickDocumentFile

Document File for this Example looks as following. It is a Template for Invoice with Bookmarks everywhere where text enclosed with square brackets.

 originalWordDoc

In the Flow Designer we select Show Mapping Editor option from Replace Bookmarks With Text step’s Options Menu.

 showMappingForReplaceStep

In the Mapping Editor we connect the Outcome Data Fields from the Form to the respective Bookmark fields. We click Ok to save and close Mapping Editor.

 mappingForReplaceStep

Back in the Flow Designer we add Download Document Form from Flows, Rules, Forms and Reports > Forms [Interactions] > [Parent Folder] > Replacing Bookmarks With Text category in the Flow Designer Wizard.

 addDownloadDocForm

This Form was designed for Replacing Bookmarks With Text (Dynamic) tutorial. It has two controls. Done Button control from Actions category for closing the Form. And, Download File Download control from File Handling category.

 downloadFormDesign

Back in the Flow Designer we connect Done outcome from the Download Document Form to the End Step, and Failed outcome from the Replace Bookmarks With Text step to the End Step in our Flow. Then, we call Mapping Editor for our Download Document Form step.

 showMappingForDownload

In the Mapping Editor we connect OutputDocumentFile outcome from the Replace Bookmarks With Text step to the FileHere File Download control on the Form. Then, we save and close Mapping Editor.

 mappingForDownload

This completes our Flow. We click Debug Flow link on the Top Panel in the Flow Designer to test our Flow.

Note that in Decisions version 3.5 and above, you’ll need to click Test Flow to access the Debugger.

3.5 Test Flow Shot

 debugFlow

Our Invoice Form opens in the Debugger. We fill in all required fields and click Submit

 fillInTheForm

Then, Download Document Form opens. We click Download

 downloadFile

Next, we confirm download process, Name our updated Document file, and save it at the desirable location.

 nameAndSaveFile

In the Debugger Decisions informs us that the File was saved.

 fileSaved

Next, we click Done on the Download Document Form in the Debugger.

 closeDownloadForm

The Form closes and Diagram Tab in the Debugger indicates that our Flow ran to the End Step with no errors.

 flowExecuted

Finally, we locate our downloaded file and open it. We can see that all Bookmarks were replaced with user’s data from the Invoice Form.

updatedDocFile

Additional Resources