@Ras21
Yes, so in your original formula you were using the Defaults function - this will ALWAYS create a new record.
If you want to Update a record, I would suggest using the UpdateIf (or Patch with a reference to the record you want to update).
Personally, I prefer UpdateIf and so the formula would be the following:
UpdateIf(Training, ID=ThisItem.ID,
{
Lookup:{
'@odata.type':"#Microsoft.Azure.Connectors.SharePoint.SPListExpandedReference",
Id: Gallery1.Selected.ID,
Value: Gallery1.Selected.ID
}
}
)
HOWEVER, I believe you are pointing your Lookup column to the wrong place. You are setting it to the ID of the Gallery selected item. This will be an ID to the Personal SP list - NOT to the Avdelning list, which is I believe what you want. Since your Department dropdown is apparently based on the Avdelning list, you really want THAT information.
Now, not knowing what your Items property is for the dropdownAvdelning, I will assume it has a full avdelning record, in which case the formula would be the following:
UpdateIf(Training, ID=ThisItem.ID,
{
Lookup:{
'@odata.type':"#Microsoft.Azure.Connectors.SharePoint.SPListExpandedReference",
Id: dropdownAvdelning.Selected.ID,
Value: dropdownAvdelning.Selected.ID
}
}
)
See if that gets you further.