• alivepjc
  • NEWBIE
  • 0 Points
  • Member since 2005

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 22
    Questions
  • 16
    Replies
Hi,
 
I've been searching the forums for creating objects in batches of 200 but I can't find any examples (C#). the sample code to download doesn't have an example of batch creation. To create opportunities for example, I do this:
 
sforce.Opportunity newOp = new sforce.Opportunity();

// populate newOp

newOp.AccountId = acct_id;

newOp.StageName = "ClosedWon"

newOp.Name = "John";

sforce.sObject[] records = new sforce.sObject[] {newOp};

sforce.SaveResult[] saveResults = binding.create(records);

this is OK if I need to create a few, but if I need to create thousands of them, it is not OK. I know this is simple question, but I can't find the answer.. I'd like to follow the best practices..

thank you!

Hi,
 
I am trying to delete records in CampaignMemeber (AJAX-sforce kit beta2)
 
var deleteObj = new Array();
deleteObj.push = idToDelete;
 
var dr = sforceClient.Delete([deleteObj]);
alert(sr[0].errors);
 
I am using 18 character ids and I am getting INVALID_ID_FIELD when I attempt to delete.
 
Help is appreciated!
 
Thanks!
 
 
 
 
 
Hi,

I have an scontrol (AJAX) that searches records in the contact object. The searches will almost always return 500+ records. I have a batch size limit of 20.
I am using the queryMore to keep looping:

qr = sforceClient.Query(query_);

// get and print values here

if (qr.done == true)
{
stoploop = true;
} else {
qr = sforceClient.QueryMore(qr.queryLocator);
}

Everything works, records are returned and printed properly but it is very slow. I get an error in IE that says:

"A script in this page is causing Internet Explorer to run slowly. If it continues to run it may become unresponsive. Do you wish to continue? YES NO"

How can I avoid this?

Thank you for your time.
Hi,

I am trying to create 2 different objects in the same function, both of them custom. The first create call works fine, the second one give this error: Object doesn't support this property or method.

everything works fine, but when I add the second create call the error comes up. Is there something that I am missing?

Thanks in advance for you help.
Hi,

I need to update the status of a contract, but I don't quite understand how it works.
There's the ContractStatus table and the Contract table with Status field and StatusCode field. I am using AJAX.

//--------------------------------------------------------
var contract_object_update = new DynaBean("Contract");

contract_object_update.set("Id",Contract_id);

contract_object_update.set("StatusCode","???"); // ?

contract_object_update.set("Status","???"); // ?

Contract_to_Update.push(contract_object_update);

var sr = sforceClient.Update(Contract_to_Update)[0];
//---------------------------------------------------------

Thanks!
Hi,

quick question. how would I retrieve all the accounts where a user is a member of the account's team?
for example, if user 'A' is part of team 'T', how do I retrieve all the accounts that are owned by 'T'?
is it by querying 'AccountTeamMember' and matching userID with accountID?

help is appreciated,

thank you
Hi,

Anybody has sample code on the getUserInfo() call? I am trying to get the userId from the user logged in the current session.

Thanks!
Hi,

I am trying to retrieve all the fields from Contacts into a select box. My app worked fine outside SFDC, once I implemented single sign-on, the soap message is returned OK, but my code doesn't work at all. the soap message looks ok. using partner.

this is my code, any ideas?
------------------------------------------
$describe = $client->describeSObject("Contact");
//echo "Response: ".$client->__getlastresponse()."\n";//describe call ok.

echo "-- Fields -- ";
echo "------------------";

for($i = 0; $i < sizeof($describe->fields); $i++) {
if($describe->fields[$i]->custom == "false") {
$field = $describe->fields[$i]->name;
$field = str_replace ("__c", "", $field);

echo "".$field."";
}
}
---------------------------

thanks for your help!

Hi,

I am starting with the AJAX kit and I ran into a "permission denied" problem. I am running my app from an outside URL, not a native scontrol. I am able to log in fine:

if (sforceClient.getSessionId().indexOf("API_Session_ID") != -1)
{
alert("not logged in");
}
else
{
alert("logged in"); // i get this so login is good.
}

//right after that I call this:

var attach = new DynaBean("Attachment"); // <-- permission denied for any case: lead, contact,etc

I am running an asp.net app with this, the aspx page works fine, and does what it is supposed to do. I also changed my security settings to full trust as mentioned in another thread..

can we create attachment objects from AJAX?

Any help will be much appreciated,  thanks!

Hi,

I am trying to read the body of a document. I know that the document is base64 encoded, but the soap request returns an error.

...

$query_str = "select Id,Name,Body from document where Id = $docId";

how should this be done?

is the syntax to query documents different?

thanks!

Hi,

I'm using describeSObject to get a list of fields and then pass it to a query. I am using the following code, but it doesn't return all the fields (sometimes 225, 216 depending on string formatting) and my query fails. we have 238 fields in the contacts tab. Depending on how I format the string it forms different strings. Is there a limit I am not aware of?

C#

sforce.DescribeSObjectResult res = binding.describeSObject( "Contact" );

for( int i=0; i < res.fields.Length-1; i++ )

{

expr += res.fields[i].name + ", ";

}

expr += res.fields[i-1].name;

qr = binding.query("select expr from Contact where Id = '" + contactid + "'");

help is appreciated.

Hi,

I am having problems creating elements, in this case is campaign members. I am using the files from the php sample kit which refer to the urn:partner.soap.sforce.com

I can query anything perfectly, but for create calls nothing happens. Please give me a hand. I have looked around the forum for hours and I can't figure it out.

I have the endpoint , campaign id and contact id coming from a form. variables are passed ok.

$client = new SalesforceClient($SESSION); // $SESSION passed as a $_POST from the previous form.
$client->_endpoint = $_POST['sf_endpoint']; // endpoint passed as a $_POST from the previous form.

 $FIELDS = array('type'=>'CampaignMember','CampaignId'=>'$camp_id','ContactId'=>'$contactid');
 $result = $client->create($FIELDS);

if (PEAR::isError($result)) {
    print "<p><span style=\"color:#FF0000\">".$result->getMessage()."<br /></span></p>";
}

this returns NO error, but nothing is created. Am I passing the correct requiered fields?

I am running PHP Version 4.3.10. If I need to post the soap response or xml response, can anybody show me how to do that please?

I appreciate your help!

alivepjc

P.S.: dreamforce 05 rocked!

Hi,

I am having a problem with creating tasks in leads. I have a login page which works fine, and a page that needs to create a task according to certain criteria. I looked at the code above and implemented it in my file but it doesn't seem to work. I hardcoded a couple or variables for testing purposes. Any help would be much appreciated. If there is any better way to do this, please let me know.

thanks!

require_once("SalesforceClient.php");
include_once("salesforce.conf");


/////////////// add task ////////////////////////
class SFDC_Task {
var $fields = array('type' => 'Task',
'WhoId'=>null,
'OwnerId' => null,
'ActivityDate'=>null,
'Subject'=>null,
'Description'=>null,
'Status'=>'Completed');
var $client;
var $error;

function SFDC_Task($client){
$this->client = $client;
}

function add() {
$client = $this->client;
if ($client and isset($this->fields['WhoId'])) {
$result = $client->create($this->fields);
if ($result->success == "true") {
return $result->id;
} else {
$this->error = $result->errors;
return false;
}
} else {
$this->error = "Invalid request.";
return false;
}
}
}
/////////////////////////////////////////////////

if (!isset($_COOKIE['sf_session'])) {
 header("Location: login.php");
 exit;
} else {
 $SESSION  = $_COOKIE['sf_session'];
}
$to = "00Q30000006bW4iEAE";

$ownerid = "00530000000cTNeAAM";
$subject = "Information";
$client = new SalesforceClient($SESSION);
$client->_endpoint = $_COOKIE['sf_endpoint'];

  if ($client) {
  $tsk = new SFDC_Task($sf_id,$client);   // what is $sf_id??
  $tsk->fields['ActivityDate'] = gmdate("Y-m-d H:i:s", time());
  $tsk->fields['Subject'] = "Email: $subject";
  $tsk->fields['Description'] = "Email sent";
  $tsk->fields['Status'] = 'Completed';
  $tsk->fields['OwnerId'] = $ownerid;
  $tsk->fields['WhoId'] = $to;
  $ok = $tsk->add();
  }
?>

Hi guys,

I have 2 companies that have salesforce CRM. The Accounts ( clients ) will be created in company A's salesforce and processed by company B's salesforce.

I need to do the following:

- check on salesforce A for new accounts, if I find any accounts, create them in salesforce B.

- after salesforce B processes the account, update it in salesforce A.

- if any accounts are created in salesforce B, create them in salesforce A.

My questions are, can I do this in one app just referring to both WSDLs?

since the Account objects are different, how do I populate the account in the other company's account?

how do I keep all this clean? I will be dealing with different IDs.

thanks!

chris

Hi guys,

I have a custom shopping cart which passes all the info to leads as in web-to-lead. Is there a way to, once a sale is made through the shopping cart, create an account with the opportunity inside it?

If there isn't, do you have any ideas?

thanks!

Hi guys!

I have to create a closed (completed task) activity under the Clients tab every time an envelope is printed. I call the doUpdate() after printing. I grabbed an example from DevAngel and tried to adapt it to clients since it was originally for contracts, but doesn't work =(..

how do I link the activity to the contact?

any ideas?

doUpdate()

{

string contactId = contact.Id; // from a previous query

sforce.Task task = new sforce.Task();

task.ActivityDate = DateTime.Now;

task.ActivityDateSpecified = true;

task.Description = "Test activity";

task.Priority = "High";

task.Status = "Completed";

task.Subject = "Test activity subject";

//task.Type = "Other"; I don't have Type under the task object

//task.WhatId = contactId;   <-- I don't know if I should do this

sforce.SaveResult sr = binding.create(new sforce.sObject[] {task})[0];

}

thanks!!

chris

Hi guys,

quick question. I wrote this app in c# .net that returns the billing address for any account entered. I need to print that address in an envelope size 10. I don't know how to do it. can anybody give me a hand please.

thanks!

chris

Hi,

I am having problems filtering my queries in C# .net. I downloaded the sample code, but I can't make them work.

I am trying to retreive 1 account based on its name.

If I hard code the Name field which is my filter, it works, if I pass a variable, it doesn't.

////////////////////////////////

private static void doGetAccounts()

{

//check to see if we are already logged in

if (lr == null)

{

Console.WriteLine("Run the login sample before the others.\n");

getUserInput("Hit enter to continue: ");

Console.WriteLine("\n");

return;

}

//create a variable to hold the query result

sforce.QueryResult qr = null;


// get user input for account name

String accName = getUserInput("Please enter the account name: ");

//call the query saving the results in qr

try

{

// non-working query

qr = binding.query("select Name, BillingStreet, BillingCity, BillingState, BillingPostalCode, BillingCountry from Account where Name = " + accName);

// working query

qr = binding.query("select Name, BillingStreet, BillingCity, BillingState, BillingPostalCode, BillingCountry from Account where Name = 'Chris'");

}

catch (Exception e)

{

Console.WriteLine(e.Message + "\n" + e.StackTrace);

return;

}

//////////////////////////

please help me out!. Sample queries would be awesome!

thank you,

chris

Hi,

I am having problems filtering my queries in C# .net. I downloaded the sample code, but I can't make them work.

I am trying to retreive 1 account based on its name.

If I hard code the Name field which is my filter, it works, if I pass a variable, it doesn't.

////////////////////////////////

private static void doGetAccounts()

{

//check to see if we are already logged in

if (lr == null)

{

Console.WriteLine("Run the login sample before the others.\n");

getUserInput("Hit enter to continue: ");

Console.WriteLine("\n");

return;

}

//create a variable to hold the query result

sforce.QueryResult qr = null;

// get user input for account name

String accName = getUserInput("Please enter the account name: ");

//call the query saving the results in qr

try

{

// non-working query

qr = binding.query("select Name, BillingStreet, BillingCity, BillingState, BillingPostalCode, BillingCountry from Account where Name = " + accName);

// working query

qr = binding.query("select Name, BillingStreet, BillingCity, BillingState, BillingPostalCode, BillingCountry from Account where Name = 'Chris'");

}

catch (Exception e)

{

Console.WriteLine(e.Message + "\n" + e.StackTrace);

return;

}

//////////////////////////

please help me out!. Sample queries would be awesome!

thank you,

chris

Hi,

I just switched from php to .net to develop some stuff for SF and I don't know how to build the filtered queries.

I downloaded the sample code for C#, and made a couple of changes.

I am trying to retrieve 1 account. the filter is account Name which I pass from propting the user to enter it.

if I hard code the filter it works..

this is the sample code that I am using:

/////////////////////////////

private static void doGetAccounts()

{

//check to see if we are already logged in

if (lr == null)

{

Console.WriteLine("Run the login sample before the others.\n");

getUserInput("Hit enter to continue: ");

Console.WriteLine("\n");

return;

}

//create a variable to hold the query result

sforce.QueryResult qr = null;

// get user input for account name

String accName = getUserInput("Please enter the account name: ");

//call the query saving the results in qr

try

{

// non-working query

qr = binding.query("select Name, BillingStreet, BillingCity, BillingState, BillingPostalCode, BillingCountry from Account where Name = " + accName);

// working query

qr = binding.query("select Name, BillingStreet, BillingCity, BillingState, BillingPostalCode, BillingCountry from Account where Name = 'Chris' ");

}

catch (Exception e)

{

Console.WriteLine(e.Message + "\n" + e.StackTrace);

return;

}

//////////////////////////////

Please help me out. sample queries would be awesome!

thank you!!

chris

 

Hi,
 
I've been searching the forums for creating objects in batches of 200 but I can't find any examples (C#). the sample code to download doesn't have an example of batch creation. To create opportunities for example, I do this:
 
sforce.Opportunity newOp = new sforce.Opportunity();

// populate newOp

newOp.AccountId = acct_id;

newOp.StageName = "ClosedWon"

newOp.Name = "John";

sforce.sObject[] records = new sforce.sObject[] {newOp};

sforce.SaveResult[] saveResults = binding.create(records);

this is OK if I need to create a few, but if I need to create thousands of them, it is not OK. I know this is simple question, but I can't find the answer.. I'd like to follow the best practices..

thank you!

We've integrated the SFDC APIs into our java applet.  What I'm trying to do is minimize the around of configuration information that we have to retain for a user. 

 

My question is there a way from the API to determine my instance?  i.e. 'na1, na2, etc.' when I build my URL to pop screens?

 

We've looking in the API and we don't see it in the user or binding objects.

 

 

This is a sample URL that were using.

 
If I am running a query on contacts something like
Select AccountId, FirstName, LastName from Contact

is it possible at the same time to get the account name rather than running another query?

Thanks
I appologize for the noob question, but I'm trying to work through my first queries.

Currently I am looking up firstname lastname email and id and they all return as expected. I tried to add city and state and my queries no longer returned results.

My working query looks like
$queryResult = $sfdc->query("select id, firstname, lastname, email, phone from contact where firstname = '$first_name'");

and this is what I tried
$queryResult = $sfdc->query("select id, firstname, lastname, email, city, state, phone from contact where firstname = '$first_name'");

Is there a link where I can see a list of all the valid default fields?

Thanks!

Justin
Hi,

I am trying to retrieve all the fields from Contacts into a select box. My app worked fine outside SFDC, once I implemented single sign-on, the soap message is returned OK, but my code doesn't work at all. the soap message looks ok. using partner.

this is my code, any ideas?
------------------------------------------
$describe = $client->describeSObject("Contact");
//echo "Response: ".$client->__getlastresponse()."\n";//describe call ok.

echo "-- Fields -- ";
echo "------------------";

for($i = 0; $i < sizeof($describe->fields); $i++) {
if($describe->fields[$i]->custom == "false") {
$field = $describe->fields[$i]->name;
$field = str_replace ("__c", "", $field);

echo "".$field."";
}
}
---------------------------

thanks for your help!

Hi,

I am trying to read the body of a document. I know that the document is base64 encoded, but the soap request returns an error.

...

$query_str = "select Id,Name,Body from document where Id = $docId";

how should this be done?

is the syntax to query documents different?

thanks!

Hi,

I am having problems creating elements, in this case is campaign members. I am using the files from the php sample kit which refer to the urn:partner.soap.sforce.com

I can query anything perfectly, but for create calls nothing happens. Please give me a hand. I have looked around the forum for hours and I can't figure it out.

I have the endpoint , campaign id and contact id coming from a form. variables are passed ok.

$client = new SalesforceClient($SESSION); // $SESSION passed as a $_POST from the previous form.
$client->_endpoint = $_POST['sf_endpoint']; // endpoint passed as a $_POST from the previous form.

 $FIELDS = array('type'=>'CampaignMember','CampaignId'=>'$camp_id','ContactId'=>'$contactid');
 $result = $client->create($FIELDS);

if (PEAR::isError($result)) {
    print "<p><span style=\"color:#FF0000\">".$result->getMessage()."<br /></span></p>";
}

this returns NO error, but nothing is created. Am I passing the correct requiered fields?

I am running PHP Version 4.3.10. If I need to post the soap response or xml response, can anybody show me how to do that please?

I appreciate your help!

alivepjc

P.S.: dreamforce 05 rocked!

Hi guys,

I have 2 companies that have salesforce CRM. The Accounts ( clients ) will be created in company A's salesforce and processed by company B's salesforce.

I need to do the following:

- check on salesforce A for new accounts, if I find any accounts, create them in salesforce B.

- after salesforce B processes the account, update it in salesforce A.

- if any accounts are created in salesforce B, create them in salesforce A.

My questions are, can I do this in one app just referring to both WSDLs?

since the Account objects are different, how do I populate the account in the other company's account?

how do I keep all this clean? I will be dealing with different IDs.

thanks!

chris

Hi guys!

I have to create a closed (completed task) activity under the Clients tab every time an envelope is printed. I call the doUpdate() after printing. I grabbed an example from DevAngel and tried to adapt it to clients since it was originally for contracts, but doesn't work =(..

how do I link the activity to the contact?

any ideas?

doUpdate()

{

string contactId = contact.Id; // from a previous query

sforce.Task task = new sforce.Task();

task.ActivityDate = DateTime.Now;

task.ActivityDateSpecified = true;

task.Description = "Test activity";

task.Priority = "High";

task.Status = "Completed";

task.Subject = "Test activity subject";

//task.Type = "Other"; I don't have Type under the task object

//task.WhatId = contactId;   <-- I don't know if I should do this

sforce.SaveResult sr = binding.create(new sforce.sObject[] {task})[0];

}

thanks!!

chris

Hi guys,

quick question. I wrote this app in c# .net that returns the billing address for any account entered. I need to print that address in an envelope size 10. I don't know how to do it. can anybody give me a hand please.

thanks!

chris

I downloaded the  php devlopment toolkit from source forge. I uploaded the SOAP and PEAR packages and I get the following error:

Warning main(Net/Socket.php): failed to open stream: No such file or directory in htdocs/sforce/HTTP/Request.php on line 47

Fatal error main(): Failed opening required 'Net/Socket.php' (include_path='htdocs/include/') in htdocs/sforce/HTTP/Request.php on line 47

what is Net/Socket.php??

what other package do i need to upload.

thank you for your help..

chris