function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
KM_QuantumColorKM_QuantumColor 

Having Trouble setting picklist field for a new Task

Hello,

 

NewB here.

 

I am having troubling setting the fields for anytime I create a new Task or event.

 

Using C#

 

 basic syntax...

 

 

            Task sfTask = new Task();
 
            sfTask.Description = "description";
            sfTask.WhoId = whoID;
            sfTask.Subject = "Call";
            sfTask.Status = "In Progress";

            sfTask.Priority = "low";
            sObject taskSObject = new sObject();
            taskSObject = (sObject)sfTask;
            sObject[] eventArray = new sObject[1];
            eventArray[0] = taskSObject;
            SaveResult[] sr = _binding.create(eventArray);

            for (int j = 0; j < sr.Length; j++)
            {
                if (sr[j].success)
                {
                    sr[j].id.ToString();
                }
                else
                {
                    for (int i = 0; i < sr[j].errors.Length; i++)
                    {
                        Error err = sr[j].errors[i];
                    }
                }
            }

 

What's strange is, it inserts into the table OK, but for whatever reason it is ignoring the 

 

assignments for 'status' and 'subject', yet sets the 'whoid' correctly.

What am I doing wrong?

 

Thanks!

Message Edited by KM_QuantumColor on 05-12-2009 02:58 PM
Message Edited by KM_QuantumColor on 05-12-2009 02:59 PM
Best Answer chosen by Admin (Salesforce Developers) 
KM_QuantumColorKM_QuantumColor

Hi Simon,

 

thank for replying. It seems as tho' I am an idiot :smileyhappy:

 

I was not paying attention to who the leads/contacts were being assigned to. It looks like its working properly.

Message Edited by KM_QuantumColor on 05-13-2009 10:01 AM

All Answers

KM_QuantumColorKM_QuantumColor

Just wanted to add that none of the other fields are setting except the whoid.

 

The code is simple enough, need some direction as to why none of the other fields

are not being set.

 

There are no validation rules.

 

 

KM_QuantumColorKM_QuantumColor
Since I don't see any code issues, it has to be a permission issue. I'm willing to check all the places where a setting might be blocking. I have checked the usual...Setup-Customize-Activity and don't see anything conflicting. I just need to track when leads or contacts are making phone calls, emails ,etc. Thanks.
SuperfellSuperfell
What version of .NET are you using ? do you have any apex triggers on Task? can you get a capture of your actual SOAP request?
KM_QuantumColorKM_QuantumColor

Hi Simon,

 

thank for replying. It seems as tho' I am an idiot :smileyhappy:

 

I was not paying attention to who the leads/contacts were being assigned to. It looks like its working properly.

Message Edited by KM_QuantumColor on 05-13-2009 10:01 AM
This was selected as the best answer