Skip to main content
Known Participant
Apr 12, 2024 12:52 PM UTC
Solved

Unable to save array of data to record.

Hi Team, 

I have a scenario, where I need to add multiple assignees. To do this, I have created a user picker field and initially saving the inputs to a local variable. I want to save this data to a assignees record. where assignees record is in one to many relationship with meeting data record. This mean, the relationship record is multiple in my case and I was not able to save the list of assignees to the record. Can anyone help me?

Attaching the code for reference. 

    mikes0011
    mikes0011Answer
    Brainy
    Apr 12, 2024 3:45 PM UTC
    trying to save each attendee to different rows in record in "ri!meetinginfo".

    saveInto: {
      a!save(
        ri!meetingInfo,
        a!forEach(
          local!attendee,
          'recordType![meeting]'(
            'recordType![meeting].fields.{attendee}attendee': fv!item
          )
        )
      )
    }

    (you will need to correct the record type / field references since record type references copy/paste as gibberish here)

    The Expression Guru

    12 replies

    Known Participant
    Apr 12, 2024 1:53 PM UTC

    [mention:b8ea18cfbb2e4f6d841cf3c1d4d7420b:e9ed411860ed4f2ba0265705b8793d05]  [mention:a11f77a729fb4db2af76b09948583328:e9ed411860ed4f2ba0265705b8793d05]  [mention:b45a4f6a20b14a008e4e0ec732a8bf98:e9ed411860ed4f2ba0265705b8793d05] 

    mikes0011
    Brainy
    Apr 12, 2024 1:57 PM UTC

    why are you trying to call a!save() inside an a!forEach() loop?

    The Expression Guru
    Known Participant
    Apr 12, 2024 1:57 PM UTC

    I tried saving all the data in local variable to array of record, so I tried calling in foreach.

    harshk1671
    Inspiring
    Apr 12, 2024 4:16 PM UTC