function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
chakrapuchakrapu 

Attachment for a workflow rule

Hi,

 

I have workflow rule wchich will fire based on some criteria on standerd object, a mail will we sent on the rule from a email template. My problem is  how to set a attachment for for the email template, the attachment is from standerd object record's  Notes and Attachement file .

 

Any ideas please.

 

 

Thanks

Balakrishna

GoldwinGoldwin

 

 

try this 

 

 <messaging:attachment renderAs="PDF" filename="yourCases.pdf">

 

you can also refer: http://gokubi.com/archives/visual-force-email-templates-2

 

 

chakrapuchakrapu

Thanks! Goldwin,  

 

but i want the attachment from Notes and Attachment section of a record.

 

 

Imran MohammedImran Mohammed

Attachment from a record, i don't think its possible using the wizard.

You have to write custom code for that.

What you can do is whenever custom field reaches the desired value, you can havea trigger that queries the Email template you want to send to the users and include the attachments.

I hope in this way you can get your work done.

Imran MohammedImran Mohammed

Hi, 

 

I think we can send using the tag which goldwin mentioned. But i am still not sure on that.

You can see an example in VF documentation.

If this does not work, then what i mentioned in my earlier post should be done.

 

<messaging:attachment>
<apex:repeat var="a" value="{!relatedTo.Attachments}">
File Name: {!a.name}
...
...
</apex:repeat>
</messaging:attachment>

 

chakrapuchakrapu

Thanks Imran,

 

Isn't  it possible, a workflow rule fire that piece of code to send a mail, because i have a workflow already for that criteria, so that two emails will not go.

 

Thanks

Balakrishna

Imran MohammedImran Mohammed

Two mails will go in that case.

You can deactivate the workflow rule if required and if you wanna achieve what you need.

chakrapuchakrapu

Thank you so much Imran...

But I need workflow rule also. Is there  a way to invoke costom controller from workflow rule?

 

Thanks

Balakrishna

Imran MohammedImran Mohammed

Yes, you can invoke a trigger.

What you should do is in the Workflow rule have a field update as workflow action on a certain custom field that will initiate the trigger.

In trigger code, based on the value changed from Field Update you can query the email template and add an attachment to it.

 

Hope that helps.

chakrapuchakrapu

Ok Thank you Imran...

 

Let me try.