Script with an attribute launch point
An attribute launch point associates a script with a specific field of a business object and an event occurring against that field, and executes only when a value is specified for that field.
Similar to an object launch point, you associate an attribute launch point with a specific object in the database. However, in addition to an object, an attribute launch point must be associated with a specific attribute in that object. An attribute launch point is appropriate if you want to perform a routine every time an object attribute value is initialized, updated, or looked up by using a Lookup dialog box. For example, you can use an attribute launch point to get the account number for an existing customer.
- Initialize access restriction
- Sets the access level for the attribute's field. For example, you can change the access level for an attribute's field from read/write access to read-only access.
- Initialize value
- Sets the value for the attribute's field. For example, you can automatically enter the account number for an existing customer.
- Validate
- Checks whether the value in the attribute's field is valid. For example, you can check whether a telephone number is properly formatted or contains enough digits to constitute a valid number.
- Retrieve list
- Retrieves a list of valid values for the attribute's field. For example, in an invoice, you can set up the supplier field to return a list of approved vendors.
- Run action
- Runs an action that is based on the value that is in the attribute's field.
You use choice messages to gather and act on user responses. You can define choice messages in the Database Configuration application. You are able to use OK, Close, Cancel, Yes, and No buttons in choice messages. Then, in your automation script, you can create business logic to match the buttons in the choice message.
When you use a combination of buttons, ensure that you have a button for each of your options. For example, you do not want to use only the Yes and OK buttons because these options do not give the user the option to cancel or stop the process.
Example of an attribute launch point
You can define an attribute launch point that runs whenever a user completes the Purchase price field. You define the script that configures the fields and associates the script with the attribute launch point. For example, if the purchase price of an asset is more than $100, the Vendor field is required. If the purchase price of an asset is less than $100, the Vendor field is not required. For any purchase price, the replacement cost must be half the purchase price.- Define an attribute launch point that is executed when a user moves out of the Purchase Price field.
- Define the script that configures the fields and associate the script with the attribute launch
point:
if purchaseprice > 200: errorgroup = "asset" errorkey="purchasepricemsg" else: if purchaseprice >= 100: vend_required=True else: vend_required=False rc = purchaseprice/2
- Test the attribute launch point and script and activate or de-activate the launch point as required.