• Superfell
  • ALL STAR
  • 34114 Points
  • Member since 2004


  • Chatter
    Feed
  • 675
    Best Answers
  • 22
    Likes Received
  • 0
    Likes Given
  • 36
    Questions
  • 8048
    Replies
If I already have a JSON HTTP Post object can I simply send requests to the salesforce.com website for updating my company data automatically? Every manual I read requires the SDK be installed. I have not had to do this with previous vendors, I just use the provided URIs and send the requests through my platform. Is installing the SDK a requirement?
When the API documentation (especially Bulk and Rest) refer to sObjects, could some one please cofirm that they mean ALL the stardard objects:

http://www.salesforce.com/us/developer/docs/officetoolkit/Content/sforce_api_objects_list.htm

and not JUST the "Sales Objects" here:

http://www.salesforce.com/us/developer/docs/api/Content/sforce_api_erd_majors.htm

IN other words, you can use the ROW API call for ALL objects including something like Attachments?

Thank you!
Ryan

Side note: I feel our industry needs to settle down about abreviations.   Ambiguity no es bueno!
I'm having issue creating a task via REST API and need some help as to point out what I may be doing wrong. My code is the following:

public class SalesForceEvent
{
    public SalesForceAccount Account { get; set; }
    public string Id { get; set; }
    public string AccountId { get; set; }
    public string OwnerId { get; set; }
    public string Subject { get; set; }
    public string Type { get; set; }
    public string Description { get; set; }
    public string Status { get; set; }
    public string ActivityDate { get; set; }
    public bool IsClosed { get; set; }
    public bool IsDeleted { get; set; }
    public string Priority { get; set; }
    public string WhoId { get; set; }
    public string WhatId { get; set; }

}

var uri = serviceUrl + "/services/data/v20.0/sobjects/Account/task/";

var task = new SalesForceEvent();
task.OwnerId = "XXXXXXXXX";
task.Account = acct;
task.ActivityDate = DateTime.Now.ToString();
task.Subject = "Call";
task.Type = "Call";
task.Status = "Completed";
task.Description = " A Call for this new task";
task.IsClosed = true;
task.Priority = "Normal";
task.WhoId = "";
task.WhatId = "XXXXXXXXX";


var ser = new JavaScriptSerializer();
var body = ser.Serialize(task);

var req = (System.Net.HttpWebRequest)System.Net.WebRequest.Create(uri);
req.Headers.Add("Authorization: OAuth " + SFHelper.SalesForceToken.access_token);
req.ContentType = "application/json";
req.Method = "POST";

byte[] data = System.Text.Encoding.ASCII.GetBytes(body);
req.ContentLength = body.Length;
var os = req.GetRequestStream();
os.Write(data, 0, data.Length);
os.Close();

WebResponse resp;

try
{
    resp = req.GetResponse();
}
catch (WebException ex)
{
    resp = ex.Response;
}

if (resp != null)
{
    HtmlGenericControl hgc = new HtmlGenericControl();
    StringBuilder sb = new StringBuilder();

    System.IO.StreamReader sr = new System.IO.StreamReader(resp.GetResponseStream());
    sb.Append(sr.ReadToEnd().Trim());

    hgc.InnerHtml = sb.ToString();
    plcResults.Controls.Add(hgc);

}

When making the call I get the following error message:

[{"errorCode":"NOT_FOUND","message":"Provided external ID field does not exist or is not accessible: task"}]

Any assistance is greatly appreciated.

Hi,

I want to perform CRUD operation mainly create/update on standard object via web services (rest webservice). So, Do i need to write rest webservice code in apex to create Lead or Account or any standard object ????

OR Default web services are already availalbe in salesforce ??? If YES then please let me know.

 

I went to the Android Play Store on my Android phone and found the Salesforce1 App.  It shows a date of 3/17/2014 and includes comments --

What’s new in 5.1.1:
• Bug fixes and improvements
What’s new in 5.2:
• Custom Branding
• Bug fixes and improvements

But when I downloaded it , I get the Chatter icon, not the SF1 icon.  And when I run it and check the version it says it is "About Chatter Version 3.4.2 Build number 8".

Am I not getting the latest version?  Anyone know why?

For one thing, I'm only getting "Feed" and RECENT, not the other tabs I have configured including some custom pages under APPS.  All these work fine on iPad when pointing to the same org.
How come I can't dynamically cast a QueryResult to an sObject and view the values without have to cast the result to a difinitive sObject? I've been able to view returned values from a query within Microsoft Access, loop through the queryresult and then insert record values into the appropriate tables without having to specifiy whether it is an Account or Contact, or Lead, etc.

