• TerryLuschen
  • NEWBIE
  • 30 Points
  • Member since 2011

  • Chatter
    Feed
  • 1
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 7
    Questions
  • 33
    Replies

Hi,

 

I'd like to use HTTP classes to load an image from the web then save it as an Attachment and finally send it attached to an email. At first glance everything seems to work fine. But the picture I receive is obviously a corrupt file. Any ideas what's wrong with my code:

 

 

public class EmailTestCtr {
	
	public Integer totalFileSize {get; set;}
	public Email__c mail {get; set;}
	public String contentType {get; set;}
	public String response {get; set;}
	
	public EmailTestCtr(){
		totalFileSize = 0;
	}
	
	public void loadFile(){
		String url = '';
		
		Http h = new Http();
		HTTPRequest req = new HttpRequest();
        
        req.setEndpoint('http://www.clienthouse.com/images/f106e78f34/CH_location_web1.jpg');
        req.setMethod('GET');
        req.setCompressed(false);
		
		HTTPResponse resp = h.send(req);
		this.contentType = resp.getHeader('Content-Type');
		this.response = resp.getHeader('Content-Length');
		
		System.debug(resp.getBody());
		String body = resp.getBody();
		
		Attachment a = new Attachment();
		try {		
			if(this.mail == null){
				mail = new Email__c(
					Name = 'test'
				);
				insert mail;
			}
			
			a.Body = Blob.valueOf(body);
			a.Name = 'Name';
			a.ParentId = mail.Id;
			a.ContentType = this.contentType;
			insert a;
		} catch(DMLException e){
			ApexPages.addMessages(e);
		}
		
		this.totalFileSize += [select BodyLength from Attachment where Id = :a.Id].BodyLength;
		
	}
	
	public void sendEmail(){
		
		Messaging.SingleEmailMessage email = new Messaging.SingleEmailMessage();
		String[] toAddresses = new String[] {'h.hess@clienthouse.com'};
		email.setToAddresses(toAddresses);
		email.setSubject(this.mail.Name);
		email.setPlainTextBody('Text goes here.');
		List<Messaging.EmailFileAttachment> files = new List<Messaging.EmailFileAttachment>();
		for(Attachment file : [select Name, Body, ContentType from Attachment where ParentId = :this.mail.Id]){
			System.debug('------------>FILE' + file);
			Messaging.EmailFileAttachment efa = new Messaging.EmailFileAttachment();
			efa.setBody(file.Body);
			efa.setContentType(file.ContentType);
			efa.setFileName(file.Name + '.jpg');
			files.add(efa);
		}
		email.setFileAttachments(files);
		
		Messaging.sendEmail(new Messaging.SingleEmailMessage[] { email });
		
	}
	
}

 

 

Thanks and best regards,

Henry

We are on a Winter 2014 sandbox and every time we do a Debug Log we are getting a STATEMENT_EXECUTE line for every line that is executed.  I have seen that this is a line that shows up when 'FINER' is set on the 'Apex Code' setting.   We have basically set all of the debug settings to 'ERROR' so we can try to stop these lines from being written out, but this line is still showing up.  This is making it very difficult to debug a large class that we are working on.

We also tried logging in as different users and the same problem occurred for the debug logs of each user.

Is this a new problem in Winter 2014?

Help?
Terry Luschen

Does anybody have any resources on integrating with SAP ByDesign?  We will want to send Accounts, Product Information and Orders to Salesforce.  We want to send Orders to SAP ByDesign.  We need real-time integration as each transaction occurs so any type of batch processing will not work.

 

I see that this is the link to the SAP ByDesign SDK:  http://help.sap.com/saphelp_byd_studio/fp40/KTP/Products/A1S_PDI/PDI_Library/GettingStarted_SubStructure/GettingStarted.html 

 

It seems like you can create web services in Microsoft Visual Studio and then deploy them to SAP ByDesign so they can be used.  Are there 'out of the box' web services available with SAP ByDesign to integrate with standard objects in SAP byDesign without having to create new custom web services?

 

Is SAP PI supposed to be utilized in any manner with SAP ByDesign?   From what I have read I think the answer is no.

 

I am very comfortable with all of the integration details on the Salesforce side.   I am just trying to figure out how to connect to the SAP ByDesign data.

 

 

I started with this cookbook, which was great.  

http://developer.force.com/cookbook/recipe/calling-salesforce-web-services-using-apex

 

I just want to call a custom WebService instead of a Describe call.

webservice static string processInboundMessage(string msgType, string xmlString)

 

Here is my code...

partnerSoapSforceCom.Soap sp = new partnerSoapSforceCom.Soap();
String username = 'myUserName';
String password = 'myPasswordMySecurityToken';
partnerSoapSforceCom.LoginResult loginResult = sp.login(username, password);
system.debug('Session ID: ' + loginResult);

