• Robmd
  • NEWBIE
  • 0 Points
  • Member since 2007

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 3
    Questions
  • 8
    Replies
Hello, this is a cross-post from the General Development area.  It saw no uptake, and I could really use some help so I am trying the more specific board.
 
I am having problems updating the WhoId property of a Task.  Here's the code block (contains some custom objects and variables declared outside this block but hopefully they are named well enough to be obvious)
 
A brief disclaimer: the code currently contains bits and pieces of the mud I threw against the wall trying to get some results to stick.  I would be happy to try different things.
 
Code:
string qTasks = "SELECT WhoId, Status, Id, Subject FROM Task WHERE WhatId = '" + opportunityId + "' AND Status = 'Not Started'";
apex.QueryResult qrTasks = sf.query( qTasks );

if( qrTasks.size > 0 )
{
 sObject[] Tasks = qrTasks.records;

 lineDetail = new System.Xml.XmlElement[2];
 lineDetail[0] = doc.CreateElement( "WhoId" );   

 foreach( sObject task in Tasks )
 {
  lineDetail[0] = task.Any[0];
  lineDetail[0].InnerXml = leadList[leadCount].ContactId;

  lineDetail[1] = task.Any[1];

  task.Any = lineDetail;
 }
 
 apex.SaveResult[] srTasks = sf.update( Tasks );

 for( int itemCount = 0; itemCount < srTasks.Length; itemCount++ )
 {
  if( srTasks[itemCount].success )
  {
   log( "leadProcessed(): saving Tasks successful!", 0 );
  } 
  else
  {
   log( "leadProcessed(): saving Tasks FAILED!!", 0 );
  }
 }
}

 I am trying to automate what is currently a manual process in our environment, converting leads and setting up the opportunity.  The step I am having problems with is after the lead is converted and most of the opportunity properties are updated.  The last step for our salespeople here is to associate all the Open Activities with the Contact that was just created from the lead.
 
In the SF Interface, this is done by clicking the "edit" link beside each Open Activity and setting the field labelled "Name" to "Contact" and the name of the freshly created Contact.
 
When I query a Task updated this way manually, the only change appears to be to the WhoId field, which references the Contact's Id field. 
 
When I run the block of code pasted above, Salesforce returns success for all tasks updated and the LastModifiedDate is updated to the time of execution, but the Task's WhoId remains null.
 
leadList[leadCount].ContactId containts the correct Id, it is thee one returned in the LeadConvertResult and when I go to x.salesforce.com/[ContactId Value] it loads with the correct contact.
 
I am using the Partner WSDL.
 
The WhatId field of the Task is referencing the Opportunity.
 
Many thanks for any suggestions about how I've gone wrong.
  • March 08, 2007
  • Like
  • 0
Hello,
 
I am having problems updating the WhoId property of a task.  Here's the code block (contains some custom objects and variables declared outside this block but hopefully they are named well enough to be obvious)
 
A brief disclaimer: the code currently contains bits and pieces of the mud I threw against the wall trying to get some results to stick.  I would be happy to try different things.
 
Code:
string qTasks = "SELECT WhoId, Status, Id, Subject FROM Task WHERE WhatId = '" + opportunityId + "' AND Status = 'Not Started'";
apex.QueryResult qrTasks = sf.query( qTasks );

if( qrTasks.size > 0 )
{
 sObject[] Tasks = qrTasks.records;

 lineDetail = new System.Xml.XmlElement[2];
 lineDetail[0] = doc.CreateElement( "WhoId" );   

 foreach( sObject task in Tasks )
 {
  lineDetail[0] = task.Any[0];
  lineDetail[0].InnerXml = leadList[leadCount].ContactId;

  lineDetail[1] = task.Any[1];

  task.Any = lineDetail;
 }
 
 apex.SaveResult[] srTasks = sf.update( Tasks );

 for( int itemCount = 0; itemCount < srTasks.Length; itemCount++ )
 {
  if( srTasks[itemCount].success )
  {
   log( "leadProcessed(): saving Tasks successful!", 0 );
  } 
  else
  {
   log( "leadProcessed(): saving Tasks FAILED!!", 0 );
  }
 }
}

 I am trying to automate what is currently a manual process in our environment, converting leads and setting up the opportunity.  The step I am having problems with is after the lead is converted and most of the opportunity properties are updated.  The last step for our salespeople here is to associate all the Open Activities with the Contact that was just created from the lead.
 
In the SF Interface, this is done by clicking the "edit" link beside each Open Activity and setting the field labelled "Name" to "Contact" and the name of the freshly created Contact.
 
When I query a Task updated this way manually, the only change appears to be to the WhoId field, which references the Contact's Id field. 
 
When I run the block of code pasted above, Salesforce returns success for all tasks updated and the LastModifiedDate is updated to the time of execution, but the Task's WhoId remains null.
 
leadList[leadCount].ContactId containts the correct Id, it is thee one returned in the LeadConvertResult and when I go to x.salesforce.com/[ContactId Value] it loads with the correct contact.
 
I am using the Partner WSDL.
 
The WhatId field of the Task is referencing the Opportunity.
 
Many thanks for any suggestions about how I've gone wrong.
  • March 07, 2007
  • Like
  • 0
Hello, this is a cross-post from the General Development area.  It saw no uptake, and I could really use some help so I am trying the more specific board.
 
I am having problems updating the WhoId property of a Task.  Here's the code block (contains some custom objects and variables declared outside this block but hopefully they are named well enough to be obvious)
 
A brief disclaimer: the code currently contains bits and pieces of the mud I threw against the wall trying to get some results to stick.  I would be happy to try different things.
 
