• Eric Santiago
  • NEWBIE
  • 0 Points
  • Member since 2005

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 3
    Questions
  • 5
    Replies
I'm having trouble getting information from the parent (Account) of a custom object. The error is MALFORMED_QUERY: SOQL statements can't query related data. I've confirmed that I am using the PHP 1.1 toolkit and the 8.0 partner wsdl file. Any other suggestions?

Code:
<—php

//include ('header.inc');
require_once ('../soapclient/SforcePartnerClient.php');
require_once ('../soapclient/SforceHeaderOptions.php');

session_start();

//login
try {
  $mySforceConnection = new SforcePartnerClient();
  $mySoapClient = $mySforceConnection->createConnection("partner.wsdl.xml");
  $mylogin = $mySforceConnection->login("******", "*****");

  $userResult = $mylogin->userInfo;
  
  echo $e->faultstring;
  echo "Error. Could not connect to Salesforce session.";
  exit;
}


$mySforceConnection;
$myUserInfo;

function getJobPosts($connection) {
try {
  $query = 'SELECT Id, Title__c, Publish_Start__c, Employer__c, Employer__r.Name from Job_Posting__c Where Status__c = \'Published\' and Publish_Start__c <= ' .date('Y-m-d').' and Publish_End__c >= ' .date('Y-m-d').' ORDER BY Publish_Start__c DESC Limit 10';
  $queryOptions = new QueryOptions(500);
  $response = $connection->query(($query), $queryOptions);
  return $response->records;
  }catch(Exception $e) {
  echo $e->faultstring;
}
}

/**
  * Print out a list of the published job postings.  *
 */
function displayRss() {
  global $mySforceConnection;
  //$result = $mySforceConnection->describeSObject("Account");

  //print_r($result);
$posts = getJobPosts($mySforceConnection);
  //print introduction paragraph
 print ('<–xml version="1.0"˜>'. "\r\n");
 print ('<rss version="2.0">'. "\r\n");
 print ('<channel>'. "\r\n");
    print ('<title>Management Leadership for Tomorrow</title>'. "\r\n");
    print ('<link>http://www.ml4t.org/</link>'. "\r\n");
    print ('<description>Job opportunities exclusive to MLT.</description>'. "\r\n");
    print ('<language>en-us</language>'. "\r\n");
    print ('<pubDate>'.date('l dS \of F Y h:i:s A').'</pubDate>'. "\r\n");
    print ('<lastBuildDate>'.date('l dS \of F Y h:i:s A').'</lastBuildDate>'. "\r\n");
    print ('<docs>http://blogs.law.harvard.edu/tech/rss</docs>'. "\r\n");
    print ('<generator>PHP</generator>'. "\r\n");
    print ('<managingEditor>--@ml4t.org</managingEditor>'. "\r\n");
    print ('<webMaster>--@ml4t.org</webMaster>'. "\r\n");
 
 if ($posts) {
 //list published positions
 try {
      foreach ($posts as $r) {
        $r = new SObject($r);
  print ('<item>'. "\r\n");
  print ('<title>'.$r->fields->Title__c.'</title>'. "\r\n");
  print ('<link>http://www.ml4t.org/MLT_Network/JobPosting/SearchJobPostingDetails.aspx™Id='.$r->Id.'&EmpName=Warner%20Bros.%20Entertainment</link>'. "\r\n");
  print ('<pubDate>'.$r->Publish_Start__c.'</pubDate>'. "\r\n");
  print ('</item>'. "\r\n");
      }
    } catch (Exception $e) {
      // Ignore Notices???
    }
    
  }
  else { print ('<item><title>No positions available at this time.</title><link>#</link><pubdate></pubdate></item>');
  }
  
  print ('</channel></rss>'. "\r\n");
}


displayRss();
?>

 

Message Edited by Eric Santiago on 08-10-2007 01:54 PM

    I'm writing a function to send an email to a contact referenced in a custom object. I was trying to use the SendEmail call defined in the API and the 9.0 Ajax kit.

