Developer Q&A

Ask a Question
Back to All

Data was already modified by another user

Hi!

While creating a new WO using WoCreateCommand, we are getting this error:

"Data was already modified by another user"

We've made sure to assign a ConcurrencyId=1 both to the Work Order object and to each WoItem.

Any suggestion?

Thank you,

Juan

The object:

{
"Number": null,
"TypeCategory": 4,
"WorkOrderCost": null,
"Priority": {
"Id": 3
},
"StatusId": 7,
"RequestorContact": null,
"Access": 0,
"MainAsset": {
"Id": 1307026
},
"ShortLocation": "EDITED FOR CONFIDENTIALITY",
"TaskRefinement": "",
"WorkZone": {
"Id": 17
},
"Employee": {
"Id": 16
},
"Duration": 0,
"VendorNte": {
"CurrencyTypeId": 16,
"Value": 0.00
},
"Specialty": {
"Id": 10018
},
"PoNumber": "EDITED FOR CONFIDENTIALITY",
"SubType": {
"Id": 260
},
"RepairCode": null,
"Customer": {
"Id": 504023
},
"ContactName": "",
"WonId": 0,
"IsWarranty": false,
"Flag": null,
"FlagId": 0,
"TimeZone": 0,
"CurrencyTypeId": 0,
"LastActionDate": "0001-01-01T00:00:00",
"DtCreated": "2021-12-04T23:14:44.49",
"DtScheduledStart": null,
"DtDue": null,
"DtAcknowledgeBy": null,
"AcknowledgeByUtc": null,
"LastActionDateUtc": "0001-01-01T00:00:00",
"CreatedDateUtc": "0001-01-01T00:00:00",
"ScheduledStartUtc": null,
"DueDateUtc": null,
"DtOnSiteBy": null,
"DtUtcOnSiteBy": null,
"LastAction": null,
"Address": null,
"Items": [{
"WorkOrderId": 0,
"SortOrderIdx": 0,
"Disposition": null,
"AssetLocation": null,
"Asset": {
"Id": 1309152
},
"Task": {
"Id": 24590
},
"Comment": "EDITED FOR CONFIDENTIALITY",
"ConcurrencyId": 1,
"Id": 0
}],
"EquipmentWorkedOn": null,
"Notes": null,
"CompletionNote": null,
"ContactAddress": {
"Id": 0
},
"Assignments": null,
"Procedures": null,
"Documents": null,
"CustomFields": null,
"Verifications": null,
"Quote": null,
"CheckInOuts": null,
"ActionLogRecords": null,
"Estimate": null,
"Owner": null,
"InductionAndSafetyStatusID": 0,
"Flags": null,
"ConcurrencyId": 1,
"Id": 0,
"PerformDeletion": false
}

        Dim command = New WoCreateCommand With {
            .WorkOrder = wo,
            .ComputeAssignment = False,
            .ComputeSchedule = False,
            .SkipBillToLogic = False
        }

        Dim response = TryCast(corrigoService.Execute(command), WoActionResponse)