HomeRecipesAPI ReferenceChangelogDiscussions
Log In
Discussions

Discussions

Ask a Question
Back to All

Duplicate index value for procedure

Hello - I'm getting an error that is unclear to me. can you help me debug this? This is the request that I'm sending:

{
  "Command": {
    "WorkOrder": {
      "Priority": {
        "Id": 1
      },
      "CustomFields": [
        {
          "Descriptor": {
            "Id": 68
          },
          "Value": "visit scheduled"
        },
        {
          "Descriptor": {
            "Id": 63
          },
          "Value": "0"
        },
        {
          "Descriptor": {
            "Id": 45
          },
          "Value": "0"
        },
        {
          "Descriptor": {
            "Id": 7
          },
          "Value": ""
        },
        {
          "Descriptor": {
            "Id": 65
          },
          "Value": "example"
        },
        {
          "Descriptor": {
            "Id": 64
          },
          "Value": "Pending Scheduling Confirmation"
        },
        {
          "Descriptor": {
            "Id": 42
          },
          "Value": "0"
        },
        {
          "Descriptor": {
            "Id": 34
          },
          "Value": "example"
        }
      ],
      "ContactName": "SB",
      "ContactAddress": {
        "AddrTypeId": 17,
        "Address": "example"
      },
      "PoNumber": "po example",
      "Items": [
        {
          "Comment": "testing oven no power example.",
          "Task": {
            "Id": 14133
          },
          "Asset": {
            "Id": 93826
          }
        }
      ],
      "Procedures": [
        {
          "ProcedureTemplate": {
            "Id": 30
          },
          "Steps": [
            {
              "ProcedureTemplateStep": {
                "Id": 179
              },
              "TypeId": "Text"
            },
            {
              "ProcedureTemplateStep": {
                "Id": 155
              },
              "TypeId": "Text"
            },
            {
              "ProcedureTemplateStep": {
                "Id": 156
              },
              "TypeId": "Text"
            },
            {
              "ProcedureTemplateStep": {
                "Id": 157
              },
              "TypeId": "Text"
            },
            {
              "ProcedureTemplateStep": {
                "Id": 159
              },
              "TypeId": "Text"
            },
            {
              "ProcedureTemplateStep": {
                "Id": 158
              },
              "TypeId": "Text"
            },
            {
              "ProcedureTemplateStep": {
                "Id": 160
              },
              "TypeId": "Text"
            },
            {
              "ProcedureTemplateStep": {
                "Id": 161
              },
              "TypeId": "Text"
            },
            {
              "ProcedureTemplateStep": {
                "Id": 164
              },
              "TypeId": "Text"
            },
            {
              "ProcedureTemplateStep": {
                "Id": 178
              },
              "TypeId": "Text"
            },
            {
              "ProcedureTemplateStep": {
                "Id": 226
              },
              "TypeId": "Text"
            }
          ]
        }
      ],
      "TypeCategory": "Request",
      "SubType": {
        "Id": 259
      },
      "Documents": [
        {
          "Title": "10016.jpeg",
          "StorageTypeId": "Cloud",
          "IsShared": false,
          "IsPublic": false,
          "DocType": {
            "DisplayAs": "Misc"
          },
          "Blob": {
            "Body": "",
            "FileName": "10016.jpeg"
          }
        }
      ],
      "Customer": {
        "Id": 3515
      },
      "Owner": {
        "Id": 420
      },
      "WorkOrderCost": {
        "Contract": {
          "Id": 1
        },
        "BillingAccount": {
          "Id": 1
        },
        "BillToOption": {
          "Id": 1
        },
        "BillingRule": "ServiceFee",
        "CustomerNte": {
          "CurrencyTypeId": "USD",
          "Value": 800.0
        }
      }
    },
    "ComputeSchedule": true,
    "ComputeAssignment": false,
    "EmployeeId": 153,
    "SkipBillToLogic": true
  }
}

This is the response I got:

Failed to make API request to {baseurl}/api/v1/cmd/Workorder/Create, response: {"ErrorMessage":"Duplicate index value detected for {!{Procedure}!} #315793 ","ErrorCode":"BUSINESS_LOGIC_ERROR","TimeStamp":"2024-11-05T23:49:35.9043392Z"}


Can you help me figure out what to change about this request to not run into this error?