string sessionHeaderSection = '';
sessionHeaderSection = '<soapenv:Header><hel:SessionHeader><hel:sessionId xsi:type="xsd:string">' + loginResult.SessionID + '</hel:sessionId></hel:SessionHeader></soapenv:Header>';

Http h = new http();
HttpRequest req = new HttpRequest();
 req.setEndpoint('https://cs8-api.salesforce.com/services/Soap/class/WbsrRegInterface');
//req.setEndpoint('https://cs8-api.salesforce.com/services/Soap/class/WbsrRegInterface?wsdl');
req.setMethod('POST');
req.setHeader('Content-Type', 'text/xml;charset=utf-8');

req.setHeader('SOAPAction', 'http://soap.sforce.com/schemas/class/WbsrRegInterface');

string msgType = 'REG';

string xmlStringToSend = 'MYXML';

 

string b ='<?xml version="1.0" encoding="utf-8"?><soapenv:Envelope xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/1999/XMLSchema" soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:hel="http://soap.sforce.com/schemas/class/WbsrRegInterface">'+sessionHeaderSection+'<soapenv:Body><hel:processInboundMessage><hel:msgType>'+msgType+'</hel:msgType><hel:xmlString>'+xmlStringToSend+'</hel:xmlString></hel:processInboundMessage></​soapenv:Body></soapenv:Envelope>';

 

req.setHeader('Content-Length',String.valueOf(b.length()));
req.setbody(b);
HttpResponse res = h.send(req);
system.debug('RESPONSE: ' + res.getBody() );

 

My login works and I know I am hitting my destination org because I can see it in the login history.  

 

My error is: 

<faultstring>The element type &quot;soapenv:Body&quot; must be terminated by the matching end-tag &quot;&lt;/soapenv:Body&gt;&quot;.</faultstring>

 

The XML I am sending looks like this:

<?xml version="1.0" encoding="utf-8"?>
<soapenv:Envelope
xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance"
xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsd="http://www.w3.org/1999/XMLSchema"
soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:hel="http://soap.sforce.com/schemas/class/WbsrRegInterface">
<soapenv:Header>
<hel:SessionHeader>
<hel:sessionId xsi:type="xsd:string">
00DL00000004YnR!ARIAQGHH9372teOXPI4.ZyepVnvUCXvndwhToI370HHrskPbloo80NCHNXjFHmrFSs4FAUSPNVVGRqLOQy.6IN_lBR8RZuAg
</hel:sessionId>
</hel:SessionHeader>
</soapenv:Header>
<soapenv:Body>
<hel:processInboundMessage>
<hel:msgType>REG</hel:msgType>
<hel:xmlString>fred</hel:xmlString>
</hel:processInboundMessage>
</​soapenv:Body>
</soapenv:Envelope>

 

Any ideas?

 

I am trying to refresh a sub page within the Service Cloud Console.

 

I have learned how to make Javascript calls properly to these functions to get my current tab's ID and the primary tab's ID.   My call-back functions work fine.  

 

sforce.console.getEnclosingTabId(refreshtab2);

sforce.console.getEnclosingPrimaryTabId(refreshtab);

 

I can also get calls to close a tab and refresh a primary tab to work fine.

sforce.console.refreshPrimaryTabById(tabId, true);

sforce.console.closeTab(tabId);

 

The problem I have is I want to refresh a different sub tab, but I do not know the name of it.   Here is the call I am trying to make.

sforce.console.refreshSubtabByNameAndPrimaryTabId('NAME OF OTHER SUB TAB', tabID, false);

 

I know the tabID is correct because I know my call to getEnclosingPrimaryTabId is working properly.

 

The documentation says to use the Name parameter that was used with the openSubtab call. 

The problem is that I did not open the Sub-tab with a call.  It was opened by the Service Console itself as soon as the object is clicked on within the normal functionality of the Service Console.

 

I am trying to refresh the Account page when I know that a related list of a custom object has been changed.

 

The flow is this....

1) The user opens the Service Cloud Console

2) The user selects and opens an Account.   This creates a new Primary tab and  one Sub-Tab

3) The user clicks on a custom button on the Account that opens a new Visual Force window in a new Sub-Tab.  There are now two sub-tabs.

4) The user takes an action on this new sub-tab that will change the data on the first Account sub-tab.   

      I want to be able to  refresh the Account sub-tab since its data has changed.    It seems like some actions will automatically force a refresh on the Account tab like using hte standard buttons to create a new child object, but I am using a custom Visualforce page.

 

It seems to me that if the Service Console is opening the sub tabs that it is assigning an arbitrary name like scc-st-9.  

The last number seems to increment with each sub tab that is opened.   The primary tab's name seems to have the format scc-pt-0.

 

 I want the name of the sub-tab that is the Account.    I would know the Account id so I could use that if needed.

 

Any ideas?  

 

Thanks!

Terry Luschen

I have the following sequence I would like to do...

 

