View Article

Add an Execute Button

By Xelence Documentation posted 04-11-2022 15:03

  

Introduction

An Execute button is a button that you can configure to perform a function on a form that is not covered by the default buttons available, such as New or Open.

You can configure an Execute button to execute an entity rule, XML method, etc. This example executes an entity rule.

Prerequisites

  • The entity must have the rules configured.
  • The code table must be configured with the order status codes.
  • The form must already exist.
Quick Steps
1 Open the form
2 Add an Execute button
3 Enter the details, then click OK
4 Save the form

Detailed Steps

Step 1. Open the form.

Open the form you want to add a button to. This example uses the Order Maintenance form.


Step 2. Add an Execute button.

Drag and drop the button where you want it on the form.




Step 3. Enter the details, then click OK.

The important properties are:

  • ID: Programmatic ID of the button.
  • Text: Text that will appear on the button. Make sure you give a meaningful name to the button.
  • Method Type: Specifies the type of execution for the button. By default, it is set to Rule, which this example uses.
  • Rule: Programmatic ID of the rule to be executed, if the Method Type is Rule. This rule must already exist on the entity.
The Method Type options are:

Rule: Executes a logical rule from the entity.
XML Method: Executes an XML method from the entity.
Web API: Executes a Web API file.
Upload: Processes a configured inbound file.
Download: Generates an outbound file.
Connector: Executes a third-party connector method.


The rule for this example, rulApprove, comes from the Order entity. When clicked, the Approve button will update the Order Status to Placed (coded as ORDR) if the Order Status is not Cancel or Failed. If the status is Cancel or Failed, the application displays an error message.

If your form's processes require more Execute buttons, you can copy an existing Execute button and paste it where desired, then update the properties in the right tab. In the following example, the form has two copied Execute buttons with updated rules and captions. Any rule you want to call on the form must already be compiled.
Update the properties of the second execute button.
The rulReject must already exist in the entity Order. When you hit the reject button, it updates the Orderstatus as Cancel (coded as CANL).
Update the properties of the third execute button.
The rulValid must already exist in the entity Order. When you hit the valid button, it updates the Orderstatus as Opened (coded as OPNO).



Step 4. Save the form.


Then, run the Preview. Xelence displays the form output. You can test your updated settings.

When you have previewed your form, it should look something like this:

The Order Status is In Cart before the user clicks the Reject button.

The Order Status is changed to Cancel when the user clicks the Reject button.
Since the Order Status is Cancel, clicking Approve doesn’t change the status. Instead, it displays an error message.
Click the Valid button to verify the Order Status: it changes to Opened.
Now when the user clicks the Approve button, the application updates the Order Status to Placed.


What are the improvements over S3 Version 6?

Previously, a method was written in the C# business object and then added to the object methods section of the entity. Now, you can create a logical rule in Xelence itself, instead of writing a method in the C# business object.


This post is part of the Maintenance Form topic. Click here to open the Maintenance Form Overview.


#Xelence

#Forms

0 comments
125 views