0

I want to send a VF Email template but I also want to have User inputted data. Is this possible without creating an extra object to store this additional information on?

My Template will contain a parent object, but it will have a single child selected as well as specific grandchildren selected from that child.

I thought of 2 potential options if I cannot do this direct but I'd prefer not to use them.

1) Attach the item as a pdf that shares a controller with the page used to make the selections

2) Create an object to store all this information and run the template on this.

  • what sends the VF email template? apex code? workflow/process flow email alert? or OOB end user action 'send an email' button? – cropredy Apr 26 '16 at 0:43
  • @cropredy Apex code in a VF page. – dphil Apr 26 '16 at 1:14
  • so , I must be missing something, but can't the user-input be saved in custom fields on parent object (or whatever object(s) the VF controller has access to? – cropredy Apr 26 '16 at 1:18
  • No because there is a dynamic number of child objects it needs to bring information in about. I could theoretically save all the ids comma delimited and then try to parse it in the template but I'm trying to void workarounds like that. – dphil Apr 26 '16 at 1:22
1

Well, VF email templates can bring in values from either or both

a) object field values available through the relatedTo and recipient merge fields (basically, the target object and any of its relationships; the email destination Contact/Lead/User). In effect, when the VF template is rendered, it has access to two controllers - one for relatedTo and one forrecipient.

b) through the use of custom VF components and hence access to the VF custom component's controller getter properties / get methods. The custom component can be passed attribute values from the enclosing template - but in effect, this becomes values referenceable to relatedTo or recipient like relatedTo.id

Hence, any user input needs to be saved somewhere such that either the VF standard controllers or any custom controllers can access.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.