Instead of having to do something like:
sObject s = new Account();
Account a = Account(s).

Why can't I just loop through the sObject records and retrieve the values?

I'm working on an integration piece and the sObject type has to be dynamic. I cannot cast it to a specific sobject every single time I need to retrieve records.

try
                    {
                        QueryResult qResult = sfProd.query(strSelectStatement);
                        sObject[] s = qResult.records;
                       
                        Boolean done = false;

                        if (qResult.size > 0)
                        {
                            while (!done)
                            {
                                // foreach statement cannot operate on variables of type QueryResult because QueryResult does not contain a public definition for GetEnumerator
                                //foreach (QueryResult q in qResult)
                                //{
                                //}
                               
                                for (Int32 j = 0; j < qResult.records.Length; j++)
                                {
                                    MessageBox.Show(s[j].GetType().ToString());
                                    MessageBox.Show(s[j].GetType().Name);
                                    //MessageBox.Show(s[j].GetType().GetFields("Name").ToString());
                                    MessageBox.Show(s[j].Id.ToString());
                                }

                                if (qResult.done)
                                {
                                    done = true;
                                }
                                else
                                {
                                    qResult = sfProd.queryMore(qResult.queryLocator);
                                }
                               
                            }
                        }
                    }
                    catch (SoapException e)
                    {
                        MessageBox.Show(e.Message);
                    }

Hi,
I have fetched the AsyncApexJob from .Net.
In SOQL i got the "Bind variables only allowed in Apex code" Error.

My code is:

string res = "Failed";
            QueryResult query = null;
            string soql;
            soql = "SELECT Status,JobType,NumberOfErrors,CompletedDate FROM AsyncApexJob WHERE Status="+res+"";
            query = sfdcbind.query(soql);

Anyone help to solve this.
In API Sections, I'm not getting anything to generate WSDL.

Please see attached image.

Help asap. There is no link coming to generate WSDL, I want to access Contacts data in my .net application.

User-added image
Hi,

I'm trying to do upserts progrmatically.  For some reason I'm getting an INVALID_TYPE_ON_FIELD_IN_RECORD error for integer fields.
For example 5267 is reported as invalid value for field PaperID__c (see below).

I¨m quite buffled by this.



<?xml version="1.0" encoding="UTF-8"?><soap:Envelope soap:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><soap:Header><sforce:SessionHeader xmlns:sforce="urn:partner.soap.sforce.com"><sessionId xsi:type="xsd:string">00Dg0000003LRFz!ARAAQGWdG_dr.Ia_2V3QWeFZb7jWZJkn23A905ygVgvCN8_6MjC8aaqrBujiH4Gtp0_wUKzWW8HDr4CeIjqsOjaiobVp6VhH</sessionId></sforce:SessionHeader></soap:Header><soap:Body><sforce:upsert xmlns:sfons="urn:sobject.partner.soap.sforce.com" xmlns:sforce="urn:partner.soap.sforce.com">

      <sforce:externalIDFieldName xsi:type="xsd:string">PaperID__c</sforce:externalIDFieldName>
      <sObjects xsi:type="sforce:Account">

         <sforce:PaperID__c xsi:type="xsd:int">5267</sforce:PaperID__c>
       
        <sforce:name xsi:type="xsd:string">Test test5eeerreedede</sforce:name>
        <sforce:type xsi:type="xsd:string">0</sforce:type><sforce:fieldsToNull xsi:type="xsd:string">website</sforce:fieldsToNull>
        <sforce:fieldsToNull xsi:type="xsd:string">country__c</sforce:fieldsToNull>
        <sforce:fieldsToNull xsi:type="xsd:string">papertype__c</sforce:fieldsToNull></sObjects>
    </sforce:upsert></soap:Body></soap:Envelope>
hi,

i have to get a Java application to interface with a Web-Service (WS) that is avaiable via SalesForce (SF).

my app has to have its details loaded from property files so that we can test it in different environments before it can be deployed into production.

for that reason, i have to use different URLs, username and password when calling the WS.

with that in mind i have coubled together the code below that i have copied from another developer's blog :
http://kperisetla.blogspot.co.uk/2011/09/creating-custom-apex-web-service-in.html

