You need to sign in to do that
Don't have an account?
Adam08
Attachments Trigger
Hi,
I have a trigger that updates a field in a custom object (record detail).
The trigger works fine (based on the file size being greater than 0 but i'm trying to add in another condition based on the file type being an excel file.
trigger updatemdf on Attachment (after insert) { List<MDF__c> co = [select id, Leads_uploaded__c from mdf__c where id =: Trigger.New[0].ParentId]; if (co.Name.endsWith('.xls') && (co.size()>0)) { co[0].leads_uploaded__c = true; update co; } }
error messgae i'm getting at line 4 is:
'Save error: Initial term of field expression must be a concrete SObject: LIST<MDF__c>
Any ideas?
Thanks
try this:
Thanks Rahul,
Although that seems to be trying to run the trigger on the Name of the custom object.
What i want is to trigger on the file name of the attachment associated with the custom object.
Hi Adam018,
I guess you dont want bulk updates,
and here problem is you want to update a boolean field of the object if the filetype is .xls
If its the case, then change your code to:
Hope it helps.