7

Suppose i want to upload 1000 tasks via the data loader and i want that the owner of those tasks should receive a notification mail about the tasks assigned to them. How can i achieve this?

Note: I do not want to use a trigger.

If i had to do this via the UI, i could simply check the "Send Notification Email" checkbox on the task page layout.

enter image description here

But how do i achieve this when i upload tasks via the data loader? I could not find any field representing "Send Notification Email" checkbox.

Which field represents(API Name) the "Send Notification Email" checkbox present on the Task page layout?

Also is it possible to override "Send Notification Email" checkbox?

1
  • 1
    There is no "field" for this, it is a feature of the UI. Also, you cannot adjust the "default setting" through the Apex Data Loader. You would necessarily need a trigger to do this.
    – sfdcfox
    Commented Jul 18, 2013 at 14:38

4 Answers 4

5

There is no such field in API available as of now. Also you will not be able to achieve this with the help of workflows since for the TASK object even in workflow the email alert option is not available.

The probable approach according to me is to write down a trigger on the task object to send an email to the assigned user.

refer to this link for sending an email using apex

http://www.salesforce.com/us/developer/docs/apexcode/Content/apex_classes_email_outbound.htm

Refer to the Email section in the below link

http://www.salesforce.com/us/developer/docs/apexcode/Content/apex_gov_limits.htm

2
  • Thanks. However, this will easily hit the limit of 1000 emails which are allowed via apex. Commented Jul 18, 2013 at 15:00
  • 2
    I have edited the post please refer to the link. That 1000 limit is for external addresses not for the users of the organization.
    – user3170
    Commented Jul 18, 2013 at 16:03
5

You need to set DMLOptions like this before inserting the task

Task t = new Task(Subject='Follow-up');

Database.DMLOptions dmlo = new Database.DMLOptions(); dmlo.EmailHeader.triggerUserEmail = true; database.insert(t, dmlo);

1
  • This works! good apex solution. not a dataloader solution. Commented Aug 19, 2020 at 12:28
4

I'm hoping I'm wrong on this, but I don't believe the data loader provides support for this, and as far as I know none of the other data loading tools do either.

If you're inserting records with APEX or via the API most of the standard notification emails don't get sent. Fortunately for those avenues you can use the DMLOptions config parameter, specifically the emailHeader, to let Salesforce know you'd like to send them.

1
  • Thanks Ralph!! As per the link, "Even though auto-sent emails can be triggered by actions in the Salesforce user interface, the DMLOptions settings for emailHeader take effect only for DML operations carried out in Apex code." My Earlier thought was that i could write a before insert trigger and use the "EmailHeader", but the statement says that we can use the attribute only with DML operations via apex code.So i am not sure how this would work in my case, since i will be inserting/updating the records via Data loader. Anyways, it was useful info. Thanks for sharing. Commented Jul 22, 2013 at 9:30
0

You can create an event based command line batch which detects the sucess file in the directory specified during dataloader export/import,after the file is available in the directory, it triggers an email command batch. It would need configuring the SMTP server etc.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .