• ssuede7
  • NEWBIE
  • 25 Points
  • Member since 2004

  • Chatter
    Feed
  • 1
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 14
    Questions
  • 16
    Replies

Can anyone clue me in on how to bring an attachment down from SF so my users can download to their machine?

 

I understand how to query or retrieve from the attachment object and also understand the need to decode the base64 encoded body, but my attempts have gone nowhere thus far.  Here is my code:

//SF Header stuff require_once ($_SERVER["DOCUMENT_ROOT"].'/system/header_sforce.php'); //Grab an Attachement Id from the reqeust object $attid = $_REQUEST['attid']; //Query SF for the desired attachment $query = 'SELECT Id, ParentId, Name, BodyLength, Body FROM Attachment WHERE Id = \''.$attid.'\' '; $queryObject = $mySforceConnection->query($query); //Probably have some header() methods here echo base64_decode($queryObject->records[0]->Body);

 

I know it's not elegant, right now I'm just trying to get a rudimentary download working.  If someone could just cut and paste an example of some working code from their app that would be so awesome.

 

Thanks in advance.

 

 

 

 

 

Is it possible create or edit "ideas" through the enterprise API?  I am able to turn this feature on in salesforce and use it internally, but I do not see an "Ideas" object in the Apex Explorer. 

 

My company does not subscribe to the Customer Portal.

 

Thanks

 

Josh

Hi,

 

I am fairly new using PHP with Salesforce, I have successfully created several query calls and gotten results back, but now I want to update a contact but the code is failing.  I have compared my code to several examples and can find no problems, but it still doesn't work.  Here is the code:

 

 

$mySforceConnection = new SforceEnterpriseClient(); $mySoapClient = $mySforceConnection->createConnection($wsdl); $mylogin = $mySforceConnection->login($username, $password); $sObject1->fields = array('FirstName' => 'Josh'); $sObject1->type = 'Contact'; $sObject1->Id = '00330000004dBxw'; $response = $mySforceConnection->update(array($sObject1));

 

 

The error message I get is this:

 

PHP Warning:  Missing argument 2 for SforceEnterpriseClient::update(), called in C:\inetpub\wwwroot\account.php on line 21 and defined in C:\inetpub\wwwroot\system\soapclient\SforceEnterpriseClient.php on line 68
PHP Notice:  Undefined variable: type in C:\inetpub\wwwroot\system\soapclient\SforceEnterpriseClient.php on line 70
PHP Fatal error:  Uncaught SoapFault exception: [sf:INVALID_TYPE] INVALID_TYPE: Must send a concrete entity type. in C:\inetpub\wwwroot\system\soapclient\SforceBaseClient.php:414
Stack trace:
#0 [internal function]: SoapClient->__call('update', Array)
#1 C:\inetpub\wwwroot\system\soapclient\SforceBaseClient.php(414): SoapClient->update(Object(stdClass))
#2 C:\inetpub\wwwroot\system\soapclient\SforceEnterpriseClient.php(73): SforceBaseClient->_update(Object(stdClass))
#3 C:\inetpub\wwwroot\account.php(21): SforceEnterpriseClient->update(Array)
#4 {main}
  thrown in C:\inetpub\wwwroot\system\soapclient\SforceBaseClient.php on line 414

 

As you can see I've made the code pretty simple to eliminate possible problem points.  The core error seems to be "INVALID_TYPE: Must send a concrete entity type"  Anyone have any ideas?

 

I am using PHP 5.3.0 with the PHP 13.0 Toolkit.

  • September 09, 2009
  • Like
  • 0

Hi,

 

This must be really simple because I can't find any example of how to do this.  All I want to do is make my datetimes look nice.  Here is what I get out of my query results object: 

 

2009-09-04T06:43:36.000Z

 

And I would like to format it like this:

 

 

09/04/2009, 12:43 PM

 

Can anyone clue me in? 

 

 

  • September 04, 2009
  • Like
  • 0
How can I access an email which is associated with the history of a case?  I wish to create a list such in my own app.  I don't see an obvious object for emails. 

Is it correct to say that if I have downloaded a new WSDL file and generated the source code from it and then comipiled and integrated it into my app that I am now running on the SForce 6 platform?  Or is there more to it?

Message Edited by ssuede7 on 09-29-2005 08:58 AM

  • September 29, 2005
  • Like
  • 0

Does anyone know, is it possible to trigger the "contact" auto-email notification when creating a new case through the API?  I have just learned how to trigger an assignment rule, and that was fairly straight forward, I'm hoping there is a similar process for email???

Using API 5.0, Java / JSP App / Thanks in advance!

Can anyone provide some sample code showing how to retrieve an attachment from salesforce and make it accessible via a webpage link to a client.

 

Thanks

I wondering if anyone can briefly explain how to handle the body of a file (base64) once you obtain it from a query, i.e. 

 

somethinghere = attachment.getBody(); //how do I receive it?

??? //them how do I make it accessible to someone using my webapp through a link?

 

or a piece of sample code would really be nice.

I'm coding in JSP, I'm running sforce 5, on tomcat.   Thanks in advance!

