• benwalk
  • NEWBIE
  • 0 Points
  • Member since 2015

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 3
    Questions
  • 5
    Replies
It's the same question as https://developer.salesforce.com/forums/?id=906F0000000MMbqIAG, but with a twist: I need to do this via REST.

For example, the REST API documentation uses the following example:
curl https://yourInstance.salesforce.com/services/data/v20.0/query/?q=SELECT+name+from+Account -H "Authorization: Bearer token"
but my SOQL uses email address to lookup a Contact.  And this email happens to contain an apostrophe.  

What should the query parameter look like for the following SOQL?
SELECT+Id,+Email,+Name,+Phone+FROM+Contact+WHERE+Email=john.o'connor@skynet.com+AND+AccountId='001W010000HnaZhiAJ'

Using this format returns:
'No viable alternative at character \"'

Using "john.o\'connor@skynet.com" returns:
'Bind variables only allowed in Apex code'

So does URI encoding the backslash to %5C (john.o%5C'connor@skynet.com).

I am stuck.  Can anyone help?
 
  • September 16, 2016
  • Like
  • 0
I've been hitting an issue intermittently and I'm looking for help in troubleshooting it.  If the best thing would be to file a case, let me know and I'll go do that, but I want to make sure I've done my diligence.

It started less than a week ago, when my Java app started throwing exceptions and hanging.  I am seeing messages like (sensitive / custom info redacted):
2016-02-01 16:09:55,742 [http-nio-0.0.0.0-9200-exec-22] [<userid>:<username>:REGULAR] ERROR Error executing query against Salesforce: SELECT Owner.Type, Owner.Id, Owner.Name FROM Case WHERE Id='5005000232hgDGNas12'
        at com.myorg.custom.stuff
...
 
Caused by: java.net.SocketException: Connection reset
        at org.apache.axis.AxisFault.makeFault(AxisFault.java:101)
        at org.apache.axis.transport.http.HTTPSender.invoke(HTTPSender.java:154)
        at org.apache.axis.strategies.InvocationStrategy.visit(InvocationStrategy.java:32)
        at org.apache.axis.SimpleChain.doVisiting(SimpleChain.java:118)
        at org.apache.axis.SimpleChain.invoke(SimpleChain.java:83)
        at org.apache.axis.client.AxisClient.invoke(AxisClient.java:165)
        at org.apache.axis.client.Call.invokeEngine(Call.java:2784)
        at org.apache.axis.client.Call.invoke(Call.java:2767)
        at org.apache.axis.client.Call.invoke(Call.java:2443)
        at org.apache.axis.client.Call.invoke(Call.java:2366)
        at org.apache.axis.client.Call.invoke(Call.java:1812)
        at com.sforce.soap.enterprise.SoapBindingStub.query(SoapBindingStub.java:6626)
        ... 302 more
Caused by: java.net.SocketException: Connection reset
        at java.net.SocketInputStream.read(SocketInputStream.java:189)
        at java.net.SocketInputStream.read(SocketInputStream.java:121)
        at sun.security.ssl.InputRecord.readFully(InputRecord.java:465)
        at sun.security.ssl.InputRecord.read(InputRecord.java:503)
        at sun.security.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:961)
        at sun.security.ssl.SSLSocketImpl.readDataRecord(SSLSocketImpl.java:918)
        at sun.security.ssl.AppInputStream.read(AppInputStream.java:105)
        at java.io.BufferedInputStream.fill(BufferedInputStream.java:246)
        at java.io.BufferedInputStream.read(BufferedInputStream.java:265)
        at org.apache.axis.transport.http.HTTPSender.readHeadersFromSocket(HTTPSender.java:583)
        at org.apache.axis.transport.http.HTTPSender.invoke(HTTPSender.java:143)
        ... 313 more


