I need to create a duplicate of a record in my collection as a new SP list item. I would prefer to do this without manually listing out all of the fields as that would break the functionality if any new fields were ever added. My issue is that when Patching of Collecting to the SP List, I get an error that 'Column 'Author#Claims' is generated by the server and can't be specified.'. But as you can see from my code, I am removing the Author column. If I try to add 'Author#Claims' to the list of columns to remove, it says that column doesn't exist. I also checked by converting the NewItem object to a JSON and there is no Author fields at all.
UpdateContext(
{
NewItem: Patch(
DropColumns(
SelectedPromoItem,
ID,
'{TriggerWindowStartToken}',
'{TriggerWindowEndToken}',
OData__ColorTag,
'{ModerationStatus}',
'ComplianceAssetId',
'{FilenameWithExtension}',
'{FullPath}',
'{HasAttachments}',
'{Identifier}',
'{IsFolder}',
'{Link}',
'{Name}',
'{Path}',
'{Thumbnail}',
'{VersionNumber}',
'Author',
Created,
Editor,
Modified,
'{Attachments}',
'{ModerationComment}'
),
{'PromoActivity': Today() & " - " & UserProfile.displayName & " - " & "Copied From PromoID: " & SelectedPromoItem.ID}
)
}
);
Collect(
'Promotion Planning',
NewItem
);
This also doesn't work with the Patch and Defaults() argument.
Finally, I tried this:
Collect(
'Promotion Planning',
Defaults('Promotion Planning')
);
Patch(
'Promotion Planning',
Last('Promotion Planning'),
NewItem
);
But then get the column 'Broker#Id' is read-only and can't be modified. Broker is a choice column in this list and I checked the JSON of this NewItem and see that Broker only includes Broker: {Value: "brokerval"}.
So I am about to give up and just manually populate all of the columns and hope my org never updates this SP list, but this is kind of crazy to me that this is even this difficult. Can anyone shed some light on this functionality?