You are here: Reference Guides > Designer Form Controls (A-Z) > Ws.Button

Ws.Button

With the Ws.Button control you can use custom buttons in forms in place or in addition to the default buttons. The Ws.Button can be configured to do any of the following functions: Approve, Reject, Cancel, Complete, Delete, Save, Save and Route, Execute JavaScript, or Run an Embedded Plugin.

Download example (.wssln file)

TIP: If you are creating custom buttons to replace default Ws form buttons, use SV Configurator in the Workflow Administrator Guide to disable the default Ws form buttons.

Ws.Button properties

Property

Description

Button Label

Name that will appear on the button.

*Special Characters will not show up on the button labels.

Set Actions/
Parameters

Sets the value of a field in the form when the button is clicked (for example: Status=ʺOn holdʺ).

Note: the field that is being set by the button action must be included and named in the form. You can set multiple fields by separating them with a comma.

Submission Type

Submission action the button takes when clicked. Can be one of the following:

  • Approve: approves the form and moves it to the next step in the workflow.
  • Cancel: cancels action taken on the form and returns without submitting the form.
  • Complete: completes the current assignment and moves the workflow to the next step.
  • Reject: rejects the form and moves it to the next step in the workflow.
  • Save: saves the work performed on the form. This allows task assignees to save their work on a form and complete it at a later time. No action is taken with respect to the currently executing workflow.
  • Save and Route: saves the work performed on the form and moves it to the next step in the workflow.
  • Embedded Plugin: allows the Process Designer to specify a plug-in and its arguments to invoke on the server when the button is clicked. You must access the JavaScript via the Tools Programming/VSTA menu in InfoPath.
  • JavaScript: Allows the Process Designer to specify a JavaScript function to invoke when the button is clicked. Only the JavaScript functions provided by Winshuttle can be used. Methods are called in Button tab in the Set Actions/Parameters box with the format function=[function name]. The script file must be published along with the form with the file extension *.js if you are using Legacy Mode. If you are using the Winshuttle SLM Feature, your code must be typed in the JavaScript Editor.
  • Delete Deletes the current workflow item(i.e. the current process) from the system. The corresponding list item in SharePoint will also be deleted.
  • Set Field Date: sets the field to the value specified when the specified action is executed.

The example below uses all possible Ws.Button types. See the table following the example for an explanation of each type.

Ws.button descriptions

Back to top

Button Type

Description

Approve

Should only be used when there is an option to Approve a task. (Approval Node)

Cancel

Used as a Cancel button. When Cancel is selected, it does not cancel the form or process, it only closes out the form and exits the page.

Complete

Completes task or activity. Should only be used for Activity Nodes.

Reject

Should only be used when there is an option to Reject a task. (Approval Node)

Save

Saves the form

Save and Route

Saves the form and routes it to the workflow

Embedded Plugin

Allows you to execute a Plugin that is available in Winshuttle Designer.

Note: The Plugin Node does not have to be present in the workflow.

Set the Submission Type to Embedded Plugin. (See below).

The example above uses the Send Email plugin (notice the Set Actions/Parameters field). The Syntax for the Set Actions/Parameters are as follows:

PluginName=Send Email,server=[//my:field12],to=[//my:field13],from=[//my:field14],subject=[//my:field15],body=[//my:field16]

JavaScript

Runs JavaScript that has been entered into the JavaScript Editor in Winshuttle Designer. In this example, I am calling an alert() function to make a dialog box appear that says "Hello Winshuttle."

The button is calling the function sayHello() when clicked. The button settings are set to JavaScript and in the Set Actions/Parameters where the button function is defined.

To view the JavaScript Code, open the JavaScript Editor. See the example below.

Delete

Deletes the form

Set Field Value

Sets the value of field11 to "Value Set"

Note: When adding to the Set Actions/Parameters field, do not use spaces unless they are in between quote marks as in the example above.

Disabling default buttons

Back to top

In addition, the default buttons displayed at the bottom of the screen can be removed, and you can instead use the Ws.Button.

To disable the default buttons, use SVConfigurator to add the Key FormDefaultButtons with its value set to false.