I managed to catch the app locked up, and took a thread dump.  I saw long running threads like:
"http-nio-0.0.0.0-9200-exec-3124" #930760 daemon prio=5 os_prio=0 tid=0x00007fbe2406e000 nid=0x2be8 runnable [0x00007fbdb874e000]
   java.lang.Thread.State: RUNNABLE
        at java.net.SocketInputStream.socketRead0(Native Method)
        at java.net.SocketInputStream.read(SocketInputStream.java:150)
        at java.net.SocketInputStream.read(SocketInputStream.java:121)
        at sun.security.ssl.InputRecord.readFully(InputRecord.java:465)
        at sun.security.ssl.InputRecord.read(InputRecord.java:503)
        at sun.security.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:961)
        - locked <0x00000006b52dd3d8> (a java.lang.Object)
        at sun.security.ssl.SSLSocketImpl.performInitialHandshake(SSLSocketImpl.java:1363)
        - locked <0x00000006b52dd4c8> (a java.lang.Object)
        at sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1391)
        at sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1375)
        at org.apache.axis.components.net.JSSESocketFactory.create(JSSESocketFactory.java:186)
        at org.apache.axis.transport.http.HTTPSender.getSocket(HTTPSender.java:191)
        at org.apache.axis.transport.http.HTTPSender.writeToSocket(HTTPSender.java:404)
        at org.apache.axis.transport.http.HTTPSender.invoke(HTTPSender.java:138)
        at org.apache.axis.strategies.InvocationStrategy.visit(InvocationStrategy.java:32)
        at org.apache.axis.SimpleChain.doVisiting(SimpleChain.java:118)
        at org.apache.axis.SimpleChain.invoke(SimpleChain.java:83)
        at org.apache.axis.client.AxisClient.invoke(AxisClient.java:165)
        at org.apache.axis.client.Call.invokeEngine(Call.java:2784)
        at org.apache.axis.client.Call.invoke(Call.java:2767)
        at org.apache.axis.client.Call.invoke(Call.java:2443)
        at org.apache.axis.client.Call.invoke(Call.java:2366)
        at org.apache.axis.client.Call.invoke(Call.java:1812)
        at com.sforce.soap.enterprise.SoapBindingStub.query(SoapBindingStub.java:6626)
...

I am using the Enterprise SOAP API, and nothing in my app code changed since when this started happening.  In fact, while some queries fail, most are succeeding.  Some questions I have:
  1. Is there a way to get from Salesforce application logging tracking the incoming API connections / requests?
  2. Under what circumstances might Salesforce reset connections?
  3. Can I configure connection pool size limits and / or timeouts from Salesforce?
  4. Is there any way to track SOQL query performance?
  5. Similarly, does my Salesforce instance have any performance monitoring?

Thanks!  Any help is appreciated.
I have an in-house application that support agents interact with to work on cases, modify accounts, contracts, etc.  This application uses the SOAP API and an integration user to push updates to Salesforce.  The problem I'm having is that the updates are made by the integration user instead of the support agent users (who have accounts in Salesforce) because the calls are all made through the API.  It would help with reporting and other business logic calculations if the create or update was done by the originating user, not the integration user.

Is there a way to create and update SFDC objects as another user via API?
  • September 09, 2015
  • Like
  • 0
It's the same question as https://developer.salesforce.com/forums/?id=906F0000000MMbqIAG, but with a twist: I need to do this via REST.

For example, the REST API documentation uses the following example:
curl https://yourInstance.salesforce.com/services/data/v20.0/query/?q=SELECT+name+from+Account -H "Authorization: Bearer token"
but my SOQL uses email address to lookup a Contact.  And this email happens to contain an apostrophe.  

What should the query parameter look like for the following SOQL?
SELECT+Id,+Email,+Name,+Phone+FROM+Contact+WHERE+Email=john.o'connor@skynet.com+AND+AccountId='001W010000HnaZhiAJ'

Using this format returns:
'No viable alternative at character \"'

Using "john.o\'connor@skynet.com" returns:
'Bind variables only allowed in Apex code'

So does URI encoding the backslash to %5C (john.o%5C'connor@skynet.com).

I am stuck.  Can anyone help?
 
  • September 16, 2016
  • Like
  • 0
I have an in-house application that support agents interact with to work on cases, modify accounts, contracts, etc.  This application uses the SOAP API and an integration user to push updates to Salesforce.  The problem I'm having is that the updates are made by the integration user instead of the support agent users (who have accounts in Salesforce) because the calls are all made through the API.  It would help with reporting and other business logic calculations if the create or update was done by the originating user, not the integration user.

Is there a way to create and update SFDC objects as another user via API?
  • September 09, 2015
  • Like
  • 0
Hi,  I could really use some help.  I'm trying to create a custom formula field that is based on our customer support 'business hours', as they are defined within our SFDC setup.  Does anyone know how to do this, or even a workaround to look at only certain hours of the day for Mon-Fri?
 
Thanks for any help!!
 
-Jeff
  • October 02, 2006
  • Like
  • 0