• #26500
    Salesforce | Neha Neha #956
    Forcetalks

    How to send Community Welcome Email to a User through Salesforce Apex?

    How to send Community Welcome Email to user through Apex ?

     

    #26505
    Salesforce | Neha Neha #956
    Forcetalks

    My correct question is “How to send Community Welcome email to user through Apex ?”

    #26554
    Salesforce | PRANAV PRANAV #954
    Forcetalks

    Hi Neha,

    You can try this using session id and create a url for the user and send back to the user to login https://<endpoint host>/secur/frontdoor.jsp?sid=<session id>”

    OR

    This particular feature is not very admin friendly (as you found out the hard way:). We chose to uncheck the “Send welcome email” box under Communities > Administration > Emails. We then created a workflow rule on the User object to send out the welcome email to new community users. The workflow rule fires on record creation only as has a criteria for “Profile EQUALS ‘Your Community Profile Name(s)'”.

    Hope this helps you.

    #26564
    Salesforce | Archit Archit #957
    Forcetalks

    You can also achive this by writting trigger on User sObject to shoot an email as per the example provided below. It can be achieve using workflow rule also but I am not sure for that.

    Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage();

    //Set email address

    String[] toAddresses = new String[] {emailAddr};

    mail.setToAddresses(toAddresses);

    mail.setSubject(‘Subject – User Creation’);

    mail.setPlainTextBody(‘User has been cretaed!’);

    Hope this helps.

    #26597
    Salesforce | Adarsh Adarsh #958
    Forcetalks

    Hi Neha,

    We can do it easly. In apex you need to check this:

    Database.DMLOptions dlo = new Database.DMLOptions();
    dlo.EmailHeader.triggerUserEmail = true;
    Database.insert(lstUserToBeInserted,dlo);

    And alo set the current community workspace administration Email’s setting as below-
    1. Open Community Workspaces or Community Management.
    2. Click Administration | Emails.
    3. Enter custom values for the email sender’s name and address to replace the default values.
    4. Also check the send welcome email checkbox and also select the desired email template for email body.

    Hope it helps 🙂

    • This reply was modified 1 year, 11 months ago by Salesforce | Adarsh Adarsh.
    #26599
    Salesforce | Neha Neha #956
    Forcetalks

    Hi Adarsh,

    Thanks for your response, it is working for me.

    Is there a way if “send welcome email checkbox” is false still it is sending a welcome mail to the user?

    #26608
    Salesforce | Adarsh Adarsh #958
    Forcetalks

    Hi Neha,

    This checkbox “send welcome email checkbox” to allow a user to send a welcome email while creating a community user is enable necessary. I am not found any way to overcome this functionality.

    So email sends only when this checkbox is enabled.

    Thank you.

    #26825
    Salesforce | Archit Archit #957
    Forcetalks

    Thanks Pranav,

    Your solution worked for me..!!

    #26905
    Salesforce | Neha Neha #956
    Forcetalks

    Hi Adarsh,

    It means we can not overwrite the “Send email”checkbox functionality of Community Welcome mail?

    • This reply was modified 1 year, 10 months ago by Salesforce | Neha Neha.
    • This reply was modified 1 year, 10 months ago by Salesforce | Neha Neha.
    • This reply was modified 1 year, 10 months ago by Salesforce | Neha Neha.
    #26916
    Salesforce | Adarsh Adarsh #958
    Forcetalks

    Hi Neha,

    Yes, we can not overwrite this standard functionality.

    #26930
    Salesforce | PRANAV PRANAV #954
    Forcetalks

    Hi Neha,

    You can also post the separate question for same for faster response.

    #26986
    Salesforce | Neha Neha #956
    Forcetalks

    Hi Pranav,

    My question is related to the same issue, still, I am confused about “Send Email” checkbox functionality related to Adarsh explanation. My question is totally relevant this discussion.

    Thanks for your suggestion

Viewing 12 posts - 1 through 12 (of 12 total)

Please to reply to this topic.

CONTACT US

We're not around right now. But you can send us an email and we'll get back to you, asap.

Sending

About Us

Forcetalks is a Salesforce collaboration platform for coders & developers, geeks & nerds, consultants & business heads, admins & architects, managers & marketers and of course the business owners. A community where you can learn from, where you can contribute to. For you. For Salesforce. Read More...

Copyright 2020 Forcetalks. All Right Reserved.

Log in with your credentials

or    

Forgot your details?