KNOWLEDGE BASE
Log In    |    Knowledge Base    |    4D Home
Tech Tip: How to refresh entity after updating record in 4D for Mobile
PRODUCT: 4D for Mobile | VERSION: 19 | PLATFORM: Mac & Win
Published On: February 6, 2023

When developing a mobile app using 4D for Mobile, it is important to think about improving the end user experience. For example, when a user has made edits to an entity and saved successfully, the view should refresh automatically to reflect the changes made by them. This will give confidence to the user that the app is working properly, without requiring the user to re-open the entity. To accomplish this via code, in the On Mobile App Action method, set the “dataSynchro” property of the result object to True. For example:

$entity.status:="Approved"
$saved:=$entity.save()
If ($saved.success)
   $result.dataSynchro:=True
End if

In the above code, after updating the record in the database and confirming that the entity has been successfully saved, the app will synchronize its data with the database and refresh the current view for the user to see the update.