4

Since all picklist values for the Status field on Tasks are configurable I don't think I can simply set the Status to "Completed" as that picklist value could have been deleted/renamed.

I tried getting the picklist values for the Status field, but when I list the picklist values with the REST API or via Apex, I don't seem to get this information. All I get is Label, Value, isActive, and isDefaultValue. Is there any way to know if one of the picklist values is considered closed? or to reliably set a Task to "closed" without knowing that?

1 Answer 1

5

You should be able to query the object TaskStatus to pull the list of all status values, along with a field IsClosed to tell you which values would mark a task as closed. Your query would look something like this.

SELECT MasterLabel, IsClosed FROM TaskStatus WHERE IsClosed = true

You can then execute the query using the standard query endpoint (details here in case you're not familiar with it).

More info on the TaskStatus object can be found here http://www.salesforce.com/developer/docs/api/Content/sforce_api_objects_taskstatus.htm

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .