You need to sign in to do that
Don't have an account?
DeVerl Stokes
Creating a case with the rest API always sets Closed (IsClosed) to true (1)
I am using the rest API to create a new case. Nearly everything is working correctly, except that new cases are always created with Closed (IsClosed) set to true (1).
If I try to set Closed, I get INVALID_FIELD:
"body": "[{\"message\":\"No such column 'Closed' on sobject of type Case\",\"errorCode\":\"INVALID_FIELD\"}]"
If I try to set IsClosed, I get INVALID_FIELD_FOR_INSERT_UPDATE:
"body": "[{\"message\":\"Unable to create\/update fields: IsClosed. Please check the security settings of this field and verify that it is read\/write for your profile or permission set.\",\"errorCode\":\"INVALID_FIELD_FOR_INSERT_UPDATE\",\"fields\":[\"IsClosed\"]}]"
If I do a describe on the Case object, the result includes this (IsClosed):
[18] => Array
(
[aggregatable] =>
[autoNumber] =>
[byteLength] => 0
[calculated] =>
[calculatedFormula] =>
[cascadeDelete] =>
[caseSensitive] =>
[controllerName] =>
[createable] =>
[custom] =>
[defaultValue] =>
[defaultValueFormula] =>
[defaultedOnCreate] => 1
[dependentPicklist] =>
[deprecatedAndHidden] =>
[digits] => 0
[displayLocationInDecimal] =>
[encrypted] =>
[externalId] =>
[extraTypeInfo] =>
[filterable] => 1
[filteredLookupInfo] =>
[groupable] => 1
[highScaleNumber] =>
[htmlFormatted] =>
[idLookup] =>
[inlineHelpText] =>
[label] => Closed
[length] => 0
[mask] =>
[maskType] =>
[name] => IsClosed
[nameField] =>
[namePointing] =>
[nillable] =>
[permissionable] =>
[picklistValues] => Array
(
)
[precision] => 0
[queryByDistance] =>
[referenceTargetField] =>
[referenceTo] => Array
(
)
[relationshipName] =>
[relationshipOrder] =>
[restrictedDelete] =>
[restrictedPicklist] =>
[scale] => 0
[soapType] => xsd:boolean
[sortable] => 1
[type] => boolean
[unique] =>
[updateable] =>
[writeRequiresMasterRead] =>
)
Further, if I go to the web interface and try change the value of the Status field from Closed to New, it shows up as changed (red text), but reverts when I press the Save button.
Any tips on how to create a new case, using the rest API, with a status of "New" and without setting Closed (or IsClosed)?
If I try to set Closed, I get INVALID_FIELD:
"body": "[{\"message\":\"No such column 'Closed' on sobject of type Case\",\"errorCode\":\"INVALID_FIELD\"}]"
If I try to set IsClosed, I get INVALID_FIELD_FOR_INSERT_UPDATE:
"body": "[{\"message\":\"Unable to create\/update fields: IsClosed. Please check the security settings of this field and verify that it is read\/write for your profile or permission set.\",\"errorCode\":\"INVALID_FIELD_FOR_INSERT_UPDATE\",\"fields\":[\"IsClosed\"]}]"
If I do a describe on the Case object, the result includes this (IsClosed):
[18] => Array
(
[aggregatable] =>
[autoNumber] =>
[byteLength] => 0
[calculated] =>
[calculatedFormula] =>
[cascadeDelete] =>
[caseSensitive] =>
[controllerName] =>
[createable] =>
[custom] =>
[defaultValue] =>
[defaultValueFormula] =>
[defaultedOnCreate] => 1
[dependentPicklist] =>
[deprecatedAndHidden] =>
[digits] => 0
[displayLocationInDecimal] =>
[encrypted] =>
[externalId] =>
[extraTypeInfo] =>
[filterable] => 1
[filteredLookupInfo] =>
[groupable] => 1
[highScaleNumber] =>
[htmlFormatted] =>
[idLookup] =>
[inlineHelpText] =>
[label] => Closed
[length] => 0
[mask] =>
[maskType] =>
[name] => IsClosed
[nameField] =>
[namePointing] =>
[nillable] =>
[permissionable] =>
[picklistValues] => Array
(
)
[precision] => 0
[queryByDistance] =>
[referenceTargetField] =>
[referenceTo] => Array
(
)
[relationshipName] =>
[relationshipOrder] =>
[restrictedDelete] =>
[restrictedPicklist] =>
[scale] => 0
[soapType] => xsd:boolean
[sortable] => 1
[type] => boolean
[unique] =>
[updateable] =>
[writeRequiresMasterRead] =>
)
Further, if I go to the web interface and try change the value of the Status field from Closed to New, it shows up as changed (red text), but reverts when I press the Save button.
Any tips on how to create a new case, using the rest API, with a status of "New" and without setting Closed (or IsClosed)?
All Answers
Thanks Chris,
I am trying to set the Status field to "New", but new cases are showing up as "Closed". Here is a sample of the JSON data I am posting (some of the data replaced with "###"):
{"Type":"Feature Request","Origin":"Web","Status":"New","Subject”:”###“,”SuppliedName”:”###”,”SuppliedEmail”:”###”,”Description”:”###”}
Origin is correctly being set to "Web" in new cases, but Status is always "Closed".
> If you look at the values in the status field, you can see which one will mark a case as closed, and which ones will mark it as not closed.
I am not following this statement. When I do a describe on the Case object, it includes the followng description of the Status field:
[12] => Array
(
[aggregatable] => 1
[autoNumber] =>
[byteLength] => 120
[calculated] =>
[calculatedFormula] =>
[cascadeDelete] =>
[caseSensitive] =>
[controllerName] =>
[createable] => 1
[custom] =>
[defaultValue] => New
[defaultValueFormula] =>
[defaultedOnCreate] => 1
[dependentPicklist] =>
[deprecatedAndHidden] =>
[digits] => 0
[displayLocationInDecimal] =>
[encrypted] =>
[externalId] =>
[extraTypeInfo] =>
[filterable] => 1
[filteredLookupInfo] =>
[groupable] => 1
[highScaleNumber] =>
[htmlFormatted] =>
[idLookup] =>
[inlineHelpText] =>
[label] => Status
[length] => 40
[mask] =>
[maskType] =>
[name] => Status
[nameField] =>
[namePointing] =>
[nillable] => 1
[permissionable] =>
[picklistValues] => Array
(
[0] => Array
(
[active] => 1
[defaultValue] =>
[label] => On Hold
[validFor] =>
[value] => On Hold
)
[1] => Array
(
[active] => 1
[defaultValue] =>
[label] => Escalated
[validFor] =>
[value] => Escalated
)
[2] => Array
(
[active] => 1
[defaultValue] =>
[label] => Closed
[validFor] =>
[value] => Closed
)
[3] => Array
(
[active] => 1
[defaultValue] => 1
[label] => New
[validFor] =>
[value] => New
)
)
[precision] => 0
[queryByDistance] =>
[referenceTargetField] =>
[referenceTo] => Array
(
)
[relationshipName] =>
[relationshipOrder] =>
[restrictedDelete] =>
[restrictedPicklist] =>
[scale] => 0
[soapType] => xsd:string
[sortable] => 1
[type] => picklist
[unique] =>
[updateable] => 1
[writeRequiresMasterRead] =>
)