1) I have created a custom List button for a custom object.

2) This button redirects the user to another Visualforce page with a custom controller.   It takes an action on some of the custom objects depending on a certain status. 

3) After the action is complete I would like to return to the page where the custom list button was clicked by creating an appropriate PageReference.

 

I looked at using the StandardController, StandardSetController and URLFor objects to try to create the correct PageReference object, but I have had not luck.

 

This should be so simple.   Really the questions boils down to 'How do I create a URL to the default View for a custom object?'  

 

Thanks!

I have imported a WSDL and I am trying to call that Web Service using the WebServiceCallout.invoke method.

 

I need to produce XML that looks like this:  ( I cannot figure out how to get a dme: prefix in front of those XML tags )

<env:Body><dme:LoadPatient><dme:Mrn>1234</dme:Mrn></dme:LoadPatient></env:Body>

 

I also need to get xmlns:dme="http://gehcit.ge.com/dme" within the <env: tag.

 

Any ideas?

 

I know that modifying this produces some different results...

 

public class LoadPatient_element {
        public String Mrn;
        private String[] Mrn_type_info = new String[]{'Mrn','http://www.w3.org/2001/XMLSchema','string','1','1','false'};
        //This did not do anything to the resulting XML
        //private String[] Mrn_type_info = new String[]{'Mrn','http://gehcit.ge.com/dme','string','1','1','true'};
        //false, false produces this:<m:LoadPatient xmlns:m="http://gehcit.ge.com/dme"><Mrn>08001074</Mrn></m:LoadPatient>
        //false, true produces this: <m:LoadPatient xmlns:m="http://gehcit.ge.com/dme"><Mrn>08001074</Mrn></m:LoadPatient>
        //true, false produces this: <LoadPatient xmlns="http://gehcit.ge.com/dme"><Mrn>08001074</Mrn></LoadPatient>
        //true, true produces this:  <LoadPatient xmlns="http://gehcit.ge.com/dme"><Mrn>08001074</Mrn></LoadPatient>
        //The second parameter doesn't seem to do anything
        private String[] apex_schema_type_info = new String[]{'http://gehcit.ge.com/dme','false','false'};
        //Putting the dme at the front of this did not help at all
        //private String[] apex_schema_type_info = new String[]{'dme:http://gehcit.ge.com/dme','false','false'};
        private String[] field_order_type_info = new String[]{'Mrn'};
    }

 

Also, modifying the line in red should do something, but I do not see a change.

 

WebServiceCallout.invoke(
              this,
              request_x,
              response_map_x,
              new String[]{endpoint_x,
              'http://sap.com/xi/WebService/soap1.1',
              'http://gehcit.ge.com/dme',
              'LoadPatient',
              'http://gehcit.ge.com/dme',
              'LoadPatientResponse',
              'gehcitGeComDme3.LoadPatientResponse_element'}
            ); 

 

 My question is very similar to this post:

http://boards.developerforce.com/t5/Apex-Code-Development/Namespace-references-incorrect-and-unmanageable-in-the-generated/m-p/62626#M2640

 

Hi!

I am trying to call the Enterprise Web Service in Salesforce on my Dev org.
I have the login working correctly, but when I try to make the next call to retrieve I am getting an error.

I was using this great article as a reference:
http://www.developer.com/net/net/salesforce-integration-with-.net-web-services-soap-api-.html?comment=53310-5710

I am trying to do this on a Windows Phone Application through Microsoft Visual Studio 2010 Express for Windows Phone.
This means when I do the 'Add Service References' option and I specify my wsdl that I do not get a wrapper class for setting my metadata URL and the Session ID.
I think my problem is that I do not have my Session ID set in the header section of the Soap Request.
I think I have the metadata URL set properly in the new EndPointAddress that I created.
In Windows Phone I have to make all calls asynchronously, which then makes me specify a callback method.

 

Here is my endpoint in the Services.ClientConfig file for the initial login call:
<endpoint address="https://login.salesforce.com/services/Soap/c/21.0"
   binding="basicHttpBinding" bindingConfiguration="SoapBinding1"
   contract="SForceServiceE.Soap" name="SoapE" />

 

Here is the exception...

