4D Blog

Home Tips 4D for Mobile Tutorial – Create actions

4D for Mobile Tutorial – Create actions

February 15, 2023

Tips

Actions allow users to interact with the application to change the customer’s address, add a new contact and modify a picture.

In the 4D language, an action allows you to add, edit, and delete an entity or a selection entity. But also, it can simply execute a method of your 4D server.

Why an action

You might wonder why you need to define an action to do simple operations such as add, edit or delete.

Remember that a mobile device can be offline and work without an Internet connection. When reconnecting to the network, the mobile device makes the data synchronization. But, in the meantime, the record may have been modified by another person, or, with a business example, an item may be out of stock, a payment already received, etc.
So an action allows your business logic to be consistent and to be checked. Before executing the action on the 4D server, you can check if it is valid and consider another solution – or reject the action and inform the mobile user.

Defining your first action

In this tutorial, we will see how to deal with a simple action to change the status and the percentage of completion.

We have prepared the ‘On Mobile App Action’ database method and the 4D methods like ‘modifyStatus’ called by the database method. In the video, add an action in the project to modify an entity or an entity selection, and we will show you how to link them to the base method.

Using action parameters

In this tutorial, we’re going to go further and create actions with the parameters:

  • an Add action to create a new task,
  • an Edit action that will allow you to edit existing tasks from the application,
  • a Delete action to delete an entity.

 

And we will follow step by step the modification of an entity.

Offline actions

An application user can modify a record everywhere, even when working offline. All these tasks are placed in the Pending actions list until the network is accessible. Once the user is online, all pending actions are consistently synchronized, executed, and then visible in the Completed actions list.

Rejected actions

You may reject an action sent to the server by mobile users for any given reason. For example, this may be because the action parameters sent do not match the expected values on the server side.

In that case, you can send feedback to your app users, telling them that something went wrong server-side using statusText and error properties. Then, the user updates the pending task and sends the action again.

Next…

Voilà! You now know how to add, modify or delete an entity or entity selection in your mobile application. You also know you can call a 4D method to send an email, for example.

To go further, you can continue with the blog or the documentation.

Discuss

Tags 4D for Android, 4D for iOS, CRUD, Go mobile, Mobility, Tutorial, v19 R8, v20

Latest related posts

  • April 9, 2025

    Restrict data according to privileges or information saved in session storage

  • April 7, 2025

    Designing an Interactive and Dynamic Menu Bar in Qodly application

  • April 3, 2025

    Customize your Qodly interfaces with CSS

Vanessa Talbot
Vanessa Talbot
• Product Owner •Vanessa Talbot joined 4D Program team in June, 2014. As a Product Owner, she is in charge of writing the user stories then translating it to functional specifications. Her role is also to make sure that the feature implementation delivered is meeting the customer need.Since her arrival, she has worked to define key features in 4D. She has worked on most of preemptive multi-threading new features and also on a very complex subject: the new architecture for engined application. Vanessa has a degree from Telecom Saint-Etienne. She began her career at the Criminal Research Institute as a developer for the audiovisual department. She has also worked in media and medical fields as expert in technical support, production as well as documenting new features.
  • Deutsch
  • Français
  • English
  • Português
  • Čeština
  • Español
  • Italiano
  • 日本語

Categories

Browse categories

  • 4D View Pro
  • 4D Write Pro
  • 4D for Mobile
  • Email
  • Development Mode
  • 4D Language
  • ORDA
  • User Interface / GUI
  • Qodly Studio
  • Server
  • Maintenance
  • Deployment
  • 4D Tutorials
  • Generic
  • 4D Summit sessions and other online videos

Tags

4D-Analyzer 4D for Android 4D for iOS 4D NetKit 4D Qodly Pro 4D View Pro 4D Write Pro 20 R8 20 R9 Administration Authentication Build application CI/CD Class Client/Server Code editor Collections Compatibility settings Formula Listbox Logs Mail Microsoft 365 Network Objects ORDA PDF Pictures Preemptive Programming Qodly Studio REST Scalability Security Session Source control Speed Spreadsheet Tutorial UI User Experience v20 vscode Web Word processor

Tags

4D-Analyzer 4D for Android 4D for iOS 4D NetKit 4D Qodly Pro 4D View Pro 4D Write Pro 20 R8 20 R9 Administration Authentication Build application CI/CD Class Client/Server Code editor Collections Compatibility settings Formula Listbox Logs Mail Microsoft 365 Network Objects ORDA PDF Pictures Preemptive Programming Qodly Studio REST Scalability Security Session Source control Speed Spreadsheet Tutorial UI User Experience v20 vscode Web Word processor
Subscribe to 4D Newsletter

© 2025 4D SAS - All rights reserved
Terms & Conditions | Legal Notices | Data Policy | Cookie Policy | Contact us | Write for us


Subscribe to 4D Newsletter

* Your privacy is very important to us. Please click here to view our Policy

Contact us

Got a question, suggestion or just want to get in touch with the 4D bloggers? Drop us a line!

* Your privacy is very important to us. Please click here to view our Policy