Add phone functionality to the app
You can generate the code to interact with the mobile device's features. This example shows how to call a selected phone number from the app.
- Open the appflow.4ba file.
- Right-click on the BA diagram and select New > Phone.
-
Right-click on the Form entity and select Add
Relation To. Drag the relation arrow and drop it on the
Phone entity.
-
Select the relation between the Form and the
Phone entity and set the
Action
property to callContact. Set thePhone Number
property to the phone column (account_record.phone
). - Save your changes to appflow.4ba.
-
Double-click on the Form entity to open it in Form
Designer. Add a button that triggers your
callContact
action.- To make room for the button, expand the inner grid that contains the form fields.
- Select Widget > Button.
- Draw a button onto your form.
-
Set the
name
property of the button to callContact. The name of the button is also the action to be triggered by the button. -
Set the
text
property of the button to Call Contact.
- To preview your form, select Build > Preview.
- Select File > Save all.
-
Return to the appflow.4ba file. Right-click the Main program
entity and select Execute Program.
This rebuilds and executes your program in one step.
-
To test, click the Call Contact button.
Note:
The sample data in the phone field is not a valid phone number. You can enter a real phone number using the device or emulator touch pad.