Error getting saving a value of two fields.

Certified Senior Developer

Hello Folks,

Followed by above screenshots: I have two fields (dropdown and text). Text field comes up when click on plus icon. 

Scenario: Dropdown field contains company name. There is a possibility to add manual company name. That's why plus icon will be placed and on click of that shows up text field. I have column in a database called companyName that saves value.

Issue here is: Both field saves value into same "saveInto" which conflicts. When I fills up text field it shows dropdown error because value saves into same companyName column. Please see below code.

a!localVariables(
  local!company: false(),
  a!dropdownField(
    choiceLabels: local!CompanyLabels,
    choiceValues: local!CompanyLabels,
    label: "company name:",
    labelPosition: "ADJACENT",
    placeholder: "Select Choice",
    value: tostring(index(ri!company, "companyName", {})),
    saveInto: ri!company.companyName,
    disabled: if(
      toboolean(not(local!company)),
      false,
      true
    ),

  ),
  a!textField(
    label: "Manual company Name",
    value: ri!company,
    saveInto: {
      ri!company,
      a!save(ri!company.companyName, save!value)
    },
    labelPosition: "ADJACENT",
    showWhen: if(toboolean(local!company), true, false),

  )
)

  Discussion posts and replies are publicly visible

Parents
  • 0
    Certified Associate Developer

    I have tried to replicate your issue in my code. Please have a look

    a!localVariables(
    local!companyLabels: { "XYZ corp", "ABC inc" },
    local!isCompanyManuallyEntered,
    local!showManualCompanyNameField: false(),
    {
    a!sideBySideLayout(
    items: {
    a!sideBySideItem(
    item: a!dropdownField(
    choiceLabels: local!CompanyLabels,
    choiceValues: local!CompanyLabels,
    label: "company name:",
    labelPosition: "ADJACENT",
    placeholder: "Select Choice",
    value: if(
    or(local!isCompanyManuallyEntered),
    null(),
    tostring(index(ri!company, "companyName", {}))
    ),
    saveInto: {
    ri!company.companyName,
    a!save(local!isCompanyManuallyEntered, false())
    },
    disabled: or(local!showManualCompanyNameField)
    )
    ),
    a!sideBySideItem(
    a!richTextDisplayField(
    value: if(
    or(local!showManualCompanyNameField),
    a!richTextIcon(
    icon: "minus",
    link: a!dynamicLink(
    saveInto: {
    a!save(
    local!showManualCompanyNameField,
    false()
    ),
    a!save(ri!company.companyName, null()),
    a!save(local!isCompanyManuallyEntered, false())
    }
    ),

    ),
    a!richTextIcon(
    icon: "plus",
    link: a!dynamicLink(
    saveInto: {
    a!save(
    local!showManualCompanyNameField,
    true()
    ),
    a!save(ri!company.companyName, null())
    }
    ),

    ),

    )
    )
    )
    }
    ),
    a!textField(
    label: "Manual company Name",
    value: property(ri!company, "companyName", null()),
    saveInto: {
    a!save(ri!company.companyName, save!value),
    a!save(local!isCompanyManuallyEntered, true())
    },
    labelPosition: "ADJACENT",
    showWhen: local!showManualCompanyNameField
    )
    }
    )

Reply
  • 0
    Certified Associate Developer

    I have tried to replicate your issue in my code. Please have a look

    a!localVariables(
    local!companyLabels: { "XYZ corp", "ABC inc" },
    local!isCompanyManuallyEntered,
    local!showManualCompanyNameField: false(),
    {
    a!sideBySideLayout(
    items: {
    a!sideBySideItem(
    item: a!dropdownField(
    choiceLabels: local!CompanyLabels,
    choiceValues: local!CompanyLabels,
    label: "company name:",
    labelPosition: "ADJACENT",
    placeholder: "Select Choice",
    value: if(
    or(local!isCompanyManuallyEntered),
    null(),
    tostring(index(ri!company, "companyName", {}))
    ),
    saveInto: {
    ri!company.companyName,
    a!save(local!isCompanyManuallyEntered, false())
    },
    disabled: or(local!showManualCompanyNameField)
    )
    ),
    a!sideBySideItem(
    a!richTextDisplayField(
    value: if(
    or(local!showManualCompanyNameField),
    a!richTextIcon(
    icon: "minus",
    link: a!dynamicLink(
    saveInto: {
    a!save(
    local!showManualCompanyNameField,
    false()
    ),
    a!save(ri!company.companyName, null()),
    a!save(local!isCompanyManuallyEntered, false())
    }
    ),

    ),
    a!richTextIcon(
    icon: "plus",
    link: a!dynamicLink(
    saveInto: {
    a!save(
    local!showManualCompanyNameField,
    true()
    ),
    a!save(ri!company.companyName, null())
    }
    ),

    ),

    )
    )
    )
    }
    ),
    a!textField(
    label: "Manual company Name",
    value: property(ri!company, "companyName", null()),
    saveInto: {
    a!save(ri!company.companyName, save!value),
    a!save(local!isCompanyManuallyEntered, true())
    },
    labelPosition: "ADJACENT",
    showWhen: local!showManualCompanyNameField
    )
    }
    )

Children
No Data