Skip to main content
March 20, 2021
Question

pink box error while i try to perform action in tempo

  • March 20, 2021
  • 1 reply
  • 0 views

Expression evaluation error [evaluation ID = 339JUBMJ] in rule 'ch_ui_getdetails' at function a!formLayout [line 4]: The contents field on a column layout may only contain components. Received Dictionary at index 3.

this is my interface

a!localVariables(
local!clientdetails:cast(typeof('type!{urn:com:appian:types}CH_Clients'()),
rule!CH_query_getDetails(sid:ri!sid )),
a!formLayout(
label: "Form",
contents: {
a!integerField(
label: "cid",
labelPosition: "ABOVE",
value:index(local!clientdetails,"cid",{}),
saveInto:local!clientdetails.cid,
readOnly:ri!readonly ,

),
a!textField(
label: "cname",
labelPosition: "ABOVE",

readOnly: ri!readonly,
value:index(local!clientdetails,"cname",{}),
saveInto:local!clientdetails.cname

),


if(ri!readonly="false",
{
buttons: a!buttonLayout(
primaryButtons: {
a!buttonWidget(
label: "Submit",
submit: true,
style: "PRIMARY",
value: "submit",
saveInto: {ri!buttonvalue,
a!save(ri!CH_Clients,local!clientdetails)}
)
},
secondaryButtons: {
a!buttonWidget(
label: "Cancel",
value: "submit",
saveInto:ri!buttonvalue,
submit: true,
style: "NORMAL"

)
}
)},{})}
)
)

    1 reply

    csteward
    March 20, 2021

    Before we can get to the root of the issue, note your form buttons parameter is inside of your contents parameter, it should be at the same level under a!formLayout instead.  Update your interface to the code below and go from there.

    Additionally, when posting code snippets on the community, please use "Insert -> Code" for readability.

    a!localVariables(
      local!clientdetails: a!refreshVariable(
        value: cast(typeof('type!{urn:com:appian:types}CH_Clients'()),rule!CH_query_getDetails(sid:ri!sid)),
        refreshOnReferencedVarChange: false,
      ),
      a!formLayout(
        label: "Form",
        contents: {
          a!integerField(
            label: "cid",
            labelPosition: "ABOVE",
            value: property(local!clientdetails,"cid",{}),
            saveInto: local!clientdetails.cid,
            readOnly: ri!readonly
          ),
          a!textField(
            label: "cname",
            labelPosition: "ABOVE",
            readOnly: ri!readonly,
            value: property(local!clientdetails,"cname",{}),
            saveInto: local!clientdetails.cname
          )
    
        },
        buttons: a!buttonLayout(
          showWhen: not(ri!readonly="false"),
          primaryButtons: {
            a!buttonWidget(
              label: "Submit",
              submit: true,
              style: "PRIMARY",
              value: "submit",
              saveInto: {
                ri!buttonvalue,
                a!save(ri!CH_Clients,local!clientdetails)
              }
            )
          },
          secondaryButtons: {
            a!buttonWidget(
              label: "Cancel",
              value: "submit", /* You may want a different value here than your submit button above */
              saveInto: ri!buttonvalue,
              submit: true,
              style: "NORMAL"
    
            )
          }
        )
      )
    )