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
SoleesSolees 

Closing Task with REST API in Salesforce Mobile SDK iOS

Hello friends, im trying to close tasks (updating field IsClosed = true) with the Salesforce Mobile SDK for iOS and i get an error that this can't be done.  Is there another way to do this?

 

thanks

Best Answer chosen by Admin (Salesforce Developers) 
SuperfellSuperfell

The TaskStatus SObject contains additional info about which status are mapped to a closed value, try running this query.

 

selectId, MasterLabel, SortOrder, IsDefault, IsClosedfromTaskStatus order by SortOrder

All Answers

jhersh1jhersh1

IsClosed is a read-only field. You should see the sObject API docs for more details on standard fields like that one.

 

On Task, IsClosed is determined by the status field.

SoleesSolees

Thanks jhersh1 for your response,

 

i see what you say, and because of that i tried to look in the Task fields but i dont see anything that can help me to close the task :S

 

Task Object, Field "IsClosed" :

       {

            autoNumber = 0;

            byteLength = 0;

            calculated = 0;

            calculatedFormula = "<null>";

            caseSensitive = 0;

            controllerName = "<null>";

            createable = 0;

            custom = 0;

            defaultValue = "<null>";

            defaultValueFormula = "<null>";

            defaultedOnCreate = 1;

            dependentPicklist = 0;

            deprecatedAndHidden = 0;

            digits = 0;

            externalId = 0;

            filterable = 1;

            groupable = 1;

            htmlFormatted = 0;

            idLookup = 0;

            inlineHelpText = "<null>";

            label = Closed;

            length = 0;

            name = IsClosed;

            nameField = 0;

            namePointing = 0;

            nillable = 0;

            picklistValues =             (

            );

            precision = 0;

            referenceTo =             (

            );

            relationshipName = "<null>";

            relationshipOrder = "<null>";

            restrictedPicklist = 0;

            scale = 0;

            soapType = "xsd:boolean";

            sortable = 1;

            type = boolean;

            unique = 0;

            updateable = 0;

            writeRequiresMasterRead = 0;

        }

 

Task Object, Field "Status" :

       {  

           autoNumber = 0;

            byteLength = 120;

            calculated = 0;

            calculatedFormula = "<null>";

            caseSensitive = 0;

            controllerName = "<null>";

            createable = 1;

            custom = 0;

            defaultValue = "<null>";

            defaultValueFormula = "<null>";

            defaultedOnCreate = 0;

            dependentPicklist = 0;

            deprecatedAndHidden = 0;

            digits = 0;

            externalId = 0;

            filterable = 1;

            groupable = 1;

            htmlFormatted = 0;

            idLookup = 0;

            inlineHelpText = "<null>";

            label = Status;

            length = 40;

            name = Status;

            nameField = 0;

            namePointing = 0;

            nillable = 0;

            picklistValues =             (

                                {

                    active = 1;

                    defaultValue = 1;

                    label = "Not Started";

                    validFor = "<null>";

                    value = "Not Started";

                },

                                {

                    active = 1;

                    defaultValue = 0;

                    label = "In Progess";

                    validFor = "<null>";

                    value = "In Progess";

                },

                                {

                    active = 1;

                    defaultValue = 0;

                    label = Completed;

                    validFor = "<null>";

                    value = Completed;

                },

                                {

                    active = 1;

                    defaultValue = 0;

                    label = "Waiting on someone else";

                    validFor = "<null>";

                    value = "Waiting on someone else";

                },

                                {

                    active = 1;

                    defaultValue = 0;

                    label = Diferred;

                    validFor = "<null>";

                    value = Diferred;

                }

            );

            precision = 0;

            referenceTo =             (

            );

            relationshipName = "<null>";

            relationshipOrder = "<null>";

            restrictedPicklist = 0;

            scale = 0;

            soapType = "xsd:string";

            sortable = 1;

            type = picklist;

            unique = 0;

            updateable = 1;

            writeRequiresMasterRead = 0;

       }

 

I see the Default Value in the picklist, but i don't see something that can tell you which value will close the Task.

 

Am i missing something?

 

Thanks !!

jhersh1jhersh1

In this case the picklist value you want is "Completed".

 

It doesn't look like the API returns which picklist values correspond to closed, but that's definitely visible (and adjustable) in the UI under Task Fields.

SoleesSolees

It seems that the only posible way its to retrieve the picklist values, en let the user update the record.  Because im updating an App that its used in different countries so i really can't send the picklist default close value.

 

Thanks man !!

SuperfellSuperfell

The TaskStatus SObject contains additional info about which status are mapped to a closed value, try running this query.

 

selectId, MasterLabel, SortOrder, IsDefault, IsClosedfromTaskStatus order by SortOrder

This was selected as the best answer
SoleesSolees

Simon Fell good day,

 

first of all i'm honored that you anwsered my question, i'm a huge fan from mexico since i use SoqlXplorer and i even follow you on twitter.

 

Your post is the right answer.

 

Thank a lot.

 

select Id, MasterLabel from TaskStatus where IsClosed = true