Code:
  function sendEmail() {
var message = new sforce.SObject("SingleEmailMessage");
//message.set("CcAddresses", "me@ml4t.org");
message.set("BccSender",true);
//message.set("EmailPriority",EmailPriority.High);
message.set("ReplyTo", "{!$User.Email}");
message.set("SaveAsActivity", true);
message.set("Subject", "This is how you use the sendEmail call.");
//We can also just use an id for an implicit to address
message.set("TargetObjectId","0033000000Ew25A");
message.set("UseSignature",true);
message.set("PlainTextBody", "This is the body of the message.");

try
{
var sendResult = new sforce.SObject("SendEmailResult");
sendResult = sforce.connection.sendEmail(message);
}
catch(error)
{
//sforce.debug.log(error.faultcode);
//sforce.debug.log(error.faultstring);
errorMsg = sendResult.SendEmailError.Message;
txt="There was an error sending an email.\n\n";
txt+="Error description: " + errorMsg + "\n\n";
txt+="Click OK to continue.\n\n";
alert(txt);
}
}
Unfortunately, when I run this I get the error "An error has occurred: TypeError: sendResult.SendEmailError has no properties" So obviously the SendEmail call is unsuccessfull in creating a SendEmailResult object for me to get an error from. The sforce.debug log just reads Null. Not much to help me troubleshoot. Any one have some suggestions?
 

I've been experimenting with adding TinyMCE (http://tinymce.moxiecode.com/) to Sforce controls to add HTML formatting features to textareas in Salesforce.

Originally, I planned to add a pop-up window to the edit screen for my custom object and have the formatted text sent back to the parent window. Unfortunately, unless I'm mistaken, you can't add scontrols to the edit screen.

It seems then that the only option is to override the edit button. Ideally I'd like to run the TinyMCE javascript (see below) as the edit screen loads. Is there a way to do this?

Code:
<script type="text/javascript" src="http://wiki.moxiecode.com/examples/tinymce/jscripts/tiny_mce/tiny_mce.js"></script>
<script language="javascript" type="text/javascript">
tinyMCE.init({
mode : "textareas",
theme : "advanced",
plugins : "table,save,advhr,advimage,advlink,emotions,iespell,insertdatetime,preview,zoom,flash,searchreplace,print,contextmenu",
theme_advanced_buttons1_add_before : "save,separator",
theme_advanced_buttons1_add : "fontselect,fontsizeselect",
theme_advanced_buttons2_add : "separator,insertdate,inserttime,preview,zoom,separator,forecolor,backcolor",
theme_advanced_buttons2_add_before: "cut,copy,paste,separator,search,replace,separator",
theme_advanced_buttons3_add_before : "tablecontrols,separator",
theme_advanced_buttons3_add : "emotions,iespell,flash,advhr,separator,print",
theme_advanced_toolbar_location : "top",
theme_advanced_toolbar_align : "left",
theme_advanced_path_location : "bottom",
plugin_insertdate_dateFormat : "%Y-%m-%d",
plugin_insertdate_timeFormat : "%H:%M:%S",
extended_valid_elements : "a[name|href|target|title|onclick],img[class|src|border=0|alt|title|hspace|vspace|width|height|align|onmouseover|onmouseout|name],hr[class|width|size|noshade],font[face|size|color|style],span[class|align|style]",
external_link_list_url : "example_data/example_link_list.js",
external_image_list_url : "example_data/example_image_list.js",
flash_external_list_url : "example_data/example_flash_list.js"
});
</script>

 If that's also not an option, I was thinking about using a Scontrol that ran the tinyMCE code and then took advantage of the DescribeLayoutResult call to build the normal edit page layout. Using a dynamic rather than static page layout seemed the best way to reuse the WYSIWYG editor for any number of custom objects. Unfortunately, I haven't seen anu ajax samples using this call and developing it from scratch is far beyond my own expertise. Perhaps some ingenious soul is willing to take on the challenge?

 


I'm having trouble getting information from the parent (Account) of a custom object. The error is MALFORMED_QUERY: SOQL statements can't query related data. I've confirmed that I am using the PHP 1.1 toolkit and the 8.0 partner wsdl file. Any other suggestions?

Code:
<—php

//include ('header.inc');
require_once ('../soapclient/SforcePartnerClient.php');
require_once ('../soapclient/SforceHeaderOptions.php');

