Find your content:

Search form

You are here

Send bulk financial force emails

 
Share

I am trying to automate the sending of sales invoices generated through financial force. I would like a one click process which fetches the outstanding invoices, bulk emails them and then marks them as sent.

The problem I have run up against is the bulk email service wont let me specify an invoice id for the WhatIds. The TargetObjectIds are a list of contacts and the WhatIds need to be the invoices so the template can successfully generate the attachment.

It seems like I can use the single email service to do this as it doesn't have the same restrictions on the WhatIds but I have hundreds to send at a time.

Does anyone know how this can be achieved or how Financial Force does it with their mass email service?

Thanks

EDIT: The reason I am doing this rather than using the FF bulk sender is because after a successful send I need to have the invoices marked as printed.


Attribution to: ArthurGuy

Possible Suggestion/Solution #1

I work for FinancialForce in their developer support team and the way we do it in our mass email system is with large numbers of the Messaging.SingleEmailMessage object. The Messaging.sendEmail method takes a list/array of these, and as far as I know the only limit on size is that there's a cap of 1,000 emails sent from apex, per day (unless you convince salesforce to raise that).

Sample code:

List<Messaging.SingleEmailMessage> emails = new List<Messaging.SingleEmailMessage>();
for(integer i = 0; i < 15; i++){
    Messaging.SingleEmailMessage email = new Messaging.SingleEmailMessage();
    email.setSubject('email '+i+' of 15');
    email.setToAddresses( new List<String>{'myaddress@example.com'} );
    email.setPlainTextBody('this message was generated from apex');
    emails.add(email);
}
Messaging.sendEmail(emails);

and look what happens:

The results


Attribution to: ca_peterson
This content is remixed from stackoverflow or stackexchange. Please visit https://salesforce.stackexchange.com/questions/3995

My Block Status

My Block Content