I am writing a trigger to Insert a Image in a record which will be posted via feed
string img;
trigger will save if I define "img" has a String on line 3 & "f.ContentData.tostring();" on line 7
If I tried to convert string to Blob it will say
Blob is not defined
trigger Update_image on FeedItem (after insert) {
id Travelid ;
string img;
List<Object__c> lst = new List<Object__c>();
For(FeedItem f : Trigger.new){
Travelid = f.parentid;
img = f.ContentData.tostring();
}
for(Object__c i :[select id,image__c from Object__c where id=: travelid]){
i.image__c =img;
lst.add(i);
}
update lst ;
}
In above trigger I am getting Error like this
System.StringException: BLOB is not a valid UTF-8 string