session_start();

//login
try {
  $mySforceConnection = new SforcePartnerClient();
  $mySoapClient = $mySforceConnection->createConnection("partner.wsdl.xml");
  $mylogin = $mySforceConnection->login("******", "*****");

  $userResult = $mylogin->userInfo;
  
  echo $e->faultstring;
  echo "Error. Could not connect to Salesforce session.";
  exit;
}


$mySforceConnection;
$myUserInfo;

function getJobPosts($connection) {
try {
  $query = 'SELECT Id, Title__c, Publish_Start__c, Employer__c, Employer__r.Name from Job_Posting__c Where Status__c = \'Published\' and Publish_Start__c <= ' .date('Y-m-d').' and Publish_End__c >= ' .date('Y-m-d').' ORDER BY Publish_Start__c DESC Limit 10';
  $queryOptions = new QueryOptions(500);
  $response = $connection->query(($query), $queryOptions);
  return $response->records;
  }catch(Exception $e) {
  echo $e->faultstring;
}
}

/**
  * Print out a list of the published job postings.  *
 */
function displayRss() {
  global $mySforceConnection;
  //$result = $mySforceConnection->describeSObject("Account");

  //print_r($result);
$posts = getJobPosts($mySforceConnection);
  //print introduction paragraph
 print ('<–xml version="1.0"˜>'. "\r\n");
 print ('<rss version="2.0">'. "\r\n");
 print ('<channel>'. "\r\n");
    print ('<title>Management Leadership for Tomorrow</title>'. "\r\n");
    print ('<link>http://www.ml4t.org/</link>'. "\r\n");
    print ('<description>Job opportunities exclusive to MLT.</description>'. "\r\n");
    print ('<language>en-us</language>'. "\r\n");
    print ('<pubDate>'.date('l dS \of F Y h:i:s A').'</pubDate>'. "\r\n");
    print ('<lastBuildDate>'.date('l dS \of F Y h:i:s A').'</lastBuildDate>'. "\r\n");
    print ('<docs>http://blogs.law.harvard.edu/tech/rss</docs>'. "\r\n");
    print ('<generator>PHP</generator>'. "\r\n");
    print ('<managingEditor>--@ml4t.org</managingEditor>'. "\r\n");
    print ('<webMaster>--@ml4t.org</webMaster>'. "\r\n");
 
 if ($posts) {
 //list published positions
 try {
      foreach ($posts as $r) {
        $r = new SObject($r);
  print ('<item>'. "\r\n");
  print ('<title>'.$r->fields->Title__c.'</title>'. "\r\n");
  print ('<link>http://www.ml4t.org/MLT_Network/JobPosting/SearchJobPostingDetails.aspx™Id='.$r->Id.'&EmpName=Warner%20Bros.%20Entertainment</link>'. "\r\n");
  print ('<pubDate>'.$r->Publish_Start__c.'</pubDate>'. "\r\n");
  print ('</item>'. "\r\n");
      }
    } catch (Exception $e) {
      // Ignore Notices???
    }
    
  }
  else { print ('<item><title>No positions available at this time.</title><link>#</link><pubdate></pubdate></item>');
  }
  
  print ('</channel></rss>'. "\r\n");
}


displayRss();
?>

 

Message Edited by Eric Santiago on 08-10-2007 01:54 PM

    I'm writing a function to send an email to a contact referenced in a custom object. I was trying to use the SendEmail call defined in the API and the 9.0 Ajax kit.

