1

In above picture I'm going to send an email if answer__c updates.

There are 8 questions with Type FCPA as mentioned in workflow. When i click on Next Button as shown in image, Then 8 records are going to be saved, if any one open that questions and modified three of them, then those three modified answers needs to be send as an email.

I appreciate for any solutions or ideas.

3
  • do answer__c rollup to any parent record? You're going to need to issue emails on some consolidation object
    – cropredy
    Commented May 26, 2016 at 0:23
  • No @cropredy. Answer is just long text area and not related to any other object. The thing is How can we club in single email, few modified records at a time.
    – user24737
    Commented May 26, 2016 at 1:29
  • I am not able to think of any declarative solution of this problem until updated answers can be clubbed in single record. You can try VF based email templates, but it would be little bit coding. Commented May 26, 2016 at 2:08

1 Answer 1

1

If Answer__c is not a child of some common parent object, then you are going to need to add some sort of sessionId__c field to Answer__c where all answers for a given user session are implicitly related to each other by a common sessionId__c.

Given that, if you know when the session is completed, you could initiate one of:

  • Apex Queueable job that looked for Answer__c with the same sessionId__c collecting them into a list
  • A Visual WorkFlow that in turn called an Apex @invocable method that is either passed the sessionId or the actual list of Answer__c. This Visual Workflow can be started from your controller and need not involve any user interactions
  • A Process Builder flow triggered by DML on some Session__c custom object that in turn calls @invocable Apex that does the same list assembly as above
  • Let your controller do the work itself and read the Answer__c for the given session

One way or another, since the DML events on Answer__c occur over time for some user session, then you need to signal something when the session is over to collect up the answers and use Apex to send the email.

2
  • Hi @cropredy I'm not aware of that process, Can you please provide any example of any of them.
    – user24737
    Commented May 26, 2016 at 7:26
  • @chris -- sorry, an example doesn't come to mind. The above ideas were meant to inspire rethinking the problem as an OOB solution to merge emails from different DML events doesn't exist
    – cropredy
    Commented May 26, 2016 at 13:41

You must log in to answer this question.