HomeRecipesAPI ReferenceChangelogDiscussions
Log In
Discussions

Discussions

Ask a Question
Back to All

Get WOs that are not Picked Up from WorkOrder API

Hi,

I am using "/api/v1/query/WorkOrder" to filter WOs that have not been Picked Up yet. The only way that I found is to filter the ActionLogRecords. However, since ActionLogRecords returns an array of the various actions for each WO i am unsure how to filter them out.

A sample request body that i tried and failed is as below -

{
"QueryExpression": {
"Criteria": {
"Conditions": [
{
"PropertyName": "Filter1",
"Operator": "Equal",
"Values": ["a"]
},
{
"PropertyName": "Filter2",
"Operator": "Equal",
"Values": ["a"]
}
],
"FilterOperator": "or",
"Filters": [
{
"Conditions": [
{
"PropertyName": "ActionLogRecords.TypeId",
"Operator": "NotIn",
"Values": [ "PickUp"]
}
]
}
]
},
"Distinct": true,
"PropertySet": { "Properties": ["", "ActionLogRecords."] },
"Count": 1000,
"FirstResultIndex": 0
}
}


This is a sample WO


{
"Data": {
"Number": "aaaaaa",
"TypeCategory": "Request",
"WorkOrderCost": {
"Id": 24543
},
"Priority": {
"DisplayAs": "xyz",
"IsEmergency": true,
"AcknowledgeInMinutes": 60,
"RespondInMinutes": 120,
"DueInMinutes": 240,
"Id": 5
},
"StatusId": "New",
"Access": "NotApplicable",
"MainAsset": {
"Id": 43534
},
"ShortLocation": "aa",
"TaskRefinement": "aaaa",
"WorkZone": {
"Id": 2345
},
"Employee": {
"Id": 2345
},
"Duration": 0,
"VendorNte": {
"CurrencyTypeId": "USD",
"Value": 0.0000
},
"Specialty": {
"Id": 3425
},
"PoNumber": "",
"SubType": {
"Id": 234
},
"Customer": {
"Id": 2345
},
"ContactName": "",
"WonId": 0,
"IsWarranty": false,
"FlagId": 0,
"TimeZone": 20,
"CurrencyTypeId": "USD",
"LastActionDate": "datetime",
"DtCreated": "datetime",
"DtDue": "datetime",
"DtAcknowledgeBy": "datetime",
"AcknowledgeByUtc": "datetime",
"LastActionDateUtc": "datetime",
"CreatedDateUtc": "datetime2",
"DueDateUtc": "datetime2",
"DtOnSiteBy": "datetime",
"DtUtcOnSiteBy": "datetime",
"LastAction": {
"Id": 2345
},
"ActionLogRecords": [
{
"WorkOrderId": 3456,
"TypeId": "Create",
"Actor": {
"Id": 123,
"TypeId": "Employee"
},
"ActionDate": "datetime",
"Comment": "",
"ActionReasonId": 0,
"IsBackDate": false,
"UiTypeId": "Corp",
"TimeZone": 20,
"SystemDateUtc": "datetime",
"ObjectId": 0,
"Id": 3546
} ,

                {
                    "WorkOrderId": 3456,
                    "TypeId": "PickUp",
                    "Actor": {
                        "Id": 123,
                        "TypeId": "Employee"
                    },
                    "ActionDate": "datetime",
                    "Comment": "",
                    "ActionReasonId": 0,
                    "IsBackDate": false,
                    "UiTypeId": "Corp",
                    "TimeZone": 20,
                    "SystemDateUtc": "datetime",
                    "ObjectId": 0,
                    "Id": 3546
                } 
            ],
            "Owner": {
                "Id": 35
            },
            "InductionAndSafetyStatusID": "NotRequired",
            "Flags": [],
            "ConcurrencyId": 1,
            "Id": 3456
        }
    }