Create customer order in C# using REST service IDOs (SLCos and SLCoitems). SLCos order totals not updating.

I'm trying to create customer orders using REST web service calls to SLCos and SLCoitems IDOs. I can get both populated and return values indicate success. I also see the resulting data for both the header and the lines afterwards. The problem is that the insert of the SLCoitems records didn't update the header total values. The SLCoitems records also didn't get their item descriptions or costs automatically populated by the insert.

Any ideas? Things to try?

  • Is this for CSI? What does the REST POST command look like?

  • Yes, it is CSI.

    Url like:

    /IDORequestService/ido/update/SLCoitems?refresh=true

    With content like (only showing one line, but rest look similar):

    {
        "Changes": [
            {
                "ItemID": "PBT=[SLCoitems]",
                "Action": 1,
                "UseOptimisticLocking": true,
                "ItemNumber": -2147483648,
                "XmlItemNumber": null,
                "InsertIfNotFound": false,
                "XmlActionName": "Insert",
                "XmlUseKeysFlag": null,
                "XmlInsertIfNotFound": null,
                "UpdateLocking": 1,
                "XmlUpdateLocking": "Property",
                "Properties": [
                    {
                        "Name": "CoNum",
                        "Modified": true,
                        "Protected": false,
                        "OriginalValue": null,
                        "Value": "H000000013",
                        "XmlModifiedFlag": null,
                        "XmlProtectedFlag": null,
                        "IsNull": false,
                        "AdditionalAttributeNames": [],
                        "XmlAdditionalAttributes": null
                    },
                    {
                        "Name": "CoLine",
                        "Modified": true,
                        "Protected": false,
                        "OriginalValue": null,
                        "Value": "1",
                        "XmlModifiedFlag": null,
                        "XmlProtectedFlag": null,
                        "IsNull": false,
                        "AdditionalAttributeNames": [],
                        "XmlAdditionalAttributes": null
                    },
                    {
                        "Name": "SiteRef",
                        "Modified": true,
                        "Protected": false,
                        "OriginalValue": null,
                        "Value": "Default",
                        "XmlModifiedFlag": null,
                        "XmlProtectedFlag": null,
                        "IsNull": false,
                        "AdditionalAttributeNames": [],
                        "XmlAdditionalAttributes": null
                    },
                    {
                        "Name": "Item",
                        "Modified": true,
                        "Protected": false,
                        "OriginalValue": null,
                        "Value": "JRA-14286",
                        "XmlModifiedFlag": null,
                        "XmlProtectedFlag": null,
                        "IsNull": false,
                        "AdditionalAttributeNames": [],
                        "XmlAdditionalAttributes": null
                    },
                    {
                        "Name": "UM",
                        "Modified": true,
                        "Protected": false,
                        "OriginalValue": null,
                        "Value": "EA",
                        "XmlModifiedFlag": null,
                        "XmlProtectedFlag": null,
                        "IsNull": false,
                        "AdditionalAttributeNames": [],
                        "XmlAdditionalAttributes": null
                    },
                    {
                        "Name": "QtyOrdered",
                        "Modified": true,
                        "Protected": false,
                        "OriginalValue": null,
                        "Value": "2",
                        "XmlModifiedFlag": null,
                        "XmlProtectedFlag": null,
                        "IsNull": false,
                        "AdditionalAttributeNames": [],
                        "XmlAdditionalAttributes": null
                    },
                    {
                        "Name": "DerCurrCode",
                        "Modified": true,
                        "Protected": false,
                        "OriginalValue": null,
                        "Value": "USD",
                        "XmlModifiedFlag": null,
                        "XmlProtectedFlag": null,
                        "IsNull": false,
                        "AdditionalAttributeNames": [],
                        "XmlAdditionalAttributes": null
                    },
                    {
                        "Name": "DerCurrentDate",
                        "Modified": true,
                        "Protected": false,
                        "OriginalValue": null,
                        "Value": "20240415 09:50:28.943",
                        "XmlModifiedFlag": null,
                        "XmlProtectedFlag": null,
                        "IsNull": false,
                        "AdditionalAttributeNames": [],
                        "XmlAdditionalAttributes": null
                    },
                    {
                        "Name": "AdrCurrCode",
                        "Modified": true,
                        "Protected": false,
                        "OriginalValue": null,
                        "Value": "USD",
                        "XmlModifiedFlag": null,
                        "XmlProtectedFlag": null,
                        "IsNull": false,
                        "AdditionalAttributeNames": [],
                        "XmlAdditionalAttributes": null
                    },
                    {
                        "Name": "CoCoCustNum",
                        "Modified": true,
                        "Protected": false,
                        "OriginalValue": null,
                        "Value": "",
                        "XmlModifiedFlag": null,
                        "XmlProtectedFlag": null,
                        "IsNull": true,
                        "AdditionalAttributeNames": [],
                        "XmlAdditionalAttributes": null
                    },
                    {
                        "Name": "CoCustNum",
                        "Modified": true,
                        "Protected": false,
                        "OriginalValue": null,
                        "Value": "",
                        "XmlModifiedFlag": null,
                        "XmlProtectedFlag": null,
                        "IsNull": true,
                        "AdditionalAttributeNames": [],
                        "XmlAdditionalAttributes": null
                    },
                    {
                        "Name": "CoDisc",
                        "Modified": true,
                        "Protected": false,
                        "OriginalValue": null,
                        "Value": "0",
                        "XmlModifiedFlag": null,
                        "XmlProtectedFlag": null,
                        "IsNull": false,
                        "AdditionalAttributeNames": [],
                        "XmlAdditionalAttributes": null
                    },
                    {
                        "Name": "CoExchRate",
                        "Modified": true,
                        "Protected": false,
                        "OriginalValue": null,
                        "Value": "1",
                        "XmlModifiedFlag": null,
                        "XmlProtectedFlag": null,
                        "IsNull": false,
                        "AdditionalAttributeNames": [],
                        "XmlAdditionalAttributes": null
                    },
                    {
                        "Name": "CoOrderDate",
                        "Modified": true,
                        "Protected": false,
                        "OriginalValue": null,
                        "Value": "20240415 00:00:00.000",
                        "XmlModifiedFlag": null,
                        "XmlProtectedFlag": null,
                        "IsNull": false,
                        "AdditionalAttributeNames": [],
                        "XmlAdditionalAttributes": null
                    },
                    {
                        "Name": "CoType",
                        "Modified": true,
                        "Protected": false,
                        "OriginalValue": null,
                        "Value": "R",
                        "XmlModifiedFlag": null,
                        "XmlProtectedFlag": null,
                        "IsNull": false,
                        "AdditionalAttributeNames": [],
                        "XmlAdditionalAttributes": null
                    },
                    {
                        "Name": "CurDomPlaces",
                        "Modified": true,
                        "Protected": false,
                        "OriginalValue": null,
                        "Value": "2",
                        "XmlModifiedFlag": null,
                        "XmlProtectedFlag": null,
                        "IsNull": false,
                        "AdditionalAttributeNames": [],
                        "XmlAdditionalAttributes": null
                    },
                    {
                        "Name": "Price",
                        "Modified": true,
                        "Protected": false,
                        "OriginalValue": null,
                        "Value": "110.00",
                        "XmlModifiedFlag": null,
                        "XmlProtectedFlag": null,
                        "IsNull": false,
                        "AdditionalAttributeNames": [],
                        "XmlAdditionalAttributes": null
                    },
                    {
                        "Name": "PriceConv",
                        "Modified": true,
                        "Protected": false,
                        "OriginalValue": null,
                        "Value": "110.00",
                        "XmlModifiedFlag": null,
                        "XmlProtectedFlag": null,
                        "IsNull": false,
                        "AdditionalAttributeNames": [],
                        "XmlAdditionalAttributes": null
                    },
                    {
                        "Name": "RefType",
                        "Modified": true,
                        "Protected": false,
                        "OriginalValue": null,
                        "Value": "P",
                        "XmlModifiedFlag": null,
                        "XmlProtectedFlag": null,
                        "IsNull": false,
                        "AdditionalAttributeNames": [],
                        "XmlAdditionalAttributes": null
                    },
                    {
                        "Name": "Stat",
                        "Modified": true,
                        "Protected": false,
                        "OriginalValue": null,
                        "Value": "P",
                        "XmlModifiedFlag": null,
                        "XmlProtectedFlag": null,
                        "IsNull": false,
                        "AdditionalAttributeNames": [],
                        "XmlAdditionalAttributes": null
                    },
                    {
                        "Name": "QtyOrderedConv",
                        "Modified": true,
                        "Protected": false,
                        "OriginalValue": null,
                        "Value": "2",
                        "XmlModifiedFlag": null,
                        "XmlProtectedFlag": null,
                        "IsNull": false,
                        "AdditionalAttributeNames": [],
                        "XmlAdditionalAttributes": null
                    },
                    {
                        "Name": "Whse",
                        "Modified": true,
                        "Protected": false,
                        "OriginalValue": null,
                        "Value": "EAST",
                        "XmlModifiedFlag": null,
                        "XmlProtectedFlag": null,
                        "IsNull": false,
                        "AdditionalAttributeNames": [],
                        "XmlAdditionalAttributes": null
                    },
                    {
                        "Name": "CoOrigSite",
                        "Modified": true,
                        "Protected": false,
                        "OriginalValue": null,
                        "Value": "DEFAULT",
                        "XmlModifiedFlag": null,
                        "XmlProtectedFlag": null,
                        "IsNull": false,
                        "AdditionalAttributeNames": [],
                        "XmlAdditionalAttributes": null
                    },
                    {
                        "Name": "DueDate",
                        "Modified": true,
                        "Protected": false,
                        "OriginalValue": null,
                        "Value": "20240415 00:00:00.000",
                        "XmlModifiedFlag": null,
                        "XmlProtectedFlag": null,
                        "IsNull": false,
                        "AdditionalAttributeNames": [],
                        "XmlAdditionalAttributes": null
                    }
                ],
                "HasItemNumber": false,
                "SerializationElements": [
                    {
                        "Property": {
                            "@Name": "CoNum",
                            "#text": "H000000013"
                        }
                    },
                    {
                        "Property": {
                            "@Name": "CoLine",
                            "#text": "1"
                        }
                    },
                    {
                        "Property": {
                            "@Name": "SiteRef",
                            "#text": "Default"
                        }
                    },
                    {
                        "Property": {
                            "@Name": "Item",
                            "#text": "JRA-14286"
                        }
                    },
                    {
                        "Property": {
                            "@Name": "UM",
                            "#text": "EA"
                        }
                    },
                    {
                        "Property": {
                            "@Name": "QtyOrdered",
                            "#text": "2"
                        }
                    },
                    {
                        "Property": {
                            "@Name": "DerCurrCode",
                            "#text": "USD"
                        }
                    },
                    {
                        "Property": {
                            "@Name": "DerCurrentDate",
                            "#text": "20240415 09:50:28.943"
                        }
                    },
                    {
                        "Property": {
                            "@Name": "AdrCurrCode",
                            "#text": "USD"
                        }
                    },
                    {
                        "Property": {
                            "@Name": "CoCoCustNum"
                        }
                    },
                    {
                        "Property": {
                            "@Name": "CoCustNum"
                        }
                    },
                    {
                        "Property": {
                            "@Name": "CoDisc",
                            "#text": "0"
                        }
                    },
                    {
                        "Property": {
                            "@Name": "CoExchRate",
                            "#text": "1"
                        }
                    },
                    {
                        "Property": {
                            "@Name": "CoOrderDate",
                            "#text": "20240415 00:00:00.000"
                        }
                    },
                    {
                        "Property": {
                            "@Name": "CoType",
                            "#text": "R"
                        }
                    },
                    {
                        "Property": {
                            "@Name": "CurDomPlaces",
                            "#text": "2"
                        }
                    },
                    {
                        "Property": {
                            "@Name": "Price",
                            "#text": "110.00"
                        }
                    },
                    {
                        "Property": {
                            "@Name": "PriceConv",
                            "#text": "110.00"
                        }
                    },
                    {
                        "Property": {
                            "@Name": "RefType",
                            "#text": "P"
                        }
                    },
                    {
                        "Property": {
                            "@Name": "Stat",
                            "#text": "P"
                        }
                    },
                    {
                        "Property": {
                            "@Name": "QtyOrderedConv",
                            "#text": "2"
                        }
                    },
                    {
                        "Property": {
                            "@Name": "Whse",
                            "#text": "EAST"
                        }
                    },
                    {
                        "Property": {
                            "@Name": "CoOrigSite",
                            "#text": "DEFAULT"
                        }
                    },
                    {
                        "Property": {
                            "@Name": "DueDate",
                            "#text": "20240415 00:00:00.000"
                        }
                    }
                ],
                "NestedUpdates": [],
                "IsSuspendFlagUpdateItem": false
            }
        ]
    }
  • Hmm.... Does the account you are connecting with have Insert/Update permissions for the IDO/Object in question?

  • Yes, both the SLCos and SLCoitems records are getting created and calls return successful status. The order totals are not updated and the line item descriptions and costs are not pulled in.

  • This sounds like expected behavior to me, you'll have to do calls to figure out the missing properties and include them before saving, and/or update counts or call the appropriate IDO methods after the save completes.

    Similar experiences have taught me that it is likely that the form is doing extra work that isn't being done in your calls or there is a property missing that prevents a join to the table bound to the properties that are in concern.


    Investigate the corresponding forms (Customer Order Lines or Customer Order Releases) and the IDO definitions. 

    Some questions to ask are:

    On corresponding forms,
    Do those properties get set via form event handlers while a user enters data before the save happens?
    Do the forms have SaveCompleted form event handlers or something similar to update the counts on the corresponding CO once a save completes?
    Double-check the IDO definitions, review the table tab, are you populating all the properties that are necessary to join to the table that has the bound properties you need? 

  • Potential culprit in the CoItems IDO is method SumCoSp

  • Leon thank you for your answer.

    I certainly hope that is not the expected behavior. If something is missing the REST API ought to respond back that something is missing and REST API ought to also take care of parent updates to the customer order header.

    I've been spoiled by years of work with Netsuite's REST services. They are sometimes pain to work with too, but they at least let you create a complete order (header and lines) in a single call (single transaction) and manages all the business logic of pulling in reference data and handling calculations of totals, etc.

    I'll keep looking Slight smile

  • Rees,

    I'll search for information on that. Are you saying that we may be missing SumCoSp from our SLCoitems or that I need to make a separate call after I insert the lines to that SumCoSp method?

  • SumCoSp is a standard method.  I very much hope it isn't missing in your environment.

    If Leon is correct and I suspect he may be, you'll need to Invoke this method and then make an Update call to SLCos.  It's the sort of logic I would hitherto have expected a table trigger to have taken care of, but with Infor intent on eliminating as much SQL code as possible, the function could well have moved into the form logic.

    The method takes the CoNum as the only input parameter and returns Price along with Infobar as Output parameters.  The Price property in SLCos is a bound property.

    Best of luck

  • For the total values to fill in I found you need these minimum properties filled in to the SLCoitems:

    CoNum
    CoLine
    Item
    UM
    QtyOrderedConv
    QtyOrdered
    PriceConv
    Cost
    CostConv
    Price
    ShipSite
    TaxCode1
    TaxCode2

    You shouldn't have to run any methods to update it.

    As for the description pretty sure you will have to look it up from the SLitems IDO and fill it in.

  • RCostello, Thank you I will give it a try.

  • RCostello,

    I was missing the item description and the cost numbers and added them. The manually created orders didn't have taxcode1 and taxcode2 set, but I tried that as well.

    Then my fun started. Initially I didn't see a ShipSite attribute in the SLCoitems IDO, so was going in circles on finding way to set it. Eventually I decided to just set ShipSite. Bingo it worked!!! I also found it in the IDO definition after that.

    Thank you very much for your list.

    Odd that Infor doesn't respond with an error message if you are not passing it required fields Disappointed