Code:
string qTasks = "SELECT WhoId, Status, Id, Subject FROM Task WHERE WhatId = '" + opportunityId + "' AND Status = 'Not Started'";
apex.QueryResult qrTasks = sf.query( qTasks );

if( qrTasks.size > 0 )
{
 sObject[] Tasks = qrTasks.records;

 lineDetail = new System.Xml.XmlElement[2];
 lineDetail[0] = doc.CreateElement( "WhoId" );   

 foreach( sObject task in Tasks )
 {
  lineDetail[0] = task.Any[0];
  lineDetail[0].InnerXml = leadList[leadCount].ContactId;

  lineDetail[1] = task.Any[1];

  task.Any = lineDetail;
 }
 
 apex.SaveResult[] srTasks = sf.update( Tasks );

 for( int itemCount = 0; itemCount < srTasks.Length; itemCount++ )
 {
  if( srTasks[itemCount].success )
  {
   log( "leadProcessed(): saving Tasks successful!", 0 );
  } 
  else
  {
   log( "leadProcessed(): saving Tasks FAILED!!", 0 );
  }
 }
}

 I am trying to automate what is currently a manual process in our environment, converting leads and setting up the opportunity.  The step I am having problems with is after the lead is converted and most of the opportunity properties are updated.  The last step for our salespeople here is to associate all the Open Activities with the Contact that was just created from the lead.
 
In the SF Interface, this is done by clicking the "edit" link beside each Open Activity and setting the field labelled "Name" to "Contact" and the name of the freshly created Contact.
 
When I query a Task updated this way manually, the only change appears to be to the WhoId field, which references the Contact's Id field. 
 
When I run the block of code pasted above, Salesforce returns success for all tasks updated and the LastModifiedDate is updated to the time of execution, but the Task's WhoId remains null.
 
leadList[leadCount].ContactId containts the correct Id, it is thee one returned in the LeadConvertResult and when I go to x.salesforce.com/[ContactId Value] it loads with the correct contact.
 
I am using the Partner WSDL.
 
The WhatId field of the Task is referencing the Opportunity.
 
Many thanks for any suggestions about how I've gone wrong.
  • March 08, 2007
  • Like
  • 0
Hello,
 
I am having problems updating the WhoId property of a task.  Here's the code block (contains some custom objects and variables declared outside this block but hopefully they are named well enough to be obvious)
 
A brief disclaimer: the code currently contains bits and pieces of the mud I threw against the wall trying to get some results to stick.  I would be happy to try different things.
 
Code:
string qTasks = "SELECT WhoId, Status, Id, Subject FROM Task WHERE WhatId = '" + opportunityId + "' AND Status = 'Not Started'";
apex.QueryResult qrTasks = sf.query( qTasks );

if( qrTasks.size > 0 )
{
 sObject[] Tasks = qrTasks.records;

 lineDetail = new System.Xml.XmlElement[2];
 lineDetail[0] = doc.CreateElement( "WhoId" );   

 foreach( sObject task in Tasks )
 {
  lineDetail[0] = task.Any[0];
  lineDetail[0].InnerXml = leadList[leadCount].ContactId;

  lineDetail[1] = task.Any[1];

  task.Any = lineDetail;
 }
 
 apex.SaveResult[] srTasks = sf.update( Tasks );

 for( int itemCount = 0; itemCount < srTasks.Length; itemCount++ )
 {
  if( srTasks[itemCount].success )
  {
   log( "leadProcessed(): saving Tasks successful!", 0 );
  } 
  else
  {
   log( "leadProcessed(): saving Tasks FAILED!!", 0 );
  }
 }
}

 I am trying to automate what is currently a manual process in our environment, converting leads and setting up the opportunity.  The step I am having problems with is after the lead is converted and most of the opportunity properties are updated.  The last step for our salespeople here is to associate all the Open Activities with the Contact that was just created from the lead.
 
In the SF Interface, this is done by clicking the "edit" link beside each Open Activity and setting the field labelled "Name" to "Contact" and the name of the freshly created Contact.
 
When I query a Task updated this way manually, the only change appears to be to the WhoId field, which references the Contact's Id field. 
 
When I run the block of code pasted above, Salesforce returns success for all tasks updated and the LastModifiedDate is updated to the time of execution, but the Task's WhoId remains null.
 
leadList[leadCount].ContactId containts the correct Id, it is thee one returned in the LeadConvertResult and when I go to x.salesforce.com/[ContactId Value] it loads with the correct contact.
 
I am using the Partner WSDL.
 
The WhatId field of the Task is referencing the Opportunity.
 
Many thanks for any suggestions about how I've gone wrong.
  • March 07, 2007
  • Like
  • 0
Can someone confirm that modifying any fields on an OpportunityLineItem or OpportunityLineItemSchedule will automatically update the related Opportunity's LastModifiedDate or SystemModstamp?

Thanks in advance.
Jon
  • March 07, 2007
  • Like
  • 0

Can a queue own an Opportunity?

I have searched the boards, but have not been able to find any information on queues and opportunities.

I would like to create queues for teams and as new opportunities come in assign them to a team not an individual.

Thanks for the help.

Todd

http://www.appirio.com/

Message Edited by TBursey on 02-18-2007 07:07 PM

i am trying to return a Custom field using a query.  The Query works just fine but how to I read the results?  I found an exmaple online like this
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); }


The problem with this code is that the sObject does not have a proeprty called Any[].  It doesn't exist and fails to compile.

I am using basicSample_cs.zip to try this.  It is referencing
C:\dev\sforce\API 8.0\VS\samples\enterprise.wsdl.

Any ideas?

thanks.