Error in submitting data via an Interface in a Site

Certified Associate Developer

I have created an application that uses a public API as an Integration to retrieve the required data from a 3rd party website and store it in the Appian database.

So my application is a "Dictionary Book" and I have created a CDT for the same using these fields:  

id
word
phonetic
origin
definition
example
searchedBy
searchedAt

Next, I created an interface wherein I have passed this CDT, readOnly and cancel as a rule input. The user needs to fill and submit the "word" field, and the "searchedBy" and "searchedAt" fields are set using loggedInUser and now function. The rest of the fields would get their respective data via Integrations.

I created the entire process in the Process Model and I was able to get and save the data for all the CDT fields without any errors.

But when I added this interface as a page to my site, and tried to execute this interface, it gave me an error saying:

Expression evaluation error [evaluation ID = 831a9:498d4] in rule 'lcp_searchwordv1' : An error occurred while executing a save: Expression evaluation error: The save target must be a local variable that does not refresh on every evaluation or on an interval, a process variable, or a node input (or a rule input passed one of those three), but instead was: [id=, word=, phonetic=, origin=, definition=, example=, searchedBy=, searchedAt=]

 

I have attached the code for the interface as well. Please help me to resolve this issue

a!localVariables(
  local!username: loggedInUser(),
  local!time: now(),
  local!main: ri!dictionaryV1.word,
  a!formLayout(
    label: "",
    contents: {
      a!richTextDisplayField(
        labelPosition: "COLLAPSED",
        value: {
          a!richTextItem(
            text: {
              a!richTextIcon(
                icon: "book"
              ),
              " Free Dictionary Search"
            },
            color: "#4cb020",
            size: "LARGE",
            style: {
              "STRONG"
            }
          )
        },
        marginBelow: "MORE"
      ),
      a!columnsLayout(
        columns: {
          a!columnLayout(
            contents: {
              a!textField(
                label: "Search a Word",
                labelPosition: if(
                  ri!readOnly,
                  "ADJACENT",
                  "ABOVE"
                ),
                instructions: "",
                helpTooltip: "Make sure the Entered Word is Valid",
                placeholder: "---  Enter the word to be searched in the Dictionary  ---",
                value: local!main,
                saveInto: local!main,
                characterLimit: 255,
                showCharacterCount: false,
                required: true,
                readOnly: ri!readOnly
              ),
              a!pickerFieldUsers(
                label: "User Name",
                labelPosition: "ABOVE",
                instructions: "If your name is not displayed / unavailable, please contact your Branch Supervisor",
                maxSelections: 1,
                value: local!username,
                saveInto: local!username,
                showWhen: or(
                  isnull(ri!readOnly),
                  ri!readOnly=false()),
                required: true,
                disabled: false,
                validations: {}
              ),
              a!textField(
                label: "Origin",
                labelPosition: if(
                  ri!readOnly,
                  "ADJACENT",
                  "ABOVE"
                ),
                value: {},
                saveInto: {},
                characterLimit: 255,
                showCharacterCount: false,
                showWhen: ri!readOnly = true(),
                readOnly: ri!readOnly
              ),
              a!textField(
                label: "Example",
                labelPosition: if(
                  ri!readOnly,
                  "ADJACENT",
                  "ABOVE"
                ),
                value: {},
                saveInto: {},
                characterLimit: 255,
                showCharacterCount: false,
                showWhen: ri!readOnly = true(),
                readOnly: ri!readOnly
              )
            }
          ),
          a!columnLayout(
            contents: {
              a!textField(
                label: "Language Selected",
                labelPosition: "ABOVE",
                instructions: "The system selects ""English"" as the Default Language for all searches",
                value: "English",
                saveInto: {},
                refreshAfter: "UNFOCUS",
                required: true,
                disabled: true,
                validations: {}
              ),
              a!dateTimeField(
                label: "Date & Time",
                labelPosition: if(
                  ri!readOnly,
                  "ADJACENT",
                  "ABOVE"
                ),
                value: local!time,
                saveInto: local!time,
                required: true,
                readOnly: ri!readOnly,
                disabled: false
              ),
              a!textField(
                label: "Phonetic",
                labelPosition: if(
                  ri!readOnly,
                  "ADJACENT",
                  "ABOVE"
                ),
                value: {},
                saveInto: {},
                characterLimit: 255,
                showCharacterCount: false,
                showWhen: ri!readOnly = true(),
                readOnly: ri!readOnly
              ),
              a!textField(
                label: "Definition",
                labelPosition: if(
                  ri!readOnly,
                  "ADJACENT",
                  "ABOVE"
                ),
                value: {},
                saveInto: {},
                characterLimit: 255,
                showCharacterCount: false,
                showWhen: ri!readOnly = true(),
                readOnly: ri!readOnly
              ),
              a!textField(
                label: "Searched By",
                labelPosition: if(
                  ri!readOnly,
                  "ADJACENT",
                  "ABOVE"
                ),
                value: ri!dictionaryV1.searchedBy,
                saveInto: ri!dictionaryV1.searchedBy,
                characterLimit: 255,
                showCharacterCount: false,
                showWhen: ri!readOnly = true(),
                readOnly: ri!readOnly
              )
            }
          )
        }
      )
    },
    buttons: a!buttonLayout(
      primaryButtons: {
        a!buttonWidget(
          label: "Search",
          saveInto: {
            a!save(target: ri!dictionaryV1.searchedBy, value: local!username),
            a!save(target: ri!dictionaryV1.searchedAt, value: local!time),
          },
          submit: true,
          style: "PRIMARY"
        )
      },
      secondaryButtons: {
        a!buttonWidget(
          label: "Cancel",
          value: true,
          saveInto: ri!cancel,
          submit: true,
          style: "NORMAL",
          validate: false
        )
      },
      showWhen: or(
        isnull(
          ri!readOnly
        ),
        not(
          ri!readOnly
        )
      )
    )
  )
)  

  Discussion posts and replies are publicly visible