GR:Gravity/Definitions/Activity Stages/AS400 Call
SINCE: V2.0.2
AS400 Call
The AS/400 Call Activity enables you to call from the workflow a program on the IBM i with a number of parameters that are statically defined or substituted at runtime. The results of the call can be evaluated and then stored inside custom fields and/or added as comments.
Use cases
Below there are various use cases for the AS400 Call.
Use Case 1
John has implemented a Leave of Absence workflow and wants to register a granted request in a table in his IBM i database. John takes the item that is created for this purpose through the workflow where the program on the IBM i takes care of the absence registration.
Things to do
- Create a user that has the IBMIPROFILE String Field and the IBMIPASSWORD Secret Field.
- Augment your base workflow with an Activity Stage and select the AS400 Call Activity
- Edit all applications that use this workflow and fill in the program details
1. Adding Fields to a User
After you have created a user ([1]) you need to add two fields to the user ([2]) and fill them in. They are used to connect to your IBM i. The fields are:
IBMIPROFILE (add a String Field) IBMIPASSWORD (add a Secret Field)
2. Augmenting the base workflow
Open the Definitions perspective (1) and find the workflow that you want to augment with the call (2). Drag an Activity stage (3) on the canvas (4) and draw the lines to define the workflow.
3. Changing the Applications
The last part involves changing the application by filling in the details for the added Activity. Open the Definitions perspective (1) find the required application (2) and select the Activity (3).
Open the Activity tab in the Properties View
Select the Activity in the workflow editor (1) and open the Activity tab (2). This tab is only visible when the selected Stage is an Activity stage. In the general section (4) you can define the following fields.
General Section
- Background process
- Check this if you don't want the workflow to wait for the connection to complete. This means that the call could fail while the workflow has advanced.
- Continue on error
- Check this to ignore any error that arises from the call.
- Add comment to Item
- Check this if you want to add a comment to the item to indicate that the Stage has been processed.
Variable Button
- Variables (3)
- You can use variables from Gravity to be included in the parameter values. Click this button to show a list with Gravity variables. Insert the variables in this form: ${document.name}
1 - Click the Variables button
2 - Find the field you want to insert as parameter value or want to use as a compare value for the return variable.
3 - Copy this field into the clipboard and paste it in the target location.
AS/400 Call information
- Host
- Define the ip address or the name of the host as it can be found in the DNS.
- User with credentials
- Enter the name of the user that can logon with the previously mentioned IBMIPROFILE and IBMIPASSWORD and that can call the specified program.
- Program
- Specify the program name that is to be called. The name should be uppercase.
- Library
- Specify the library that contains the program. The name should be uppercase.
Parameter Section
When you scroll down in the properties view you reach a section where you can define up to 20 variables to be passed to the program (1). Most fields have a question mark decorater (2) that show some additional help when hoovered.
- Active
- Defines if this variable and all subsequent variables are active. If a parameter is not active it will not be passed to the program.
- Name
- The name of the parameter. It is for internal documentation only and may match the actual program parameter or serve another purpose.
- Type
- Defines the type of the variable. The only allowed type currently is Text. More types may follow in future releases.
- Length
- The length of the parameter as defined in the program. This length should be the same as the actual size in the program.
- Value
- The value to be passed to the program. This may be empty for return variables, contain a fixed value or may be one or more variables from Variables dialog mentioned earlier.
- Output Parameter
- Check this box if the variable is considered to return a value.
- Value should match (regex)
- If the return variable does not match this value then the call is considered to be failed. This field may include one or more variables from Variables dialog mentioned earlier.
- Add return value as new comment
- The return value will be added as a new comment.
- Add value to field
- Place the contents of this variable into the selected field. Make sure that this field exists for the item that you are processing.