{"revision":"c10276e953456835cdbb1f3a60d58ae1980be353","document":{"id":863,"path":"api-reference/server-api-reference/OrderUtilScopedAPI.md","title":"OrderUtil - Scoped","bundle":null,"doc_type":null,"release":"australia","body":"\n# OrderUtil- Scoped\n\nThe OrderUtil script include enables you to view and retrieve order details.\n\nTo access the methods in this script include, use the `sn_ind_tmt_orm` namespace identifier. The Order Management \\(com.sn\\_ind\\_tmt\\_orm\\) plugin is required to access the OrderUtil script include.\n\n**Parent Topic:**[Server API reference](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/australia/api-reference/server-api-reference/api-server.md)\n\n## OrderUtil - OrderUtil\\(\\)\n\nCreates an instance of the OrderUtil class.\n\n|Name|Type|Description|\n|----|----|-----------|\n|None| | |\n\nThe following example shows how to instantiate an OrderUtil object called myOrder.\n\n```\nvar myOrder = new sn_ind_tmt_orm.OrderUtil();\n```\n\n## OrderUtil - getStateFromOrder\\(String orderSysId\\)\n\nGets the state of a specified order.\n\n|Name|Type|Description|\n|----|----|-----------|\n|orderSysId|String|The sys\\_id of the order located in the Customer Order \\[sn\\_ind\\_tmt\\_orm\\_order\\] table.|\n\n|Type|Description|\n|----|-----------|\n|String|Returns the state value from the order record. If there’s an issue with getting the order record or there’s no order sys\\_id passed, then the method returns null.|\n\nThe following example shows how to get the state value of a specified order.\n\n```\nvar orderId = \"<order_sys_id>\"; // order sys_id, with state draft\nvar state = new sn_ind_tmt_orm.OrderUtil().getStateFromOrder(orderId);\ngs.info(state);\n```\n\nOutput:\n\n```\ndraft\n```\n\n## OrderUtil - isOrderInDraftState\\(String orderSysId\\)\n\nReturns whether the state of a specified order is in draft state.\n\n|Name|Type|Description|\n|----|----|-----------|\n|orderSysId|String|The sys\\_id of the order located in the Customer Order \\[sn\\_ind\\_tmt\\_orm\\_order\\] table.|\n\n<table id=\"table_tcg_csh_b2c\" class=\"returns\"><thead><tr><th>\n\nType\n\n</th><th>\n\nDescription\n\n</th></tr></thead><tbody><tr><td>\n\nBoolean\n\n</td><td>\n\nFlag that indicates whether the state of a specified order is in draft state.Valid values:\n\n-   true: The specified order is in draft state.\n-   false: The specified order is either not in draft state, there’s an issue retrieving the order record, or no sys\\_id was passed.\n\n</td></tr></tbody>\n</table>The following example shows how to determine a specified order is in draft state.\n\n```\nvar orderId = \"<order_sys_id>\"; // order sys_id, with state draft\nvar state = new sn_ind_tmt_orm.OrderUtil().isOrderInDraftState(orderId);\ngs.info(state);\n```\n\nOutput:\n\n```\ntrue\n```\n\n"}}