You need to sign in to do that
Don't have an account?

Validate Attachment
Hi,
Can anyone tell me how can i create validation on leads' attachment?
I have a requirement wherein there should be an attachment before i convert a lead to account.
Appreciate help. thanks. :))
Del
I dont think this is possible using validation rule, but I guess can be done using trigger on lead.
Something like
Hi,
Thanks for this information. However, i am working on your example but receieved erreor like:
Error: Compile Error: Comparison arguments must be compatible types: SOBJECT:Lead, Boolean at line 10 column 33
Hope you can help me.
code:
===========
trigger validateLeadConversion on Lead (after update)
{
Set<Id> attParentSet = new Set<Id>();
for(Attachment att : [SELECT Id,ParentId FROM Attachment WHERE ParentId IN:trigger.new])
{
attParentSet.add(att.Id);
}
for(Lead l : trigger.New)
{
if(l.isConverted == true && trigger.oldMap.get(l.Id) == false && (!attParentSet.contains(l.Id)))
{
l.addError('Please add attachment before converting the lead'); }
}
}
I already edited my answer please check
Hi,
Thanks. Sorry. I have already updated the code. however, even my lead already has an attachment, the validation is still appearing. I have attached my attachment to the standard Notes and Attachment related list.
Pls help.
Thanks,
Del
Files ?
Or Notes ?
Hi, thanks.
files. in form of email, excel, jpg, etc.
same issue...:(
Hello.
Anyone can help me with this? :(
Thank you.
del
Are you attaching a FILE or a Note ?
The code is designed for files