Message "No operation available for request {urn:enterprise.soap.sforce.com}retrieve" string
Stack Trace:
  StackTrace "   at System.ServiceModel.DiagnosticUtility.ExceptionUtility.BuildMessage(Exception x)\r\n   at System.ServiceModel.DiagnosticUtility.ExceptionUtility.LogException(Exception x)\r\n   at System.ServiceModel.DiagnosticUtility.ExceptionUtility.ThrowHelperWarning(Exception e)\r\n   at System.ServiceModel.Channels.ServiceChannel.HandleReply(ProxyOperationRuntime operation, ProxyRpc& rpc)\r\n   at System.ServiceModel.Channels.ServiceChannel.EndCall(String action, Object[] outs, IAsyncResult result)\r\n   at System.ServiceModel.ClientBase`1.ChannelBase`1.EndInvoke(String methodName, Object[] args, IAsyncResult result)\r\n   at YouTubeSearch.SForceServiceE.SoapClient.SoapClientChannel.Endretrieve(IAsyncResult result)\r\n   at YouTubeSearch.SForceServiceE.SoapClient.YouTubeSearch.SForceServiceE.Soap.Endretrieve(IAsyncResult result)\r\n   at YouTubeSearch.SForceServiceE.SoapClient.Endretrieve(IAsyncResult result)\r\n   at YouTubeSearch.SForceServiceE.SoapClient.OnEndretrieve(IAsyncResult result)\r\n   at System.ServiceModel.ClientBase`1.OnAsyncCallCompleted(IAsyncResult result)\r\n   at System.ServiceModel.AsyncResult.Complete(Boolean completedSynchronously)\r\n   at System.ServiceModel.AsyncResult.Complete(Boolean completedSynchronously, Exception exception)\r\n   at System.ServiceModel.Channels.ServiceChannel.SendAsyncResult.CallComplete(Boolean completedSynchronously, Exception exception)\r\n   at System.ServiceModel.Channels.ServiceChannel.SendAsyncResult.FinishSend(IAsyncResult result, Boolean completedSynchronously)\r\n   at System.ServiceModel.Channels.ServiceChannel.SendAsyncResult.SendCallback(IAsyncResult result)\r\n   at System.ServiceModel.AsyncResult.Complete(Boolean completedSynchronously)\r\n   at System.ServiceModel.AsyncResult.Complete(Boolean completedSynchronously, Exception exception)\r\n   at System.ServiceModel.Channels.HttpChannelFactory.HttpRequestChannel.HttpChannelAsyncRequest.OnGetResponse(IAsyncResult result)\r\n   at System.Net.Browser.ClientHttpWebRequest.<>c__DisplayClassa.<InvokeGetResponseCallback>b__8(Object state2)\r\n   at System.Threading.ThreadPool.WorkItem.doWork(Object o)\r\n   at System.Threading.Timer.ring()\r\n" string

 

Here is the Soap Request...

Request {<?xml version="1.0" encoding="utf-16"?>
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
  <s:Header />
  <s:Body xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
    <retrieve xmlns="urn:enterprise.soap.sforce.com">
      <fieldList>Name</fieldList>
      <sObjectType>Game__c</sObjectType>
      <ids>
        <string>a00E0000000iaEcIAI</string>
      </ids>
    </retrieve>
  </s:Body>
</s:Envelope>} System.ServiceModel.Channels.Message {System.ServiceModel.Dispatcher.OperationFormatter.OperationFormatterMessage}


Here is the Soap Reply...

Reply {<?xml version="1.0" encoding="utf-16"?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
  <s:Header xmlns:s="http://schemas.xmlsoap.org/soap/envelope/" />
  <soapenv:Body>
    <soapenv:Fault>
      <faultcode>soapenv:Client</faultcode>
      <faultstring>No operation available for request {urn:enterprise.soap.sforce.com}retrieve</faultstring>
    </soapenv:Fault>
  </soapenv:Body>
</soapenv:Envelope>} System.ServiceModel.Channels.Message {System.ServiceModel.Channels.BufferedMessage}

 

Here is the code I am using...

private void BuildClassFromSalesForce2()
        {
            SForceServiceE.SoapClient myClientR = new SForceServiceE.SoapClient("SoapE");
            myClientR.loginAsync("MyEmail", "MyPasswordMySecurityToken");

            myClientR.loginCompleted += new EventHandler<SForceServiceE.loginCompletedEventArgs>(soapLoginCompleted2);

        }

        private void soapLoginCompleted2(object src, SForceServiceE.loginCompletedEventArgs myArg)
        {

            var elements = new List<System.ServiceModel.Channels.BindingElement>();
            elements.Add(new System.ServiceModel.Channels.TextMessageEncodingBindingElement(
                System.ServiceModel.Channels.MessageVersion.Soap11, System.Text.Encoding.UTF8));
            elements.Add(new System.ServiceModel.Channels.HttpsTransportBindingElement());
            System.ServiceModel.Channels.CustomBinding myBinding = new System.ServiceModel.Channels.CustomBinding(elements);

            System.ServiceModel.EndpointAddress myEndPoint = new System.ServiceModel.EndpointAddress(myArg.Result.metadataServerUrl);
            //Where do I set myArg.Result.sessionId?
            //doesn't this need to get into a session header in the Request SOAP message like this?   How do I do this?
            //<soapenv:Header>
            //    <urn:SessionHeader>
            //        <urn:sessionId>xxxxxx</urn:sessionId>
            //    </urn:SessionHeader>
            //</soapenv:Header>
           
            SForceServiceE.SoapClient myRetrieveClient = new SForceServiceE.SoapClient(myBinding, myEndPoint);
           
            myRetrieveClient.retrieveCompleted += new EventHandler<SForceServiceE.retrieveCompletedEventArgs>(soapRetrieveCompleted2);
            string[] ids = new string[1];
            ids[0] = "a00E0000000iaEcIAI";
            myRetrieveClient.retrieveAsync("Name", "Game__c", ids, myArg.UserState);
        }


        private void soapRetrieveCompleted2(object src, SForceServiceE.retrieveCompletedEventArgs myArg)
        {
            //It never gets to here.  It errors out in SForceServiceE.retrieveResponse
            MessageBox.Show("Retrieve Completed!  Count: " + myArg.Result.Length);
        }

 

 Here is where it is erroring out:
 public YouTubeSearch.SForceServiceE.retrieveResponse Endretrieve(System.IAsyncResult result) {
                object[] _args = new object[0];
  //Error here!
                YouTubeSearch.SForceServiceE.retrieveResponse _result = ((YouTubeSearch.SForceServiceE.retrieveResponse)(base.EndInvoke("retrieve", _args, result)));
                return _result;
            }


