public static Entity ReplicateWithFields(Entity entity, IEnumerable <string> fieldsToSubmit) { var submissionEntity = new Entity(entity.LogicalName) { Id = entity.Id }; if (fieldsToSubmit != null) { foreach (var field in fieldsToSubmit) { if (entity.Contains(field)) { XrmEntity.SetField(submissionEntity, field, XrmEntity.GetField(entity, field)); } } } return(submissionEntity); }
public object LookupField(string entityType, Guid id, string fieldName) { return(XrmEntity.GetField(Retrieve(entityType, id, new[] { fieldName }), fieldName)); }