• ScottE
  • NEWBIE
  • 5 Points
  • Member since 2007

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 3
    Replies
I've searched the existing posts and have not found a solution, so I apologize if I overlooked something.  The problem I am having relates to creating a Task object and assigning the Type.
 
Here are the relevant code sections:
 
Code:
SforceService service = new SforceService();
// Login
LoginResult lr = service.login("hello", "world");

// Set initial values per the readme   
service.Url = lr.serverUrl;
service.SessionHeaderValue = new SessionHeader();
service.SessionHeaderValue.sessionId = lr.sessionId;
GetUserInfoResult userInfo = lr.userInfo;

// Set query option values
service.QueryOptionsValue = new QueryOptions();
service.QueryOptionsValue.batchSize = 2000;
service.QueryOptionsValue.batchSizeSpecified = true;

// Select leads where the OwnerID matches the ID of the logged in user
QueryResult result = 
 service.query("select ID, Name, Email, Company, " +
 "Phone, from Lead where OwnerID = \'" + userInfo.userId + "\'" );

// Enumerate the fields in the Task object
DescribeSObjectResult dsr = service.describeSObject("Task");
// Create storage for the Task Types
PicklistEntry[] CallTypeList = null;
foreach (Field f in dsr.fields)
{
 // Is this a picklist and is the field name Type—
 if (f.type == fieldType.picklist && f.name == "Type")
 {
  CallTypeList = f.picklistValues;
 }
}

sObject[] Leads = result.records;

// Iterate through the Leads and create a new task for the owner
foreach (Lead l in Leads)
{
 Task[] Tasks = new Task[1];
 Tasks[0] = new SalesForce.Task();
 Tasks[0].OwnerId = userInfo.userId;
 Tasks[0].Priority = "High";
 Tasks[0].CallType = CallTypeList[7].value;
 DateTime tomorrow = DateTime.Today.AddDays(1);
 Tasks[0].ActivityDate = tomorrow;
 Tasks[0].ActivityDateSpecified = true;
 Tasks[0].Description = "Follow up call 1";
 Tasks[0].Subject = "Follow up to a new lead";
 Tasks[0].WhoId = l.Id;
}

 The problem is that when I try to set the CallType member to a plain string or PicklistEntry value or label, I get the following error:
 
Error code (INVALID_OR_NULL_FOR_RESTRICTED_PICKLIST): Call Type: bad value for restricted picklist field: Email
 
Email is the 8th item in the CallTypeList array, and both the value and label of that item equal "Email".
 
The strange part is that if set
 
Tasks[0].CallType = "Outbound";
 
Then no error is generated and the Task is successfully created (with the Type being set to the default value of "Email").
 
I have verified that CallTypeList contains all of the correct values from the SalesForce web interface at runtime, Im just stymied as to why it refuses to accept what appears to be a legitimate value.
 
 

 
  • September 24, 2007
  • Like
  • 0
Maybe there is someone who has had this problem before:

A user contacted me as their Connect for Outlook program mysteriously 'vanished' overnight. I verified that the user still has the component installed via the programs list. Additionally, I checked add/remove programs and connect was there. When we start outlook we see nothing. I've checked her toolbars, views - everything I could possibly think of and there is no trace of it in outlook.

I decided to do a clean install, so we removed the program. Restarted her computer. Ran the installer, and went through a restart. The results were the same - absolutely nothing is there, yet the program is visible in both all programs and the add/remove programs utility.

If there is anyone with a solution to this issue, please let me know! Thank you SFDC Community!

-Larry
  • January 20, 2009
  • Like
  • 0
I'm using Outlook 2007 and the add-in buttons disappeared.  I went to TOOLS | TRUST CENTER | ADD-INS | MANAGE COM ADD-INS.
 
I could see that "Salesforce.com Outlook Edition Enhanced" was unchecked.  It should have been as easy as putting a checkmark by it and clicking OK.  See attached screen shot.
 
It did not turn out to be that easy.  The plug-in did not begin working after taking the steps above.  Every time I go back to manage the com add-ins, the checkmark is gone even though I had just added it and clicked OK.
 
This has been really frustrating and did not get any meaningful help the first time I attempted to call basic support.  I have done a complete un-install and re-install.  The basic support person even had me remove some things first from the registry.  I still have the exact same problem.
 
Can anyone offer insight/suggestions on how to correct this issue?
  • September 22, 2008
  • Like
  • 0