Can anyone provide some working sample code of how to create and submit an attachement in JSP?  This would be much appreciated.

We can not get an attachment object to submit to salesforce.  We take a file from a multipart form, we encode it in base64 and then use the setBody() method to enbed it in an Attachment object.  All of that seems to go fine.  Then we call the .create call and everything seems to work, but the attachment will not go though.  The only way to verify that it didn't work is to use the isSuccess() method on the saveResults object, which tells that it didn't.  We don't get an kind of error message.  Can anyone shed some light on this?  We have verified that the base64 converter is converting the data.  We have used the create call successfully many times to create cases and contacts, etc.  Any help would be greatly appreciated. Thanks in advance.

Here is some of the code, simplied of course:

//Create an attachment object

Attachment att = new Attachment();

//set a parent id from an existing case object
  ID id = new ID("50030000000c8adAAA");
  att.setParentId(id);


//set the body with a byte array that is outputed from the base64 encoder   
  att.setBody(Base64.encode(dataBytes));
  att.setName("testfile.txt");

//set the file size with an integer
Integer filesize = new Integer(formDataLength);
  att.setBodyLength(filesize);

//create an sobject array to hold the attachment object
  SObject[] atts = new SObject[1];
  atts[0] = att;

//submit the new attachment to salesforce using the create call
  SaveResult[] saveResults2 = sforceLogin.getBindingStub().create(atts);
  if(saveResults2[0].isSuccess()) {
    out.println("worked");
  } else {
    out.println("didn't work");
  }

Hi

I have created a custom boolean field in my Solutions. When I try to run a query that includes this field, I get an error:

org.xml.sax.SAXException: Invalid element in com.sforce.soap.enterprise.sobject.Solution - TopSolution__c


I have generated a new WSDL file and recompiled. I have looked in the source code to verify that the custom field has indeed shown up.

Here is the query I am using (jSP):

QueryResult qr = sforceLogin.getBindingStub().query("select solutionname, solutionnumber, TopSolution__c from solution where solutionnumber = '00000012'");

Any Ideas??

     I want to access all of the cases from any case object associated with a particular contact.  however I CAN NOT figure out how to get the contact id out of the contact object. 

    also I tried to set the ownerid as a variable in jsp however it wouldn't convert to any primitive variable type.  I know this has something to do with the fact that the ownerid is a "tns" type as defined in the wsdl doc. 

     any help or insight on querying and referencing data in the contact or case objects would be extrememly helpful.  I'm working in JSP

Thank, Josh

I'm very new to Salesforce and am attempting to write an application for my company which will allow our clients to login and log a case or review cases, etc, just like the "self service portal", only more customized to our needs.  From what I understand so far, in order to create a session, you must use a salesforce login.  How can I write an app that will allow my companies clients to login and interact case data, using the self service portal login, rather than a real login?

or if that doesn't make sense,

how can I recreate the self service portal from scratch?

Can anyone clue me in on how to bring an attachment down from SF so my users can download to their machine?

 

I understand how to query or retrieve from the attachment object and also understand the need to decode the base64 encoded body, but my attempts have gone nowhere thus far.  Here is my code:

//SF Header stuff require_once ($_SERVER["DOCUMENT_ROOT"].'/system/header_sforce.php'); //Grab an Attachement Id from the reqeust object $attid = $_REQUEST['attid']; //Query SF for the desired attachment $query = 'SELECT Id, ParentId, Name, BodyLength, Body FROM Attachment WHERE Id = \''.$attid.'\' '; $queryObject = $mySforceConnection->query($query); //Probably have some header() methods here echo base64_decode($queryObject->records[0]->Body);

 

I know it's not elegant, right now I'm just trying to get a rudimentary download working.  If someone could just cut and paste an example of some working code from their app that would be so awesome.

 

Thanks in advance.

 

 

 

 

 

Hi,

 

I am fairly new using PHP with Salesforce, I have successfully created several query calls and gotten results back, but now I want to update a contact but the code is failing.  I have compared my code to several examples and can find no problems, but it still doesn't work.  Here is the code:

 

 

$mySforceConnection = new SforceEnterpriseClient(); $mySoapClient = $mySforceConnection->createConnection($wsdl); $mylogin = $mySforceConnection->login($username, $password); $sObject1->fields = array('FirstName' => 'Josh'); $sObject1->type = 'Contact'; $sObject1->Id = '00330000004dBxw'; $response = $mySforceConnection->update(array($sObject1));

 

 

The error message I get is this:

 

