• Alex 2.0
  • NEWBIE
  • 0 Points
  • Member since 2007

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 4
    Questions
  • 13
    Replies

 

Hi,

 

before I start trying this out, is there any reason why I can't fake the mass email functionality using a Visualforce email template by looping through a list of contacts and sending individual emails with APEX?

 

 

I know there is a limit of 1000 per day and that's fine. Are there any other limitations?

 

And since I'm here...do you know if someone has already done something similar:p ?

 

Please SF allow us to use the VF templates on mass emails...they are kind of useless the way they are now!

 

Thanks,

 

Alex Sartogo

 

 

Hi all,

 

I think the answer is no, but I'll ask anyway.

 

Is it possible to attach a visualforce page rendered as pdf that uses a custom controller, in a visualforce email template?

 

I saw a post that describes using a component, but I already have the page and the controller built...it seems that it shouldn't take much to make that available as an attachment in an email template. It's kind of silly to have to duplicate things.

 

Are there any workarounds?

 

Thanks,

 

--Alex


Hi,
 
I'm building a VisualForce page that needs to send a report to an email address entered in a textfield (not a User or a Contact) using a VisualForce template
 
According to the docs, targetObjectId is an optional field when sending an email, but I keep getting this error:
 
SendEmail failed. First exception on row 0; first error: REQUIRED_FIELD_MISSING, Missing targetObjectId with template
 
If I set the TargetObjectId to an existing contact, it all works fine, but I do not want these email to always go to a contact.
 
Is there anything I'm missing? 
 
 
Thanks so much for your help!
 
--Alex 
 
Here's the code:
 
    Messaging.SingleEmailMessage emailMsg = new Messaging.SingleEmailMessage();
    emailMsg.setSaveAsActivity(false);
    emailMsg.setWhatId(AccountProfile.Id);
    emailMsg.setTemplateId([select Id from EmailTemplate where DeveloperName = 'AccountProfileReportEmail'].Id);
    String[] emailAddresses = emailTo.split(';');
    emailMsg.setToAddresses(emailAddresses);
     Messaging.SendEmailResult[] sers;
        //Insert PDF as quote attachment & send email
        try
        {
            //insert profileAttachment;
            sers = Messaging.sendEmail(new Messaging.SingleEmailMessage[] {emailMsg});
        }
        catch(DmlException dmle)
        {
            for (Integer i=0; i < dmle.getNumDml(); i++)
                ApexPages.addMessage(new ApexPages.Message(ApexPages.Severity.ERROR, dmle.getDmlMessage(i)));

            Database.rollback(sp);
            return null;
        }
        catch(Exception e)
        {
            ApexPages.addMessage(new ApexPages.Message(ApexPages.Severity.ERROR, e.getMessage()));
            Database.rollback(sp);
            return null;
        }  
Hi All,
 
are there any examples of using the Metadata API with PHP? I need to create some objects with many fields, doing it programmatically would save me loads of time.
 
Also, why the metadata API is available for download in my developer edition and not in the sandbox or production environment?
 
 
Thanks,
 
Alex

Hi,
 
I'm building a VisualForce page that needs to send a report to an email address entered in a textfield (not a User or a Contact) using a VisualForce template
 
According to the docs, targetObjectId is an optional field when sending an email, but I keep getting this error:
 
SendEmail failed. First exception on row 0; first error: REQUIRED_FIELD_MISSING, Missing targetObjectId with template
 
If I set the TargetObjectId to an existing contact, it all works fine, but I do not want these email to always go to a contact.
 
Is there anything I'm missing? 
 
 
Thanks so much for your help!
 
--Alex 
 
Here's the code:
 
    Messaging.SingleEmailMessage emailMsg = new Messaging.SingleEmailMessage();
    emailMsg.setSaveAsActivity(false);
    emailMsg.setWhatId(AccountProfile.Id);
    emailMsg.setTemplateId([select Id from EmailTemplate where DeveloperName = 'AccountProfileReportEmail'].Id);
    String[] emailAddresses = emailTo.split(';');
    emailMsg.setToAddresses(emailAddresses);
     Messaging.SendEmailResult[] sers;
        //Insert PDF as quote attachment & send email
        try
        {
            //insert profileAttachment;
            sers = Messaging.sendEmail(new Messaging.SingleEmailMessage[] {emailMsg});
        }
        catch(DmlException dmle)
        {
            for (Integer i=0; i < dmle.getNumDml(); i++)
                ApexPages.addMessage(new ApexPages.Message(ApexPages.Severity.ERROR, dmle.getDmlMessage(i)));

            Database.rollback(sp);
            return null;
        }
        catch(Exception e)
        {
            ApexPages.addMessage(new ApexPages.Message(ApexPages.Severity.ERROR, e.getMessage()));
            Database.rollback(sp);
            return null;
        }  
