I'm trying to update a sobject (CollaborationGroupFeed) via apex, but I am unable to update a particular reference field (in this case: CreatedBy).
Here is my code:
CollaborationGroupFeed cgf = [SELECT Id, CreatedById FROM CollaborationGroupFeed WHERE Id =: feedElement.Id LIMIT 1]; User u = [SELECT Id, Name FROM User WHERE FirstName = 'Steve' AND LastName = 'Jobs']; cgf.CreatedByCreatedById = u.Id; update cgf;
Error message: Illegal assignment from Id to NameField is not writeable: CollaborationGroupFeed.CreatedById