function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Debbie61Debbie61 

Upsert call producing no results and throwing no errors

I modelled this upsert call after one that is working for another custom object. I have a log entry right before the upsert call and a log entry right after the upsert call to capture the size of the upsertResults. I have the upsert call within a try catch block. I see the log entry before the call. I do not see any other log entries until after the try catch. I see no log entries for any exceptions being thrown. Need some help figuring out what I have missed here. And I have verified that my updateArray contains at least of length 1

 

try
            {
                logger.Debug("Preparing to try the upsert");
                UpsertResult[] upsertResults = binding.upsert("Request_ID__c", updateArray);
                logger.Debug("length of upsertResults " + upsertResults.Length);
                for (int i = 0; i < upsertResults.Length; i++)
                {
                    if (upsertResults[i].success)
                    {
                        setMDC(Convert.ToString(updateArray[i].project_task_id__c), updateArray[i].Request_ID__c, updateArray[i].Store_Number__c);
                        logger.Info("DmbInstall updated for id: " + upsertResults[i].id);
                        clearMDC();
                        localm4TableAdapters.dmb_Load_Sales_ForceTableAdapter ad = new SalesForceWebServices.localm4TableAdapters.dmb_Load_Sales_ForceTableAdapter();
                        int nNoUpdate = -1;
                        nNoUpdate = ad.updSFCUpdatedFlag(dateStamp, updateArray[i].Request_ID__c, Convert.ToInt32(updateArray[i].project_task_id__c));
                        successCount = successCount + 1;

                    }
                    else
                    {
                        setMDC(Convert.ToString(updateArray[i].project_task_id__c), updateArray[i].Request_ID__c, updateArray[i].Store_Number__c);
                        logger.Error("DmbInstall update failed for id: " + upsertResults[i].id);
                        clearMDC();
                        foreach (Error error in upsertResults[i].errors)
                        {
                            logger.Error("ERROR Code: " + error.statusCode.ToString() + " " + Convert.ToInt32(updateArray[i].project_task_id__c));
                            logger.Error("ERROR Message: " + error.message);
                        }
                    }
                }
            }
            catch (SoapException ex)
            {
                logger.Error("Failed to execute query succesfully," +
                       "error message was: " + ex.Message);
            }
            catch (Exception e)
            {
                logger.Error("Fail upsert" + e.Message);
            }
            logger.Info("Successfully loaded " + successCount + " Updated Install Records");