• ATUL GUPTA 94
  • NEWBIE
  • 0 Points
  • Member since 2019

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 3
    Replies
I am creating community user ,Iam able to create user but Iam not gettting Email  in user mail id .


Lead rec = new Lead();
        rec.LastName ='pooja';
        rec.Phone = '8983443423';
        rec.Email = 'pooja@oaktreecloud.com';
        rec.Country = 'India';
        rec.Company = 'testing';
        rec.Status =    'Open - Not Contacted';
        rec.Password__c = 'test123';
        insert rec;



 Account acc = new Account();
            acc.Name= (rec.FirstName !=null ? rec.FirstName + ' '+ rec.LastName : rec.LastName);

            insert acc;
            
            Contact con = new Contact();
            con.LastName=  rec.LastName;
            con.AccountId = acc.id;
            insert con;
            
            User user = new User();
            user.ProfileID = [Select Id From Profile Where Name='Customer Community User'].id;
            user.EmailEncodingKey = 'ISO-8859-1';
            user.LanguageLocaleKey = 'en_US';
            user.TimeZoneSidKey = 'America/New_York';
            user.LocaleSidKey = 'en_US';
            user.FirstName = (rec.FirstName !=null ? rec.FirstName + ' '+ rec.LastName : rec.LastName);
            user.LastName = rec.LastName;
            user.Username = '12354545'+rec.Email;   
            user.CommunityNickname = rec.LastName;
            user.Alias = 't1';
            user.Email = rec.Email;
            user.IsActive = true;
            user.ContactId = con.Id;
            
ase.DMLOptions dlo = new Database.DMLOptions();
dlo.EmailHeader.triggerUserEmail = true;

 Database.insert(user,dlo);
 

Hi,

 

When we create a user in salesforce, I would like to restrict the login credential email to be sent. How can we restrcict the user receiving the login credentails at the time of user creation?

 

I would like to send the credentials later but not at the time of user creation. 

 

Any thoughts?

 

Thanks

  • October 07, 2013
  • Like
  • 0

how to create user through apex code.

Hi everyone,

I have a problem to sucessfully send a visualforce email within an image as background.

Everything is ok with other image in the template, using the correct syntax:

 

<apex:image id="Logo" value="https://c.cs16.content.force.com/servlet/servlet.ImageServer?id=015f0000000ADiz&oid=00Df0000001PSvt" height="120" width="120"/>

However there is no way to use that syntax into an attribute, neither into the css part.
Here what I am trying:

 

body
{
background-image:url('<apex:image id="Logo" value="https://c.cs16.content.force.com/servlet/servlet.ImageServer?id=015f0000000ADiz&oid=00Df0000001PSvt" height="120" width="120"/>');
background-repeat:no-repeat;
background-position:right top;
}

 

I have tryed with a static img, like:

 

                background-image:url('{!URLFOR($Resource.Logo)}');

it works fine on the preview but when I send the email the image is not displayed.

 

Any suggestion ?

Thanks