How to use the link control with web files

The link control can be used inside of a table to populate more then one file. In this example, we will be using a single Link control to populate more then one file.

Creating the Coach View

Inside of a human service, we've created a Coach View that contains a Link control in a table, and a Service Call control that is used to retrieve the list of files.

Following this method is useful when trying to create a reusable coach view.


Add a File to Process Designer

We now need to add the files that we want to populate in the table. In Process Designer, add a new Web File in the Files folder. Browse and add the files. For this example we'll add two files.

Creating the Business Object

We've created a business object that will contain our file name and url that will be associated to the Link control. Both the fileName and url variables are Strings.

Then within our human service, we can create a variable called "document" and select "Document" as the variable type. Make sure to mark is as a list.

Configuring the Link Control

In order to have the single Link control to have the fileName and url associated to it, we first have to bind the table to the document variable. Then, within the Configuration sections of the Link control, we set the Link Text to document.currentItem.fileName. This will set the display name of each Link control in the table.

The Link URL is set to document.currentItem.url. The Link Type must also be set to URL to indicate that the bound variable is a URL.

Retrieving the Data

Now that the Link control has been properly configured, we'll need to create an AJAX service that will return the data associated to the Link control. 

On the Service Call control, under the Behavior section, we'll click the "New" button next to the Attached AJAX Service option.

In this example, we will hard coding the return values of our document variable. Drag out a server script on the service. We'll create two objects that each contain the two files we added earlier. Use tw.system.model.findManagedFileByPath in order to get the URL and file name of our files.

Back in our Coach View, select the Service Call control and under the Behavior section, check the Auto Run option. This will allow the AJAX service to be called when the control loads instead of requiring the execute method of the Service control.




  • Author: Erick Quintanilla
  • Date Created: November 12, 2015
  • Date Modified: November 12, 2015
Was this article helpful?
0 out of 0 found this helpful
Have more questions? Submit a request