Create maintenance work orders using a user-defined action

post

/fscmRestApi/resources/11.13.18.05/maintenanceWorkOrders/action/createConditionBasedWorkOrders

Creates work orders based on a matching condition code defined in a work requirement of a maintenance program. The code may be defined in one or more work requirements within or across maintenance programs. A unique work order is created based on each matching work requirement. Each unique work order is comprised of one or more work definitions defined in a work requirement. If there is no matching condition code, then a single work order is created with only a default operation.

Request

Header Parameters
  • If the REST API supports runtime customizations, the shape of the service may change during runtime. The REST client may isolate itself from these changes or choose to interact with the latest version of the API by specifying this header. For example: Metadata-Context:sandbox="TrackEmployeeFeature".
  • The protocol version between a REST client and service. If the client does not specify this header in the request the server will pick a default version for the API.
Supported Media Types
Request Body - application/vnd.oracle.adf.action+json ()
Root Schema : schema
Type: object
Show Source
  • Number that identifies the asset for which a work order is created.
  • Abbreviation that identifies the user-defined condition code that's referenced within a work requirement in a maintenance program.
  • Number that identifies the document that's referenced to the work order. Examples are IoT incident number and work request number.
  • Abbreviation that uniquely identifies the type of document reference in the document number attribute. A list of accepted values is defined in the lookup type ORA_CSE_DOCUMENT_TYPE.
  • Abbreviation that identifies the maintenance-enabled organization a work order will be created.
  • Value that uniquely identifies the maintenance-enabled organization a work order will be created in.
  • Date when the work order is scheduled to complete. You must provide the planned start date or the planned completion date to create the work order. The default value is the system date.
  • Date when the work order is scheduled to start. You must provide the planned start date or the planned completion date to create the work order. The default value is the system date.
  • Description of the work order. This is the text entered by the user, which briefly describes the work to be performed. This attribute is optional for creating a work order.
  • Abbreviation that identifies the subtype of a maintenance work order created based on a condition code. Valid value is ORA_CONDITION_BASED.
  • Abbreviation that identifies the type of a maintenance work order. Valid values are CORRECTIVE and PREVENTATIVE.
Back to Top

Response

Supported Media Types

Default Response

The following table describes the default response for this task.
Body ()
Root Schema : schema
Type: object
Show Source
Back to Top

Examples

This example describes how to create one or more work orders.

Example cURL Command

Use the following cURL command to submit a request on the REST resource.

curl -u username:password -X POST -H "Content-Type:application/vnd.oracle.adf.action+json" -d 'request payload' 
"https://servername/fscmRestApi/resources/version/maintenanceWorkOrders"

Example 1 Request Body

The following example includes the contents of the request body in JSON format to create work orders based on a matching condition code defined in a work requirement of a maintenance program. You replace the request payload in the cURL command with the contents of the Example Request Body. The request payload specifies attribute values that the command will use in the record that it creates.

{
	"name": "createConditionBasedWorkOrders",
	"parameters": [
	{
		"workOrderTypeCode":"CORRECTIVE"
	},
	{
		"workOrderSubTypeCode":"ORA_CONDITION_BASED"
	},
	{
		"assetNumber":"ENGINE-ASSET-01"
	},
	{
		"organizationCode":"M1"
	},       
	{
		"conditionCode":"OIL-LEAK,OVER-HEATING"
	}
	]
}

Example 1 Response Body

The following example includes the contents of the response body in JSON format:

Work Order ID : WorkOrderID1,WorkOrderID2

Example 2 Request Body

The following example includes the contents of the request body in JSON format to create one work order with only a default operation if there is no matching condition code. You replace the request payload in the cURL command with the contents of the Example Request Body. The request payload specifies attribute values that the command will use in the record that it creates.

{
	"name": "createConditionBasedWorkOrders",
	"parameters": [
	{
		"workOrderTypeCode":"CORRECTIVE"
	},
	{
		"workOrderSubTypeCode":"ORA_CONDITION_BASED"
	},
	{
		"assetNumber":"ENGINE-ASSET-01"
	},
	{
		"organizationCode":"M1"
	},       
	{
		"conditionCode":"HIGH_PRESSURE
	}
]
}

Example 2 Response Body

The following example includes the contents of the response body in JSON format:

Work Order ID : WorkOrderID1

Example 3 Request Body

The following example includes the contents of the request body in JSON format to create one or more work orders based on a matching/no matching condition code with document reference (full payload).

Additional rules for the full payload:

  • Both plannedStartDate and plannedCompletionDate are optional.
    • If only plannedStartDate is provided then plannedEndDate is defaulted to plannedStartDate.
    • If only plannedEndDate is provided then plannedStartDate is defaulted to plannedEndDate.
    • If both are not provided, then they are defaulted to sysdate.
  • workOrderTypeCode can only be CORRECTIVE and workOrderSubTypeCode can only be ORA_CONDITION_BASED

You replace the request payload in the cURL command with the contents of the Example Request Body. The request payload specifies attribute values that the command will use in the record that it creates.

{
	"name"": "createConditionBasedWorkOrders",
		"parameters": [
		{
			"workOrderTypeCode": "CORRECTIVE"
		},
		{
			"workOrderSubTypeCode": "ORA_CONDITION_BASED"
		},
		{
			"assetNumber": "MNTCDRMASSET02"
		},
		{
			"organizationCode": "MNTALM"
		},
		{
			"conditionCode": "OIL-LEAK,OVER-HEATING"
		},
		{
			"workOrderDescription": "optional description"
		},
		{
			"plannedStartDate":"2020-08-01 12:00:00"
		},
		{
			"plannedCompletionDate":"2020-08-02 12:00:00"
		},
		{
			"documentType" :"ORA_IOT_INCIDENT"
		},
		{
			"documentNumber":"1234"
		}
		]
	}
	

Example 3 Response Body

The following example includes the contents of the response body in JSON format:

	Work Order ID : WorkOrderID1,WorkOrderID2
	
Back to Top