Category: Canvas

  • Track changes to records in Power Apps

    To achieve this in a Canvas app, you can follow these steps:

    1. Collect Initial Values on Form Load:
      • Use the OnVisible property of the screen to create a collection that stores the initial values of the form. For example: ClearCollect(OriginalValues, FormName.Updates) This will store the initial values of the form fields in a collection named OriginalValues.
    2. Track Changes in Field Values:
      • For each field in the form, compare its current value with the original value stored in the collection. You can use the If function to check for changes. For example: If(DataCardValue.Text <> LookUp(OriginalValues, FieldName = "FieldName").Value, "Changed", "Unchanged")
    3. Collect Changes:
      • When a field value changes, you can use the OnChange property of the field to update a collection that tracks the changes. For example: Collect(ChangedValues, {FieldName: "FieldName", NewValue: DataCardValue.Text})
    4. Compare Changes:
      • Use the ChangedValues collection to compare the new values with the original ones. This can help you identify which fields have been modified.
    5. Optional – Highlight Changed Fields:
      • To visually indicate changes, you can modify the Fill or BorderColor property of the fields based on whether their values have changed. For example: If(DataCardValue.Text <> LookUp(OriginalValues, FieldName = "FieldName").Value, RGBA(255, 0, 0, 1), RGBA(255, 255, 255, 1))

    This approach ensures that you can track and compare changes effectively. Let me know if you’d like more detailed guidance on any of these steps!