Code:
  function sendEmail() {
var message = new sforce.SObject("SingleEmailMessage");
//message.set("CcAddresses", "me@ml4t.org");
message.set("BccSender",true);
//message.set("EmailPriority",EmailPriority.High);
message.set("ReplyTo", "{!$User.Email}");
message.set("SaveAsActivity", true);
message.set("Subject", "This is how you use the sendEmail call.");
//We can also just use an id for an implicit to address
message.set("TargetObjectId","0033000000Ew25A");
message.set("UseSignature",true);
message.set("PlainTextBody", "This is the body of the message.");

try
{
var sendResult = new sforce.SObject("SendEmailResult");
sendResult = sforce.connection.sendEmail(message);
}
catch(error)
{
//sforce.debug.log(error.faultcode);
//sforce.debug.log(error.faultstring);
errorMsg = sendResult.SendEmailError.Message;
txt="There was an error sending an email.\n\n";
txt+="Error description: " + errorMsg + "\n\n";
txt+="Click OK to continue.\n\n";
alert(txt);
}
}
Unfortunately, when I run this I get the error "An error has occurred: TypeError: sendResult.SendEmailError has no properties" So obviously the SendEmail call is unsuccessfull in creating a SendEmailResult object for me to get an error from. The sforce.debug log just reads Null. Not much to help me troubleshoot. Any one have some suggestions?
 

I've been experimenting with adding TinyMCE (http://tinymce.moxiecode.com/) to Sforce controls to add HTML formatting features to textareas in Salesforce.

Originally, I planned to add a pop-up window to the edit screen for my custom object and have the formatted text sent back to the parent window. Unfortunately, unless I'm mistaken, you can't add scontrols to the edit screen.

It seems then that the only option is to override the edit button. Ideally I'd like to run the TinyMCE javascript (see below) as the edit screen loads. Is there a way to do this?

Code:
<script type="text/javascript" src="http://wiki.moxiecode.com/examples/tinymce/jscripts/tiny_mce/tiny_mce.js"></script>
<script language="javascript" type="text/javascript">
tinyMCE.init({
mode : "textareas",
theme : "advanced",
plugins : "table,save,advhr,advimage,advlink,emotions,iespell,insertdatetime,preview,zoom,flash,searchreplace,print,contextmenu",
theme_advanced_buttons1_add_before : "save,separator",
theme_advanced_buttons1_add : "fontselect,fontsizeselect",
theme_advanced_buttons2_add : "separator,insertdate,inserttime,preview,zoom,separator,forecolor,backcolor",
theme_advanced_buttons2_add_before: "cut,copy,paste,separator,search,replace,separator",
theme_advanced_buttons3_add_before : "tablecontrols,separator",
theme_advanced_buttons3_add : "emotions,iespell,flash,advhr,separator,print",
theme_advanced_toolbar_location : "top",
theme_advanced_toolbar_align : "left",
theme_advanced_path_location : "bottom",
plugin_insertdate_dateFormat : "%Y-%m-%d",
plugin_insertdate_timeFormat : "%H:%M:%S",
extended_valid_elements : "a[name|href|target|title|onclick],img[class|src|border=0|alt|title|hspace|vspace|width|height|align|onmouseover|onmouseout|name],hr[class|width|size|noshade],font[face|size|color|style],span[class|align|style]",
external_link_list_url : "example_data/example_link_list.js",
external_image_list_url : "example_data/example_image_list.js",
flash_external_list_url : "example_data/example_flash_list.js"
});
</script>

 If that's also not an option, I was thinking about using a Scontrol that ran the tinyMCE code and then took advantage of the DescribeLayoutResult call to build the normal edit page layout. Using a dynamic rather than static page layout seemed the best way to reuse the WYSIWYG editor for any number of custom objects. Unfortunately, I haven't seen anu ajax samples using this call and developing it from scratch is far beyond my own expertise. Perhaps some ingenious soul is willing to take on the challenge?

 


I hope this is the right forum section for this post...
 
I am trying to use Eclipse 3.2 for the development of SControls, and when I have the Update Manager fetch the toolkit from the salesforce site, I am getting the following error:
 
Requested operation cannot be performed because it would invalidate the current configuration. See details for more information.
  WST Common Core Feature (1.0.1.v200602151554) requires feature "org.eclipse.jem (1.1.0.1)", or equivalent.   org.eclipse.wst.server_core.feature (1.0.1.v200602151554) requires feature "org.eclipse.rcp (3.1.1)", or equivalent.   XML Core Feature (1.0.1.v200602151554) requires feature "org.eclipse.rcp (3.1.1)", or equivalent. ....
 
Should I uninstall Eclipse and get Version 3.1 or is there a newer toolkit coming?
 
Thx.
  • September 29, 2006
  • Like
  • 0