Find your content:

Search form

You are here

Not getting Lead Class inside PartnerWSDL

 
Share

I am integrating Sales force in ASP.NET application so here I am using PartnerWSDL for integration but when I quering SOQL language for Lead then how can I retrieve the data from that because I am unable to get Lead class in partnerWSDl so how can I convert my data to Lead varables. Please check the code below

 String soqlQuery = "SELECT Rating,NumberOfEmployees,Industry,Status,LeadSource,Email FROM Lead";
try
{
PartnerWSDL.QueryResult qr = binding.query(soqlQuery);
bool done = false;
if (qr.size > 0)
{  
while (!done)
{
PartnerWSDL.sObject[] records = qr.records;
for (int i = 0; i < records.Length; i++)
{
PartnerWSDL.Lead lead=(PartnerWSDL.Lead)record[i]; ---- this generates an compile time error, that lead class is not defined in PartnerWSDL.
}
}

But in our enterprice we have the Lead, Contact class defined in WSDL.


Attribution to: Himanshu Jain

Possible Suggestion/Solution #1

You assign it to an sforce.SObject instead of a designated object class. Here's the example from the API documentation:

public void querySample() 
{
    try
    {
    QueryResult qr = null;
    binding.QueryOptionsValue = new sforce.QueryOptions();
    binding.QueryOptionsValue.batchSize = 250;
    binding.QueryOptionsValue.batchSizeSpecified = true;

    qr = binding.query("SELECT FirstName, LastName FROM Contact");

    bool done = false;
    int loopCount = 0;
    while (!done)
    {
        Console.WriteLine("\nRecords in results set " + 
            Convert.ToString(loopCount++)
                + " - ");
        // Process the query results
        for (int i = 0; i < qr.records.Length; i++)
        {
            sforce.sObject con = qr.records[i];
            string fName = con.Any[0].InnerText;
            string lName = con.Any[1].InnerText;
            if (fName == null)
                Console.WriteLine("Contact " + (i + 1) + ": " + lName);
            else
                Console.WriteLine("Contact " + (i + 1) + ": " + fName
                    + " " + lName);
        }

        if (qr.done)
            done = true;
        else
            qr = binding.queryMore(qr.queryLocator);
    }
}
catch (SoapException e)
{
    Console.WriteLine("An unexpected error has occurred: " + e.Message +
        " Stack trace: " + e.StackTrace);
}
Console.WriteLine("\nQuery execution completed.");
}

Attribution to: Guy Clairbois
This content is remixed from stackoverflow or stackexchange. Please visit https://salesforce.stackexchange.com/questions/30640

My Block Status

My Block Content