What am I doing wrong? 

One of the articles said this error is causing by referencing the Enterprise wsdl, but calling the partner API.  Am I doing this?

Thanks!

We are on a Winter 2014 sandbox and every time we do a Debug Log we are getting a STATEMENT_EXECUTE line for every line that is executed.  I have seen that this is a line that shows up when 'FINER' is set on the 'Apex Code' setting.   We have basically set all of the debug settings to 'ERROR' so we can try to stop these lines from being written out, but this line is still showing up.  This is making it very difficult to debug a large class that we are working on.

We also tried logging in as different users and the same problem occurred for the debug logs of each user.

Is this a new problem in Winter 2014?

Help?
Terry Luschen

Since yesterday we receive the following error on all VF pages that have a flow imbedded.

 

unexpected token: ':'

 

An unexpected error has occurred. Your solution provider has been notified. (Flow__Interview)     

 

  • September 10, 2013
  • Like
  • 0

Does anybody have any resources on integrating with SAP ByDesign?  We will want to send Accounts, Product Information and Orders to Salesforce.  We want to send Orders to SAP ByDesign.  We need real-time integration as each transaction occurs so any type of batch processing will not work.

 

I see that this is the link to the SAP ByDesign SDK:  http://help.sap.com/saphelp_byd_studio/fp40/KTP/Products/A1S_PDI/PDI_Library/GettingStarted_SubStructure/GettingStarted.html 

 

It seems like you can create web services in Microsoft Visual Studio and then deploy them to SAP ByDesign so they can be used.  Are there 'out of the box' web services available with SAP ByDesign to integrate with standard objects in SAP byDesign without having to create new custom web services?

 

Is SAP PI supposed to be utilized in any manner with SAP ByDesign?   From what I have read I think the answer is no.

 

I am very comfortable with all of the integration details on the Salesforce side.   I am just trying to figure out how to connect to the SAP ByDesign data.

 

 

I have a flow where I have multiple drop downs which need to be populated with dynamic data. I have created a cusom object with all these data values stored into custom pick lists. However, when I try to assign the custom picklist value, the flow doesn't pull the data. 

 

Is it possible to use picklist values from a SFDC object to populate a dropdown on a flow and use the same for all drop downs on a flow? Or do I need to create seperate custom objects for each of the dynamic drop downs in a flow?

 

Thanks

 

I started with this cookbook, which was great.  

http://developer.force.com/cookbook/recipe/calling-salesforce-web-services-using-apex

 

I just want to call a custom WebService instead of a Describe call.

webservice static string processInboundMessage(string msgType, string xmlString)

 

Here is my code...

partnerSoapSforceCom.Soap sp = new partnerSoapSforceCom.Soap();
String username = 'myUserName';
String password = 'myPasswordMySecurityToken';
partnerSoapSforceCom.LoginResult loginResult = sp.login(username, password);
system.debug('Session ID: ' + loginResult);

string sessionHeaderSection = '';
sessionHeaderSection = '<soapenv:Header><hel:SessionHeader><hel:sessionId xsi:type="xsd:string">' + loginResult.SessionID + '</hel:sessionId></hel:SessionHeader></soapenv:Header>';

Http h = new http();
HttpRequest req = new HttpRequest();
 req.setEndpoint('https://cs8-api.salesforce.com/services/Soap/class/WbsrRegInterface');
//req.setEndpoint('https://cs8-api.salesforce.com/services/Soap/class/WbsrRegInterface?wsdl');
req.setMethod('POST');
req.setHeader('Content-Type', 'text/xml;charset=utf-8');

req.setHeader('SOAPAction', 'http://soap.sforce.com/schemas/class/WbsrRegInterface');

string msgType = 'REG';

