Need help adding "packages" to Item Fulfillment records to allow CSRs to see which items were shipped out under which tracking numbers. I can instantiate an ItemFulfillment record and an ItemFulfillmentPackageList object but the ItemFulfillmentPackageList object is always null - can't figure out how to add ItemFulfillmentPackage objects to the collection. I've tried various methods to assign to the ItemFulfillmentPackageList object without luck. Creating an array of ItemFulfillmentPakage objects is the latest attempt. Here's the code I have.
foreach (DataRow dr in dt.Rows)
{
try
{
ItemFulfillment ifRecord = new ItemFulfillment();
ifRecord.packageList = new ItemFulfillmentPackageList();
ifRecord.internalId = dr["Item Fulfillment Internal ID"].ToString();
ItemFulfillmentPackage ifp = new ItemFulfillmentPackage();
ifp.packageDescr = dr["Package Description"].ToString();
ifp.packageTrackingNumber = dr["detail_tracking_information"].ToString();
ItemFulfillmentPackageList ifpl = new ItemFulfillmentPackageList();
Object[] objPackages = new Object[1];
objPackages[1] = ifp;
ifpl = (ItemFulfillmentPackageList)objPackages;
ifRecord.packageList = ifpl;
ifpl.replaceAll = false;
WriteResponse res = _service.update(ifRecord);
if (res.status.isSuccess)
{
;
}
else if (res.status.isSuccessSpecified)
{
;
}
else
displayError(res.status.statusDetail);
}
catch (Exception ex)
{
_logger.error(String.Format("Error in updateItemFulfillment DR method. {0}", ex.Message));
throw new Exception(String.Format("Error in updateItemFulfillment DR method. {0}", ex.Message));
}
}