Skip to main content
sanjuktab2257
September 5, 2025
Question

Interface Date Field input customization

  • September 5, 2025
  • 3 replies
  • 0 views

Within the Appian interface, the date field typically accepts dates separated by a forward slash ("/"). However, in our use case, there are scenarios where we need to support dates separated by a hyphen ("-") or a pipe ("|"). To accommodate this requirement, I’ve written the following piece of code

a!localVariables(
  local!onlyNumbers: cleanwith("1.22.1957", "1234567890"),
  local!length: len(local!onlyNumbers),
  if(local!length = 8,
  concat(left(local!onlyNumbers, 2), "/", mid(local!onlyNumbers, 3, 2), "/", right(local!onlyNumbers, 4)),
  if(local!length = 7,
  concat("0", left(local!onlyNumbers, 1), "/", mid(local!onlyNumbers, 2, 2), "/", right(local!onlyNumbers, 4)),
  null
  )
  ))

It seems that the Appian interface is not executing the logic as expected, and the error still persists.

3 replies

shubhama926776
September 6, 2025

Try below sample interface code..

a!localVariables(
  local!dateInput: "",
  local!formattedDate: if(
    isnull(local!dateInput),
    null,
    a!localVariables(
      local!separator: if(
        find("-", local!dateInput) > 0, "-",
        if(find("|", local!dateInput) > 0, "|",
        if(find(".", local!dateInput) > 0, ".", "/"))
      ),
      local!parts: split(local!dateInput, local!separator),
      if(
        length(local!parts) = 3,
        concat(
          text(tointeger(local!parts[1]), "00"), "/",
          text(tointeger(local!parts[2]), "00"), "/",
          local!parts[3]
        ),
        "Invalid format"
      )
    )
  ),
  {
    a!textField(
      label: "Enter Date",
      placeholder: "MM-DD-YYYY or MM.DD.YYYY or MM|DD|YYYY",
      value: local!dateInput,
      saveInto: local!dateInput
    ),
    a!textField(
      label: "Formatted Date",
      value: local!formattedDate,
      readOnly: true
    )
  }
)

sanjuktab2257
September 8, 2025

Thank you, Shubham. I’d like to integrate the date values directly into the date design object, ideally with calendar selection functionality included.

harshas2775
September 8, 2025

It is not possible to format the date field available OOTB in Appian Interface object. You need to either use textField like Shubham suggested so that user's enter dates with '-' or '|' . Otherwise have the users enter with default date field and then show with '-' or '|' when the field is read only for users.