PHP Warning:  Missing argument 2 for SforceEnterpriseClient::update(), called in C:\inetpub\wwwroot\account.php on line 21 and defined in C:\inetpub\wwwroot\system\soapclient\SforceEnterpriseClient.php on line 68
PHP Notice:  Undefined variable: type in C:\inetpub\wwwroot\system\soapclient\SforceEnterpriseClient.php on line 70
PHP Fatal error:  Uncaught SoapFault exception: [sf:INVALID_TYPE] INVALID_TYPE: Must send a concrete entity type. in C:\inetpub\wwwroot\system\soapclient\SforceBaseClient.php:414
Stack trace:
#0 [internal function]: SoapClient->__call('update', Array)
#1 C:\inetpub\wwwroot\system\soapclient\SforceBaseClient.php(414): SoapClient->update(Object(stdClass))
#2 C:\inetpub\wwwroot\system\soapclient\SforceEnterpriseClient.php(73): SforceBaseClient->_update(Object(stdClass))
#3 C:\inetpub\wwwroot\account.php(21): SforceEnterpriseClient->update(Array)
#4 {main}
  thrown in C:\inetpub\wwwroot\system\soapclient\SforceBaseClient.php on line 414

 

As you can see I've made the code pretty simple to eliminate possible problem points.  The core error seems to be "INVALID_TYPE: Must send a concrete entity type"  Anyone have any ideas?

 

I am using PHP 5.3.0 with the PHP 13.0 Toolkit.

  • September 09, 2009
  • Like
  • 0

Hi,

 

This must be really simple because I can't find any example of how to do this.  All I want to do is make my datetimes look nice.  Here is what I get out of my query results object: 

 

2009-09-04T06:43:36.000Z

 

And I would like to format it like this:

 

 

09/04/2009, 12:43 PM

 

Can anyone clue me in? 

 

 

  • September 04, 2009
  • Like
  • 0
Hi, I have managed to introduce candidates through php salesforce follow this link: http://wiki.developerforce.com/index.php/Simple_Web2Lead_Implementation

Everything works perfectly, but I reached the source of the candidate "Ej: Organic google, addwords, etc. .."

What is there for this to arrive?

Thank you.

Does anyone know, is it possible to trigger the "contact" auto-email notification when creating a new case through the API?  I have just learned how to trigger an assignment rule, and that was fairly straight forward, I'm hoping there is a similar process for email???

Using API 5.0, Java / JSP App / Thanks in advance!

I wondering if anyone can briefly explain how to handle the body of a file (base64) once you obtain it from a query, i.e. 

 

somethinghere = attachment.getBody(); //how do I receive it?

??? //them how do I make it accessible to someone using my webapp through a link?

 

or a piece of sample code would really be nice.

I'm coding in JSP, I'm running sforce 5, on tomcat.   Thanks in advance!

We can not get an attachment object to submit to salesforce.  We take a file from a multipart form, we encode it in base64 and then use the setBody() method to enbed it in an Attachment object.  All of that seems to go fine.  Then we call the .create call and everything seems to work, but the attachment will not go though.  The only way to verify that it didn't work is to use the isSuccess() method on the saveResults object, which tells that it didn't.  We don't get an kind of error message.  Can anyone shed some light on this?  We have verified that the base64 converter is converting the data.  We have used the create call successfully many times to create cases and contacts, etc.  Any help would be greatly appreciated. Thanks in advance.

Here is some of the code, simplied of course:

//Create an attachment object

Attachment att = new Attachment();

//set a parent id from an existing case object
  ID id = new ID("50030000000c8adAAA");
  att.setParentId(id);


//set the body with a byte array that is outputed from the base64 encoder   
  att.setBody(Base64.encode(dataBytes));
  att.setName("testfile.txt");

//set the file size with an integer
Integer filesize = new Integer(formDataLength);
  att.setBodyLength(filesize);

//create an sobject array to hold the attachment object
  SObject[] atts = new SObject[1];
  atts[0] = att;

//submit the new attachment to salesforce using the create call
  SaveResult[] saveResults2 = sforceLogin.getBindingStub().create(atts);
  if(saveResults2[0].isSuccess()) {
    out.println("worked");
  } else {
    out.println("didn't work");
  }

Hi

I have created a custom boolean field in my Solutions. When I try to run a query that includes this field, I get an error:

org.xml.sax.SAXException: Invalid element in com.sforce.soap.enterprise.sobject.Solution - TopSolution__c


I have generated a new WSDL file and recompiled. I have looked in the source code to verify that the custom field has indeed shown up.

Here is the query I am using (jSP):

QueryResult qr = sforceLogin.getBindingStub().query("select solutionname, solutionnumber, TopSolution__c from solution where solutionnumber = '00000012'");

Any Ideas??

     I want to access all of the cases from any case object associated with a particular contact.  however I CAN NOT figure out how to get the contact id out of the contact object. 

    also I tried to set the ownerid as a variable in jsp however it wouldn't convert to any primitive variable type.  I know this has something to do with the fact that the ownerid is a "tns" type as defined in the wsdl doc. 

     any help or insight on querying and referencing data in the contact or case objects would be extrememly helpful.  I'm working in JSP

Thank, Josh

I'm very new to Salesforce and am attempting to write an application for my company which will allow our clients to login and log a case or review cases, etc, just like the "self service portal", only more customized to our needs.  From what I understand so far, in order to create a session, you must use a salesforce login.  How can I write an app that will allow my companies clients to login and interact case data, using the self service portal login, rather than a real login?

or if that doesn't make sense,

how can I recreate the self service portal from scratch?