• Ivan-m
  • NEWBIE
  • 0 Points
  • Member since 2010

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 2
    Questions
  • 3
    Replies

I'm using this template to send Username and password to user:

 

 

Dear {!Contact.FirstName},

Your {!Organization.Name} Customer Portal login and password information is below.

Thank you,

{!Organization.Name} Customer Support

 

Out of the box salesforce functionality somehow adds Username: xxxx Password:yyyy strings to the end of template. But, I can't find how I can do that? Methods setPlainTextBody() and setHTMLBody are not allowed when I use email template.

Here is shrd code snipplet. I need attach Username and password to the bottom, but how?:

 

Id templateId = [select et.Id from EmailTemplate et where et.name = 'Customer Portal:  Customer Portal New User Login Information (SAMPLE)' LIMIT 1].Id;

        String[] toAddresses;
        String password;
        Messaging.SingleEmailMessage mail;

 

            password = System.resetPassword(cpUser.Id, false).getPassword();
            System.debug('New password:'+password);

            //Send email notification
            toAddresses = new String[] {cpUser.email};
            
            mail = new Messaging.SingleEmailMessage();
            mail.setToAddresses(toAddresses);
            mail.setTemplateId(templateId);
            
            mail.setTargetObjectId(cpUser.contact.Id);

 

//This part doesn't work for sure =)           
            mail.setHtmlBody('Username:'+cpUser.Username+' Passord:'+password);
            Messaging.sendEmail(new Messaging.SingleEmailMessage[] { mail });
            System.debug('Email has been sent');

  • April 19, 2010
  • Like
  • 0

My issue is:

I'm trying to make select of customer portal profiles using this expression:

 

Profile[] profiles = [Select p.name, p.id From Profile p where p.UserLicense.Name like '%Customer Portal%'];

 

But, I need to show only those profiles, which are enabled in Setup->Customer portal -> Settings. Then Click on portal -> edit profiles. Then select 'Active' check boxes on profiles.

I've looked thru all fields of profiles, but still can't find that values. What is the name for Customer portal object in apex explorer?

 

Any Ideas?

 

Thanks.

  • April 14, 2010
  • Like
  • 0

My issue is:

I'm trying to make select of customer portal profiles using this expression:

 

Profile[] profiles = [Select p.name, p.id From Profile p where p.UserLicense.Name like '%Customer Portal%'];

 

But, I need to show only those profiles, which are enabled in Setup->Customer portal -> Settings. Then Click on portal -> edit profiles. Then select 'Active' check boxes on profiles.

I've looked thru all fields of profiles, but still can't find that values. What is the name for Customer portal object in apex explorer?

 

Any Ideas?

 

Thanks.

  • April 14, 2010
  • Like
  • 0

One can access an Organization's Default Time Zone follow through the following:

 

Administration Setup->Company Profile->Company Information->Default Time Zone

 

However, I cannot find it listed anywhere in the SOQL Explorer (actually I'm browsing through the Force.com IDE) .

 

How can I get this information in an APEX class?

Hi,
I am sending emails through my Apex class(NOT VisualForce APEX class). The text body of EMail contains the hyperlink to one of my Visualforce page. But depending on the Salesforce account type the instance name in the URL changes.(Example: https://cs2.salesforce.com/apex/myTimeSheets).

In above case cs2 can be na1 or na2 depending on instance type.
Is there any method in APEX by which I can get the name of the SF instance?
This is very simple in SControl but I am not getting anything in Apex fopr the same.