string xmlStringToSend = 'MYXML';

 

string b ='<?xml version="1.0" encoding="utf-8"?><soapenv:Envelope xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/1999/XMLSchema" soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:hel="http://soap.sforce.com/schemas/class/WbsrRegInterface">'+sessionHeaderSection+'<soapenv:Body><hel:processInboundMessage><hel:msgType>'+msgType+'</hel:msgType><hel:xmlString>'+xmlStringToSend+'</hel:xmlString></hel:processInboundMessage></​soapenv:Body></soapenv:Envelope>';

 

req.setHeader('Content-Length',String.valueOf(b.length()));
req.setbody(b);
HttpResponse res = h.send(req);
system.debug('RESPONSE: ' + res.getBody() );

 

My login works and I know I am hitting my destination org because I can see it in the login history.  

 

My error is: 

<faultstring>The element type &quot;soapenv:Body&quot; must be terminated by the matching end-tag &quot;&lt;/soapenv:Body&gt;&quot;.</faultstring>

 

The XML I am sending looks like this:

<?xml version="1.0" encoding="utf-8"?>
<soapenv:Envelope
xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance"
xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsd="http://www.w3.org/1999/XMLSchema"
soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:hel="http://soap.sforce.com/schemas/class/WbsrRegInterface">
<soapenv:Header>
<hel:SessionHeader>
<hel:sessionId xsi:type="xsd:string">
00DL00000004YnR!ARIAQGHH9372teOXPI4.ZyepVnvUCXvndwhToI370HHrskPbloo80NCHNXjFHmrFSs4FAUSPNVVGRqLOQy.6IN_lBR8RZuAg
</hel:sessionId>
</hel:SessionHeader>
</soapenv:Header>
<soapenv:Body>
<hel:processInboundMessage>
<hel:msgType>REG</hel:msgType>
<hel:xmlString>fred</hel:xmlString>
</hel:processInboundMessage>
</​soapenv:Body>
</soapenv:Envelope>

 

Any ideas?

 

 

Anyone have any idea what the actual limit is (and will be) for "Force.com - One App" and "Chatter Only" licenses?  As far as I can tell it is NEITHER read access NOR read/write access to 10 custom objects per "Profile".  I can select as many as I want.  So I'm unsure if it is broken, I don't understand it, or somehow it is enforced thru use or something?  It is really hard to justify recommending buying platform licenses to use 11 objects when it is neither clear nor apparently enforced what the actual limit is.

 

According to the documentation(SF Help):

"Force.com - Free" in Administration Setup/Company Profile/Company Information"; Force.com - One App in Help file - "They are limited to the use of one custom app, which is defined as up to 10 custom objects, and they are limited to read-only access to the Accounts and Contacts objects

 

"Chatter Only" in both places - "Modify up to ten custom objects" and "View Salesforce accounts and contacts"

 

I am trying to refresh a sub page within the Service Cloud Console.

 

I have learned how to make Javascript calls properly to these functions to get my current tab's ID and the primary tab's ID.   My call-back functions work fine.  

 

sforce.console.getEnclosingTabId(refreshtab2);

sforce.console.getEnclosingPrimaryTabId(refreshtab);

 

I can also get calls to close a tab and refresh a primary tab to work fine.

sforce.console.refreshPrimaryTabById(tabId, true);

sforce.console.closeTab(tabId);

 

The problem I have is I want to refresh a different sub tab, but I do not know the name of it.   Here is the call I am trying to make.

sforce.console.refreshSubtabByNameAndPrimaryTabId('NAME OF OTHER SUB TAB', tabID, false);

 

I know the tabID is correct because I know my call to getEnclosingPrimaryTabId is working properly.

 

The documentation says to use the Name parameter that was used with the openSubtab call. 

The problem is that I did not open the Sub-tab with a call.  It was opened by the Service Console itself as soon as the object is clicked on within the normal functionality of the Service Console.

 

I am trying to refresh the Account page when I know that a related list of a custom object has been changed.

 

The flow is this....

1) The user opens the Service Cloud Console

2) The user selects and opens an Account.   This creates a new Primary tab and  one Sub-Tab

3) The user clicks on a custom button on the Account that opens a new Visual Force window in a new Sub-Tab.  There are now two sub-tabs.

4) The user takes an action on this new sub-tab that will change the data on the first Account sub-tab.   

      I want to be able to  refresh the Account sub-tab since its data has changed.    It seems like some actions will automatically force a refresh on the Account tab like using hte standard buttons to create a new child object, but I am using a custom Visualforce page.

 

It seems to me that if the Service Console is opening the sub tabs that it is assigning an arbitrary name like scc-st-9.  

The last number seems to increment with each sub tab that is opened.   The primary tab's name seems to have the format scc-pt-0.

 

 I want the name of the sub-tab that is the Account.    I would know the Account id so I could use that if needed.

 

Any ideas?  

 

Thanks!

