Invoke a Transaction
To integrate your transaction in your app, you need to call it from a process. In the examples below, you will learn how to integrate the login transaction created in the use case scenario in a login process, and how to invoke this process from a submit button.
In your app's branch, go to Branch Design > Processes.
Click + New lambda process.
In the right panel, add a name that represents your process' function, and a description to summarize its goal. For this example, type Validate_login, Process that validates a user login.
In the lambdas editor's left panel, click Transactions, and then drag the Execute transaction block into the canvas. Connect the block to the On start.
Use the search bar next to the canvas to look for your transaction and call it from the process. Search by transaction's code only. In this case, search for the 1058 code. The search bar will retrieve a block with your transaction's information and its inputs and outputs.
Drag the results to the blank space next to Execute transaction block.
Now, complete the process' inputs, which is the information the process will capture and transfer to the transaction. This process receives the user and password, which will then be transferred to the login transaction's Start node for their validation.
Go to the editor's left panel, click Global Variables and add the Get text block next to the user and password inputs.
Add a Text block next to each Get text block created during the previous step. In the user text block, type 3 to enter the register where the username is stored. In the password text block, type 4 to enter the register where the password is stored.
The Outputs section is automatically detecting the values the parameters are receiving when the transaction is executed. These are the End node's inputs.
Go to the Next section in the left panel, and add the Request next render sequence block, to indicate the action that should execute after the login. Select the sequence, layout and views where you want to direct the user once logged in by clicking the blank spaces.
Then, invoke this process from your app's login screen. For this example, set the Validate_login process on the "submit" button in your login screen.
Go to your app's screens page and edit your login screen.
Click the "submit" button set on the screen, and go to the Actions tab in the right panel. In the On Click field, click the three-dot icon, and the Create new link modal window appears.
Select the Lambda option in the first drop-down menu, and then the login process on the second one.
This way, the user logs in, clicks the submit button, and triggers the login process, which at the same time, triggers the login transaction.