Cannot write to records from interface

Certified Associate Developer

a!localVariables(
  local!emails:{
   "def@gmail.com","abc@gmail.com"},
  local!a,
  a!formLayout(
    label: "Form",
    contents: {},
    buttons: a!buttonLayout(
      primaryButtons: {
        a!buttonWidget(
          label: "Submit",
          submit: true,
          saveInto: {
            a!forEach(items: local!emails,
          expression: 
            a!writeRecords(
            records: 'recordType!{c5b11a4d-cd52-43c4-ab87-2e1ef53bfcee}BMA Emails'(
              'recordType!{c5b11a4d-cd52-43c4-ab87-2e1ef53bfcee}BMA Emails.fields.{20167940-35f1-4106-9a3b-6a585ba2fff2}email': fv!item,

            ),
            onSuccess: {a!save(local!a,append(local!a,1))},
            onError: {}
          ))},
          style: "SOLID",
          loadingIndicator: true
        )
      },
      secondaryButtons: {
        a!buttonWidget(
          label: "Cancel",
          value: true,
          saveInto: {},
          submit: true,
          style: "OUTLINE",
          validate: false
        )
      }
    )
  )
)

Hello I want to send a list of emails to record type using a local variable, but couldn't able to do,

Thanks

  Discussion posts and replies are publicly visible

Parents
  • +1
    Certified Associate Developer

    Hello  ,

    Construct your data in a local variable and and then write the data to the record type using a!writerecords() in the button.

    a!localVariables(
      local!countries: { "Italy", "Germany" },
      local!recordConstruct: a!forEach(
        items: local!countries,
        expression: 'recordType!{c6aa3272-8051-4553-92f9-1e8da444ec27}FWC Country'(
          'recordType!{c6aa3272-8051-4553-92f9-1e8da444ec27}FWC Country.fields.{0476d6f9-4a1b-4d0c-bb29-f06e74fd6a95}name': fv!item
        )
      ),
      a!formLayout(
        label: "Form",
        contents: {},
        buttons: a!buttonLayout(
          primaryButtons: {
            a!buttonWidget(
              label: "Submit",
              submit: local!recordConstruct,
              saveInto: a!writeRecords(
                records: local!recordConstruct
              ),
              loadingIndicator: true
            )
          },
          secondaryButtons: {
            a!buttonWidget(
              label: "Cancel",
              value: true,
              saveInto: {},
              submit: true,
              validate: false
            )
          }
        )
      )
    )

Reply
  • +1
    Certified Associate Developer

    Hello  ,

    Construct your data in a local variable and and then write the data to the record type using a!writerecords() in the button.

    a!localVariables(
      local!countries: { "Italy", "Germany" },
      local!recordConstruct: a!forEach(
        items: local!countries,
        expression: 'recordType!{c6aa3272-8051-4553-92f9-1e8da444ec27}FWC Country'(
          'recordType!{c6aa3272-8051-4553-92f9-1e8da444ec27}FWC Country.fields.{0476d6f9-4a1b-4d0c-bb29-f06e74fd6a95}name': fv!item
        )
      ),
      a!formLayout(
        label: "Form",
        contents: {},
        buttons: a!buttonLayout(
          primaryButtons: {
            a!buttonWidget(
              label: "Submit",
              submit: local!recordConstruct,
              saveInto: a!writeRecords(
                records: local!recordConstruct
              ),
              loadingIndicator: true
            )
          },
          secondaryButtons: {
            a!buttonWidget(
              label: "Cancel",
              value: true,
              saveInto: {},
              submit: true,
              validate: false
            )
          }
        )
      )
    )

Children