Terry Luschen

Everyone,

 

I'm running into a very annoying issue with the latest version of the eclipse Force.com IDE plugin.

 

When I'm writing test classes, I'm right-clicking on the test class and selecting "force.com -> run tests." However, in the "code coverage results" window it no longer displays any code coverage information for my class.

 

When I run the same test in the browser, i can see my 16% code coverage, but my custom class isn't showing up in the eclipse test runner results.

 

Is anyone else seeing this issue, does anyone know how to fix it?

Does anyone know if Library Permissions (Viewer, Author, Administrator, etc) can be Updated/Maintained via the API (APEX or WebService)?  I've scoured all the documentation but only see the GUI access.  Thx in Advance....

Hi all,

 

I want to ask is it possible to view, create, edit Account or Contact records in Customer Portal? I only can create, edit, view Cases in Customer portal user.. I want to have access to Account or COntact using customer portal user. Any suggestions would be great..

Thanks...

 

 

Regards

Hi,

 

I'd like to use HTTP classes to load an image from the web then save it as an Attachment and finally send it attached to an email. At first glance everything seems to work fine. But the picture I receive is obviously a corrupt file. Any ideas what's wrong with my code:

 

 

public class EmailTestCtr {
	
	public Integer totalFileSize {get; set;}
	public Email__c mail {get; set;}
	public String contentType {get; set;}
	public String response {get; set;}
	
	public EmailTestCtr(){
		totalFileSize = 0;
	}
	
	public void loadFile(){
		String url = '';
		
		Http h = new Http();
		HTTPRequest req = new HttpRequest();
        
        req.setEndpoint('http://www.clienthouse.com/images/f106e78f34/CH_location_web1.jpg');
        req.setMethod('GET');
        req.setCompressed(false);
		
		HTTPResponse resp = h.send(req);
		this.contentType = resp.getHeader('Content-Type');
		this.response = resp.getHeader('Content-Length');
		
		System.debug(resp.getBody());
		String body = resp.getBody();
		
		Attachment a = new Attachment();
		try {		
			if(this.mail == null){
				mail = new Email__c(
					Name = 'test'
				);
				insert mail;
			}
			
			a.Body = Blob.valueOf(body);
			a.Name = 'Name';
			a.ParentId = mail.Id;
			a.ContentType = this.contentType;
			insert a;
		} catch(DMLException e){
			ApexPages.addMessages(e);
		}
		
		this.totalFileSize += [select BodyLength from Attachment where Id = :a.Id].BodyLength;
		
	}
	
	public void sendEmail(){
		
		Messaging.SingleEmailMessage email = new Messaging.SingleEmailMessage();
		String[] toAddresses = new String[] {'h.hess@clienthouse.com'};
		email.setToAddresses(toAddresses);
		email.setSubject(this.mail.Name);
		email.setPlainTextBody('Text goes here.');
		List<Messaging.EmailFileAttachment> files = new List<Messaging.EmailFileAttachment>();
		for(Attachment file : [select Name, Body, ContentType from Attachment where ParentId = :this.mail.Id]){
			System.debug('------------>FILE' + file);
			Messaging.EmailFileAttachment efa = new Messaging.EmailFileAttachment();
			efa.setBody(file.Body);
			efa.setContentType(file.ContentType);
			efa.setFileName(file.Name + '.jpg');
			files.add(efa);
		}
		email.setFileAttachments(files);
		
		Messaging.sendEmail(new Messaging.SingleEmailMessage[] { email });
		
	}
	
}

 

 

Thanks and best regards,

Henry

Select Id from objectname__c where source__c = SF and lastmodifieddate <  2010-02-03T00:15:00.000Z

 

This query is working fine in eclipse, but I want the same query passing datetime to query in apex class dynamically.

 

 

Please let me know how to frame my query in apex class.

 

Thanks in Advance..

 

PK

 

Hello all,

 

 

Can anyone please help me out regarding the following:

 

I want to sign on to a website and from there login to partner portal in Salesforce.com to manage contact. Is there anyway to do this?

 

Thanks in advance. 

  • November 13, 2009
  • Like
  • 0

Can anyone tell me if  it is possible to get binary data back from a web service callout?

 

I am using the apex Http, HttpRequest and HttpResponse classes to call an external  service that returns a binary file. I then attach that file to an email programatically. Everything works fine, except that my binary data in the attachment is mangled, because of the string conversion on response.getBody(). Is there a way to retrieve the binary stream from the HttpResponse class without corrupting it? 

 

Or is there another set of classes I should use to perform this function to get the results I'm looking for? 

 

Thanks for any help!

Gretchen

 

 

  • November 04, 2009
  • Like
  • 0

I don't understand why I get this error when the limit for callouts is normally 10 per transaction.

 

I am calling the following code with 1 record as a test.  The createObject() method will make 2 callouts.

 

