What are the values of SC_TASK "State"?

SN_2023
Tera Contributor

Hi,

I am updating the Service Catalog TASKS from Excel 2019 (64 bit) using REST API. I am able to do updates. But I am facing some difficulties in updating "State" field. I like to know how to supply the values to the "State" field. Should we send as Integer format or as string format?

0 - Pending

1 - Open

2 - Work In Progress

3 - Closed Complete

4 - Closed InComplete

5 - Closed Skipped

 

I see the list values in the combo box of State field as above (only strings not numbers). Should I sent as Numbers as 0, 1, 2, etc or should I send as String like "Open", Work In Progress", etc. Is String a case sensitive?

 

Where to find the "State" Values?

 

Kindly help me to resolve this issue.

 

Thank you all.

2 ACCEPTED SOLUTIONS

Prince Arora
Tera Sage
Tera Sage

@SN_2023 

 

You need to send the integer values, for checking the backend values of state just right click on state field on the form and click on "show choice lists"

 

PrinceArora_0-1696865502108.png

PrinceArora_1-1696865596123.png

 

Note: Please check the state values at your instance, might be someone has updated it

 

If my answer solved your issue, please mark my answer as  Correct & 👍Helpful based on the Impact.

 

 

 

 

View solution in original post

Sandeep Rajput
Tera Patron
Tera Patron

@SN_2023 Here are the values for the state field.

Screenshot 2023-10-09 at 9.08.50 PM.png

Also, you can find the state values using the following steps.

1. Right click on the state field and choose config dictionary.

Screenshot 2023-10-09 at 9.06.12 PM.pngScreenshot 2023-10-09 at 9.07.00 PM.png

On the list, apply the filter Element is state and table is task (SC task inherits from task table)

Screenshot 2023-10-09 at 9.11.31 PM.png

Hope this helps.

View solution in original post

7 REPLIES 7

Thank you. Issue resolved.

Danish Bhairag2
Tera Sage
Tera Sage

Hi @SN_2023 ,

 

When updating the "State" field of Service Catalog tasks using the REST API, you should send the values as strings, not integers. The strings should match the display values in the combo box exactly. String comparisons are generally case-sensitive in most programming contexts, so you need to send the correct string values with the appropriate casing.

 

In your case, you should send the following string values for the "State" field:

 

- "Pending"

- "Open"

- "Work In Progress"

- "Closed Complete"

- "Closed InComplete"

- "Closed Skipped"

 

Ensure that you send these values as strings in the REST API request payload. For example, if you are sending a JSON payload, it might look like this:

 

 

{

    "State": "Open",

    // other fields and their values

}

 

 

To find the valid values for the "State" field, you can check the Service Catalog task table in ServiceNow. Follow these steps:

 

1. **Log in to your ServiceNow instance.**

2. **Navigate to the Service Catalog Task Table:**

   - For classic UI, go to "Service Catalog" > "Catalog Tasks".

   - For the new UI, go to "Service Catalog" > "Catalog Tasks".

3. **Click on the "State" field in a task record to view the available options.**

   - Here, you'll see the exact strings that should be used when updating the "State" field through the REST API.

 

Always refer to the actual values available in your specific ServiceNow instance, as they can be customized. Sending the values as strings matching the display values ensures accurate updates to the "State" field in Service Catalog tasks.

 

Mark my answer helpful & accepted if it helps you resolve your issue

 

Thanks,

Danish

Hi danish,

I am able to supply the values for "State" field only in Number format. If I send the value as String, the TASK becomes "Closed Complete" automatically irrespective of any given value. 

 

I saw the "State" value type. It says as "Integer" Type.

 

Thank you for your response.