I have encountered a strange problem with a visualforce email template. When I preview the template everything seems to be fine. It appears as I expect in the preview window of the salesforce interface, and the test emails that I send to myself via the 'Preview' button arrive without a problem. However, when the approval process rule triggers the email to be sent the only thing that my users are receiving is an email with the subject only...the body of the email is completely blank! I have yet to figure out why this is, so if anybody has any suggestions I would be very grateful.
Code:
<messaging:emailTemplate subject="New Web-to-Trial Request requires your Approval" recipientType="User" relatedToType="Opportunity">
<messaging:htmlEmailBody >
   <html>
     <body>
    
    <style type="text/css">
      p.regular {font-family: arial; size: 8pt;}
      p.small {font-family: arial; size 8pt; line-height: 100%}
    </style>  
    <p class="regular">
    <br>A New Trial Request has been submitted.</br>
    <br>Account: <apex:outputLabel >{!relatedTo.Account.Name}</apex:outputLabel></br>
    <br><apex:outputText >Requested By: {!relatedTo.Contact__r.Name}</apex:outputText></br> 
     <br>To approve, simply type 'Approved' in your response. You can also review the Opportunity or Approve online at https://emea.salesforce.com/{!relatedTo.Id}</br>
     </p>
     </body>
   </html>
</messaging:htmlEmailBody>
</messaging:emailTemplate>

 


Message Edited by AKall on 01-16-2009 01:26 PM
  • January 16, 2009
  • Like
  • 0
Hi All,
 
If I'm running the following query:
 
SELECT Id, AccountId, Contact.FirstName FROM Case
 
How do I access the Contact.FirstName value with the PHP toolkit? I tried $sObject->fields->FirstName but it doesnt work.
 
Thanks for the help!
 
  • December 15, 2007
  • Like
  • 0
Hello,

I use salesforce Perl API and I can execute queries on
most saleforce tables (72 of them). However, there are 8
tables which I cannot query at all. These tables are: Name,
NoteAndAttachment, EmailStatus, OpenActivity,AdditionalNumber,
ProcessInstanceHistory, Approval and ActivityHistory.

When these same tables are queried with Perl API the following error
is generated:

INVALID_TYPE_FOR_OPERATION: entity type does not support query

Its worth pointing out that these entities ARE in the wsdl file,
and they ARE being referenced by other tables, and I CAN call
describe() on them from the API, and all the correct fields and their
types are returned..

So, does anybody have any ideas why do these tables not support
queries ? And what could I possibly do to debug this matter ?

Thanks ahead for any suggestions,


--Fluffy

PS. Apologies for cross-posting
  • December 11, 2007
  • Like
  • 0
Hi Guys, I need to write a PHP script and dont want to start from scratch.

What I'm looking for is a script that takes a username and password (that is entered on a form), and checks to see if that user/pass exists in our SalesForce customer database, but also checks a third field which defines whether or not they are a subscriber.

So:

<Connect to salesforce>

<Select Customer where user = x>
    If {user doesnt exist -> return to login and show error: user does not exist}
    If {user.pass doesnt = y -> return to login and show error: invalid password}
   
// Check subscription status
    If {customer.subscription_status = inactive -> return to login and show error: Subscription Inactive}

else { Set session var for username and log the customer into the website}


Anyone have something like this sitting around?

Thanks,
Chris
Okay, I know this is going to be a dumb question, and I know it's going to irritate some people that I'm even asking, because I'm sure the answer exists somewhere.   However, I can't find it easily and so I'm asking for help.
 
I just want a simple explanation of how to get a php page on my server to connect my salesforce.com account and display any piece of data from that account.  I will probably use the Partner WSDL but other than knowing where to find that xml file to download, I am lost.  I don't know how to use that xml file or even where to put it for use, much less make a connection through it.
 
Any help would be appreciated.
Is there a php call that can obtain the 'Name' value of the WhatId field in the Task object?
Hi All,
 
are there any examples of using the Metadata API with PHP? I need to create some objects with many fields, doing it programmatically would save me loads of time.
 
Also, why the metadata API is available for download in my developer edition and not in the sandbox or production environment?
 
 
Thanks,
 
Alex
Hi, I'm getting a persistent INVALID_LOGIN problem...

I am 100% sure the username and password are right.  I cut and paste them into the web login and that worked. 
The wsdl is a fresh download from this morning and it is accessible in that spot.



here's the code.  it's just a little POC for connecting to SF via PHP api and nothing is doing yet:

ini_set("soap.wsdl_cache_enabled", "0");
require_once (DIR_FS_SF_SOAP_CLIENT.'SforceEnterpriseClient.php');
require_once (DIR_FS_SF_SOAP_CLIENT.'SforceHeaderOptions.php');

try
{

   
    $mySforceConnection = new SforceEnterpriseClient ();
    $mySoapClient = $mySforceConnection->createConnection(DIR_FS_SF_SOAP_CLIENT."enterprise.wsdl.xml");
    $mylogin = $mySforceConnection->login("XXX", "YYY");

      $userResult = $mylogin->userInfo;
      print_r($userResult);
      echo $userResult->userFullName.', your session id is '.$mylogin->sessionId;

      $query = 'SELECT * FROM Opportunity';
      $response = $mySforceConnection->query(($query));

      print_r($response);

      foreach ($response->records as $record)
      {
       print_r($record);
      }

      print_r($mySforceConnection->getLastRequest());

      $bagent = $_SERVER["HTTP_USER_AGENT"];
      echo '<b>USER AGENT:</b> '.$bagent.'<br><br>';

}
catch (Exception $e)
{
  echo $e->faultstring;
}
  • November 08, 2007
  • Like
  • 0