I am new to using Finance & Operations and the api for it. I have a been able to explore the odata API following the
instructions for Postman. For a client, I need to automatically create sales orders and line items from within our nodejs application.
const salesOrder = { InvoiceCustomerAccountNumber: 'W253437', OrderingCustomerAccountNumber: 'W253437', RequestedShippingDate: '2023-08-01T10:10:10Z'};
const response = await client.fetch('/data/SalesOrderHeadersV2', { method: 'POST', body: JSON.stringify(salesOrder)});
The client class just adds the Authorization header and the host to the request.
The response shows the following issues:
Write failed for table row of type 'SalesOrderHeaderV2Entity'. Infolog: Warning: The value 'DAT-000020' in field 'Sales order' is not found in the related table 'Sales order purchase order link'.; Warning: validateField failed on field 'SalesOrderHeaderV2Entity.SalesOrderNumber'; Warning: The value 'W253437' in field 'Customer account' is not found in the related table 'Customers'.; Warning: validateField failed on field 'SalesOrderHeaderV2Entity.OrderingCustomerAccountNumber'; Warning: The value 'W253437' in field 'Invoice account' is not found in the related table 'Customers'.; Warning: validateField failed on field 'SalesOrderHeaderV2Entity.InvoiceCustomerAccountNumber'.
I'm not sure about any of these issues:
It seems like the SalesOrderNumber field is being autogenerated fine, why is it looking in a 'Sales order purchase order link' table as if it is a foreign key?
The query /data/Customers?$filter=CustomerAccount eq 'W253437' returns a customer for me, so why can it not be found when I make a post?
Some additional context, our client created a sandbox for me to test in to prove the integration prior to using their production system. I'm not sure exactly what he did, but it kind of looks like he created a snapshot from their production system and put it in the sandbox. Is it possible that some indexes are not properly set up, causing this issue?
thanks in advance