1 Context:
We want to give the user of our application the ability to create new orders. In this task we will create a no-code function. This means that we will create a function that performs an action when clicked by configuring attribute values. In our case, we are creating a function that can add a new record to the Order table.
2 Result:
3 Step by step guide:
- Please navigate to the section “Logicalize” -> ”Action” -> “Actions” and click on “+ Create Action”
- Insert a “Function Name” -> “CreateANewOrder”
- Select the “Function Type” -> “Akioma.Swat.Studio.Menu.Action”
- Insert a “Function Code” -> “CreateANewOrder” (This will be a unique identifier)
- Select two icons by clicking the magnifying glass -> In our case here “fad fa-plus-circle”
- Describe your function -> “This function will be used to create a new order in the order overview”
- Select the Module -> “MyAppModule”
- Click on “Confirm”
- In the “Type of action” panel below select the type “Launch”
- Search for the “OrderCreateDialogFiltered” in the “Screen to be launch”
- Fill in the following code in the “Options” field:
After clicking “Confirm” a second configuration screen appears
We declare that the function have to launch something
We define which screen have to be launched
{'autoAdd': true, 'foreignKeyProvider': '$ []'}
Explanation for the added code:
This means that when the screen is launched, an "add" operation is triggered. You can use ForeignKeyproviders to specify a function that sets initial fields/foreign fields. For example, suppose you have a customer screen and you want to launch a contact screen to create a new contact for the customer. When the contact screen is launched, set autoAdd : true and specify a function that reads the current customer number and sets it in the contact screen. This ensures that the contact is assigned to the correct customer. In our case we just want that to create a new entry with this code.
12. Select “Save” to save your function
4 Explanation:
By creating this function, we have created a reusable function throughout the application that creates a new record for the order table. We can assign this function to any button with a unique identifier in the menu structure code and use it. In the next step, we connect this function to a UI button and then bind it to our screen.