global class S3Batchable implements Database.Batchable<CF_Purchase_Order__c>, Database.AllowsCallouts { List<CF_Purchase_Order__c> orders; global S3Batchable(List<CF_Purchase_Order__c> o){ orders = o.clone(); } global Iterable<CF_Purchase_Order__c> start(Database.batchableContext BC){ return orders; } global void execute(Database.BatchableContext BC, CF_Purchase_Order__c[] scope){ List<CF_Purchase_Order__c> ordersToUpdate = new List<CF_Purchase_Order__c>(); VF_SiteUploadController controller; boolean result; for(CF_Purchase_Order__c order : scope){ controller = new VF_SiteUploadController(order.id); controller.body = Blob.valueof(order.Script__c); controller.fileName = order.Partner__r.Final_Cut_Filename__c+'_'+order.SPON__c+'_Script.txt'; controller.fileSize = controller.body.size(); controller.bucketName='FCSinbound'; result = controller.createObject(); if(result){ order.CFNotes__c = controller.fileDownloadURL; ordersToUpdate.add(order); } } update ordersToUpdate; } global void finish(Database.BatchableContext BC){ Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage(); mail.setToAddresses(new String[] {'gnewman@spotzer.com'}); mail.setReplyTo('batch@acme.com'); mail.setSenderDisplayName('Batch Processing'); mail.setSubject('Batch Process Completed'); mail.setPlainTextBody('Batch Process has completed'); Messaging.sendEmail(new Messaging.SingleEmailMessage[] { mail }); } public static testMethod void testBatch() { List<CF_Purchase_Order__c> myTestOrders = [select id from CF_Purchase_Order__c limit 5]; S3Batchable scriptBatch = new S3Batchable(myTestOrders); ID batchprocessid = Database.executeBatch(scriptBatch); } }

 

Hi All,

 

I want to store a JPEG file in an Attachment object. The source of this JPEG file is an HttpRequest Object. Here's my code:

 

 

Http http = new Http();

HttpRequest httpRequest = new HttpRequest();

httpRequest.setEndPoint('http://profile.ak.fbcdn.net/v225/1757/61/q785659914_8737.jpg'); //jpeg file to retrieve!

httpRequest.setMethod('GET');

httpRequest.setHeader('Content-Type', 'image/jpeg');

string responseBody = http.send(httpRequest).getBody();

//system.debug(responseBody);

 

Attachment a = new Attachment();

Blob b = Blob.valueOf(responseBody);

a.body = b;

a.ParentId = '0038000000l4H5hAAE'; //a ContactId

a.contentType = 'image/jpeg';

a.name = 'Hildegunn';

insert a;

 

First of all, I create an HTTPRequest object pointinf to the URL of the JPEG file I want to grab, set method (GET) and content type. Then I submit the request and store body's response (THE JPEG FILE!). If I debug the responseBody variable, I get the ASCII content of the image file. So, the file is correctly retrieved.

 

The next part of the code, I create an Attachment object, link with corresponding ParentId, create Blob from responseBody and set Attachment's body.

 

Everything looks ok, I go to Contact's attachments and see the brand new attachment, BUT when i click VIEW attachment link, i get the following response:

 

 

https://files.na6.content.force.com/servlet/servlet.FileDownload?oid=00D80000000cEyD&otk=DrIT7n0CrBzY0Aw.rwJj61MiYURrs732h1pr1rj4l3FbqKulnu0pr5xq1.yoY_04&retURL=%2F0038000000l4H5hAAE&rtype=D 

 

 

Looking the response in more detail, I have the following HTML:

 

 

<html>

<body>

<img src="https://files.na6.content.force.com/servlet/servlet.FileDownload?oid=00D80000000cEyD&amp;otk=DrIT7n0CrBzY0Aw.rwJj61MiYURrs732h1pr1rj4l3FbqKulnu0pr5xq1.yoY_04&amp;retURL=%2F0038000000l4H5hAAE&amp;rtype=D"

alt="https://files.na6.content.force.com/servlet/servlet.FileDownload?oid=00D80000000cEyD&amp;otk=DrIT7n0CrBzY0Aw.rwJj61MiYURrs732h1pr1rj4l3FbqKulnu0pr5xq1.yoY_04&amp;retURL=%2F0038000000l4H5hAAE&amp;rtype=D"/> </body>

</html>

 

As you can see, the img tag is not able to retrieve the file, so is displaying the ALT attribute.

 

Any ideas?

 

Regards,

Aldo 


 

Message Edited by Aldof on 10-06-2009 10:20 AM
  • October 06, 2009
  • Like
  • 0
When I attempt to save a VF page from the Force.com IDE, I get the above message... Any ideas?

I can't seem to find it in any documentation on this, either for VisualForce or the Force.com IDE. It only seems to happen for certain pages, and I can't figure out what may be causing it.

Thanks-

-Jesse
  • December 01, 2008
  • Like
  • 0