3/5

a!map(): apply a profile edit, protecting read-only fields

Medium

A profile page saves one edit at a time: set ri!field to ri!value and return the updated profile.

Rules

  • every other field keeps its value
  • editing a field the profile does not have yet adds it
  • "id" and "createdAt" are read-only: an edit to either is ignored and the profile comes back unchanged

Watch out: records are replaced rather than changed, so the answer is whatever comes back.

Inputs

  • ri!profile — Map
  • ri!field — Text
  • ri!value — Any Type

ri! Rule Inputs

ri!profileMap
a!map(id: 1, name: "Ann", city: "Pune", createdAt: "2024-01-05")
ri!fieldText
"city"
ri!valueAny Type
"Delhi"

Example 1 — Change the city

Input: ri!profile
a!map(id: 1, name: "Ann", city: "Pune", createdAt: "2024-01-05")
Input: ri!field
"city"
Input: ri!value
"Delhi"
Output:
a!map(id: 1, name: "Ann", city: "Delhi", createdAt: "2024-01-05")

Example 2 — Add a phone number

Input: ri!profile
a!map(id: 1, name: "Ann", city: "Pune", createdAt: "2024-01-05")
Input: ri!field
"phone"
Input: ri!value
"555-1234"
Output:
a!map(id: 1, name: "Ann", city: "Pune", createdAt: "2024-01-05", phone: "555-1234")

Example 3 — The id is read-only

Input: ri!profile
a!map(id: 1, name: "Ann", city: "Pune", createdAt: "2024-01-05")
Input: ri!field
"id"
Input: ri!value
99
Output:
a!map(id: 1, name: "Ann", city: "Pune", createdAt: "2024-01-05")

Example 4 — The creation date is read-only

Input: ri!profile
a!map(id: 1, name: "Ann", city: "Pune", createdAt: "2024-01-05")
Input: ri!field
"createdAt"
Input: ri!value
"2025-06-01"
Output:
a!map(id: 1, name: "Ann", city: "Pune", createdAt: "2024-01-05")

Appian Expression Tips

  • • Use ri!variableName for rule inputs
  • • Use a!localVariables(local!x: …, body) for locals
  • • Use a!forEach(items: …, expression: fv!item) to iterate
  • • Use where() / reject(fn!isnull, list) to filter