it should have worked but it does not.
i can collect the correct loginResult and i try setting the URL to the one given by SF.
but it keeps giving me errors as if this object is not available/exist.

certainly, as a new SF user i am missing something unbelieably obvious.

could one of you experts assist me in solving this puzzle?

many thanks,




[error]

AxisFault
faultCode: {http://schemas.xmlsoap.org/soap/envelope/}Client
faultSubcode:
faultString: No operation available for request {http://soap.sforce.com/schemas/class/BananaWs}processInfoXML
faultActor:
faultNode:
faultDetail:
{http://xml.apache.org/axis/}stackTrace:No operation available for request {http://soap.sforce.com/schemas/class/BananaWs}processInfoXML
at org.apache.axis.message.SOAPFaultBuilder.createFault(SOAPFaultBuilder.java:222)
...

[/error]





[code]


String rsFileProcess = new String();
String xmlFile2Process = "<root><data>some long string goes here</data></root>";

String varContext_username = "app.use@sf.bananas.org.int";
String varContext_password = "Jggbnfkkr88jmkdmXxymJUhP9IeG7yvDlLYXr1jvG";
String varContext_loginUri = "https://test.salesforce.com/";

System.out.println(
"\n\n\tLOGIN DETAILS FOR WS"
+"\n\tuser:\t" + varContext_username
+"\n\tpwd:\t" + varContext_password
);


//Get a stub for calling partner WSDL's login method in order to get SessionID
SoapBindingStub bind = (SoapBindingStub)new SforceServiceLocator().getSoap();

LoginResult lr=bind.login(
varContext_username,
varContext_password
);

//Create a sessionHeader object and set its sessioId property to sessionId
//received in loginResult object                       
SessionHeader sh=new SessionHeader();
sh.setSessionId(lr.getSessionId());

//Create a service locator object for your custom web service
BananaWsServiceLocator locator=new BananaWsServiceLocator();

//Get URL for your custom web service
URL url=new URL(lr.getServerUrl());

//Create a stub for your custom web service with URL for your service and locator as parameters
BananaWsBindingStub stub=new BananaWsBindingStub(url, locator);

//Set the header property of stub with name "SessionHeader" and value as sh-sessionHeader
//object created above
stub.setHeader(locator.getBananaWsAddress(), "SessionHeader", sh);

//now make call to custom service-in
rsFileProcess = stub
.processInfoXML(xmlFile2Process);

System.out.println(

"the file processing returned :: " + rsFileProcess

);


[/code]
I have the following code:

User userupdate = new User();
userupdate.Id = "005G0000003VyQuIAK"; // this is a legit ID, I checked
userupdate.IsActive = false;
binding.update(new sObject[] {userupdate}); // binding is my active connection to SFDC, and allows me to perform other actions no problem

But the user Active field is not updating. Am I missing something?

Regards,
James
I have created a notification listener web service in C# which serve as a endpoint url in Outbound Message definition in Salesforce. I am trying to test the message recieved from Outbound Message. But couldnt find the way to test the same.

Endpoint Url - https://
WCF Service using Notification service - http://hostname/SalesforceNotification.asmx as a web reference
I'm after a recent working example (code) that I can prototype in VBScript and then pass onto my client, who needs to make a targeted change to a legacy VB6 app to make a real-time query against a Contact record in Salesforce.  The query is currently against a SQL DB that is not part of the legacy app, but will be migrated to salesforce.com.

The code I'm using (below), fails on when trying to parse the response (e.parse t)
--> Error during parsing, no element found at line 1
--> Code: 80044240, PocketSOAP.Envelope.11:

This article (https://developer.salesforce.com/forums/ForumsMain?id=906F00000008rMBIAY) from 2004 with replies from the PocketSOAP creator @Superfell is useful, but doesn't quite have a full example.

' PocketSOAP calling SOAP API / Partner WSDL

dim e
set e = CreateObject("PocketSOAP.Envelope.2")
' CLSID: {E2E0FB24-E58F-458f-84E0-6E09D2D51511}

e.EncodingStyle = ""
e.SetMethod "login", "urn:enterprise.soap.sforce.com"
'e.URI = "urn:enterprise.soap.sforce.com"

e.Parameters.Create "username", "sfdcuser@org.com", "urn:login"
e.Parameters.Create "password", "pwd+token", "urn:login"

' CLSID: {C7899023-E487-4268-AE2A-4EC50136DAB3}
'set mgr = CreateObject("pocketSOAP.Attachments")
'mgr.Format = formatMime

' CLSID: {D76BA06F-ABF3-4c1f-BDC9-1848D4E3CF2B}
dim t
set t = CreateObject("PocketSOAP.HTTPTransport.2")
t.SOAPAction = ""

t.Send "https://test.salesforce.com/services/Soap/u/29.0/", e.serialize

wscript.echo e.serialize

e.parse t ' <--- fails here with 'Error during parsing, no element found at line 1
' Code: 80044240, PocketSOAP.Envelope.11

wscript.echo "debug = " & e.parameters.item(0).Value

have a webservice written in .net which gets the request from the outbound message and sends the response. But salesforce keeps hitting my application and it still waits in outbound queue. How do I stop salesforce to hit the application once the response is received? Following is my code sample

notificationsResponse INotificationBinding.Pur(PTrans.notifications PurP)
    {
        string id,session = null;
        PTrans.notifications test = PurP;
        session = test.SessionId;
        string url = test.EnterpriseUrl;
        PTrans.Transaction__cNotification[] request = PurP.Notification;
        PTrans.notificationsResponse response = new notificationsResponse();
        response.Ack = true;
        return response;
    }
When I tested with soapui, I get the following response,

<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
   <soap:Body>
      <notificationsResponse xmlns="http://soap.sforce.com/2005/09/outbound">
         <Ack>true</Ack>
      </notificationsResponse>
   </soap:Body>
</soap:Envelope>
We are using cURL (per quickstart instructions) to initiate REST API connectivity. 

When issuing the command to get a security token - https://na11.salesforce.com/services/oauth2/token - we get back the error:

Failed: API security token required","error":"invalid_grant"

Which seems odd, since we're asking for the token. The client_id, client_secret, grant_type, username, and password all look fine. 

Assuming all that information is correct, what other reasons would the app not grant a security token?
Hi.

One of my SF users has set the mandatory state on a custom field.

But when I export the enterprise WSDL file, that column, though correctly typed, has a minOccurs="0".

<element name="Prospective_Target__c" nillable="true" minOccurs="0" type="xsd:double"/>

As a consequence, my mapper hasn't got the all the rules it needs to enforce this rule automatically.

Setting minOccurs="1" maxOccurs="1" is a very easily understood pattern, and especially on a simple element.

Is this something that could be done?

Conversly, because the WSDL files say the column is NOT mandatory in any descernible way, it shouldn't reject content in the way it now does. Hmm. Yeah, I know that's pushing things a bit, but I hope you can see the point.

I'm new on here, so is there anything else I need to ask to get some resolution on this?
I am trying to export my personal SF.com  data to spreadsheet format and then use that file to integrate with the sample you sent me yesterday instead of doing it manually.

The hitch is this, I am working on a MAC and when I prep the file on SF.com in the Data area, then save and export, my options are csv or xls, neither of which works when save the file on my MAC and open to view.

I am quite familiar with importing and exporting on my MAC, being the intuitive machine it is it just almost does the job on its own, but with SF the end result file is unusable. My search on this issue led me to reading about Force.com Excel Connector (there is no OSX version?) and other ways around this matter, landing up on this page http://www.ericsantiago.com/eric_santiago/2010/03/mac-daddy.html, who recommends LexiLoader.  I've installed LexiLoader for OSX on my MAC when I run it, it asks me to insert my SF.com access details and then error messages me they are incorrect, and they are not. So back to the drawing board.

Any help on this would be appreciated. Alternatively I will just have to do this list manually ):

I was thrilled to find this:

 

tell application "SalesforceScripting"
	set mySession to login username "myemail@mydomain.com" password "passwordtokenhere"
	
	--  Create a new Account in Salesforce
	
	set acc to make SObject
	set type of acc to "Account"
	acc setField named "Name" to "3 New Test Account"
	acc setField named "PDS__QB_Billing_Address__c" to "3 New Test Account
John Doe
123 Main Street
Arlington, TX 75007"
	acc setField named "Phone" to "(888) 555-6666"
	set res to mySession create sobjects acc
	Id of first item of res
	
end tell

 


And It works like a champ. I've spent the last couple of hours scouring the net and the script library trying to find out how to use something similar, or to add to it, so that I can create an Opportunity and Contact by adding some instructions to this.

 

I'm stuck. I guess I don't know enough about Apex and the SF system yet to read what needs to be in the script.

 

Any insight as to how to add Accounts/Contacts/Opportunities at the same time would be greatly appreciated.