Adding or deleting groups from a group picker as a related action

hi community,

i have a requirement like i need to send a meeting form that is been assigned to a set of groups and there should be a related action that can add or delete groups within that meeting form

for  selecting groups i have used a group picker and stored that selected values as ids within a cdt attendees with meeting id as primary key and i have got this groupids using this meetingid and stored into a

 local variable by converting that groupids to groups in related action form but i when i remove a group that is already existing it is geeting removed here in the form but it is showing within the record 

can anyone explain how can i solve this problem

this is the code related to related action from and ri!attendees store groupisds related to a meetingid and ri!meetinginfo stored meetinginfo

a!localVariables(
local!groups:a!forEach(
ri!attendees,
togroup(fv!item.groupid)
),

a!formLayout(
label:"Update Meeting Information",
contents: {
a!columnsLayout(
columns: {
a!columnLayout(
contents: {
a!textField(
label: "Meeting Subject ",
labelPosition:"ABOVE",
value: ri!MMS_Meetinginfo.subject,
saveInto: ri!MMS_Meetinginfo.subject,
required: true,
validations: if(
len(
ri!MMS_Meetinginfo.subject
) > 50,
"Value may not be longer than 50 characters. You have entered " & len(
ri!MMS_Meetinginfo.subject
) & " characters.",
null
)
),


a!paragraphField(
label: "Meeting Body",
labelPosition: "ABOVE",
value: ri!MMS_Meetinginfo.body,
saveInto: ri!MMS_Meetinginfo.body,
refreshAfter: "UNFOCUS",
height: "MEDIUM",
required: true
),


a!textField(
label: "Location",
labelPosition: "ABOVE",
value: ri!MMS_Meetinginfo.location,
saveInto: ri!MMS_Meetinginfo.location,
required: true,
validations: if(
len(
ri!MMS_Meetinginfo.location
) > 50,
"Value may not be longer than 50 characters. You have entered " & len(
ri!MMS_Meetinginfo.location
) & " characters.",
null
)
)

}
),
a!columnLayout(
contents: {


a!pickerFieldGroups(
label: "Attendees",
labelPosition: "ABOVE",
maxSelections: 2,
value:local!groups,
saveInto:{
union(local!groups,local!groups)
},
required: true

),


a!dateTimeField(
label: "Start Time",
labelPosition:"ABOVE",
value: ri!MMS_Meetinginfo.startTime,
saveInto: ri!MMS_Meetinginfo.startTime,
required: true,
validations: if(ri!MMS_Meetinginfo.startTime>now(),null,"start date time must not be past date time ")
),

a!dateTimeField(
label: "End Time",
labelPosition:"ABOVE",
value: ri!MMS_Meetinginfo.endTime,
saveInto: ri!MMS_Meetinginfo.endTime,
required: true,
validations:if(ri!MMS_Meetinginfo.endTime>ri!MMS_Meetinginfo.startTime,null,"end date time must not be less than start date time ")
)


}
)
},
showWhen: ri!MMS_Meetinginfo.startTime-time(0,10,0,0)>gmt(now(),"IST")
),
a!cardLayout(
contents: {
a!richTextDisplayField(
value:a!richTextItem(
text:"Meeting that you want to update is either ongoing or been completed",
size: "MEDIUM_PLUS",
color:"ACCENT",
style: "EMPHASIS"
),
align:"CENTER"
)
},
height: "AUTO",
style: "INFO",
marginBelow: "STANDARD",
showWhen: not(ri!MMS_Meetinginfo.startTime-time(0,10,0,0)>gmt(now(),"IST"))
)
},
buttons:{
a!buttonLayout(
primaryButtons: {
a!buttonWidget(
label: "UPDATE MEETING",
icon: "envelope",
saveInto: {

a!save(ri!MMS_Meetinginfo.startTime,gmt(ri!MMS_Meetinginfo.startTime,"IST")),
a!save(ri!MMS_Meetinginfo.endTime,gmt(ri!MMS_Meetinginfo.endTime,"IST")),
a!save(ri!MMS_Meetinginfo.createdBy,loggedInUser()),
a!save(ri!readOnly,true)

},
submit: true,
style: "PRIMARY",
showWhen: ri!MMS_Meetinginfo.startTime-time(0,10,0,0)>gmt(now(),"IST")
)
},
showWhen: ri!MMS_Meetinginfo.startTime-time(0,10,0,0)>gmt(now(),"IST")


)

}


)

)

  Discussion posts and replies are publicly visible