Discussions

Ask a Question
Back to All

Finding All Flags on a WO

Is it possible to see all flags on a WO via the query/WorkOrder?

Since a WO can have multiple flags, I was expecting to see a list of all flag IDs on a WO. But when running the following:

wo_query_url = base_url+'api/v1/query/WorkOrder'

Post Request

wo_query_payload = {'QueryExpression': {
'Criteria': {
'Conditions': [
{
'PropertyName': 'Id',
'Operator': 'Equal',
'Values': [1148305]
}
],
'FilterOperator': 'And'
},
'PropertySet': {'Properties': ['*']}
}
}

I only see 1 FlagId, even thought he WO has multiple flags on it.
I tried expanding the Flag by using 'Flag.*' in the PropertySet, but it only provided information on the 1 flag that was being returned, not all flags.

My second thought was to just do a query and see if it would return WOs with a specific FlagId. Running the following:

wo_query_url = base_url+'api/v1/query/WorkOrder'

Post Request

wo_query_payload = {'QueryExpression': {
'Criteria': {
'Conditions': [
{
'PropertyName': 'FlagId',
'Operator': 'Equal',
'Values': [3369]
}
],
'FilterOperator': 'And'
},
'PropertySet': {'Properties': ['*']}
}
}

When running the above, I get the following error:

{'ErrorMessage': "Condition value type 'System.Int64' for 'FlagId' property is not valid for this operation.",
'ErrorCode': 'BUSINESS_LOGIC_ERROR',
'TimeStamp': '2022-08-30T16:33:05.2046117Z'}

I thought the Flag ID was an int value, but I must be doing something wrong here.
Is my thought correct, if a WO had multiple flags, say ID 3369 and 3370. If via the first query was only returning flag ID 3369 on the query. If I was able to do a query for flag 3370, would the work order show up? I would expect it to, but I can't get the flag query to work.