Cannot Update HelpDeskTableset with Custom Code on Kinetic but works on E10

My UBAQ Help Desk custom-code customization worked in E10 and now it does not in Kinetic 2023. I just get the error: Object reference not set to an instance of an object.

It has come to my attention via two Epiuser posts that it may involve RowMod ’ U"; or the fact I’m using Update instead of what I may need to use now which would be UpdateExt. I will attach those two posts at the bottom. Here is my custom code that is causing issues. Not even UpdateExt using widgets it getting it to stick to the database

It’s weird that it worked fine on E10 but not on Kinetic. Just a simple GetByID, Change a fields value, and Update doesn’t work now

try
{
    var ISSUETEXT = (string)queryResultDataset.Results[0]["Calculated_IssueText"];
    var ISSUESUMMARY = (string)queryResultDataset.Results[0]["Calculated_IssueSummary"];
    var CASENUM = (int)queryResultDataset.Results[0]["Calculated_Case"];


    using (Erp.Contracts.HelpDeskSvcContract helpDeskSvc = Ice.Assemblies.ServiceRenderer.GetService<Erp.Contracts.HelpDeskSvcContract>(Db))
    {
        // Check if CASENUM is valid
        if (CASENUM > 0)
        {
            // Retrieve HelpDeskTableset with HDCaseNum filter equals CASENUM
            Erp.Tablesets.HelpDeskTableset helpDeskTableset = helpDeskSvc.GetByID(CASENUM);
            
            // Check if HelpDeskTableset is not null and contains rows
            if (helpDeskTableset != null && helpDeskTableset.HDCase.Count > 0)
            {
                // Update the existing HDCase with new values
                helpDeskTableset.HDCase[0].IssueText = ISSUETEXT;
                // Ensure ISSUETEXT is not null and truncate if necessary
                helpDeskTableset.HDCase[0].IssueSummary = ISSUETEXT.Length > 60 ? ISSUETEXT.Substring(0, 60) : ISSUETEXT;
                helpDeskTableset.HDCase[0].ResolutionText = ISSUESUMMARY;
                // Call the Update method to save changes
                helpDeskTableset.HDCase[0].Priority = 1;
                helpDeskTableset.HDCase[0].RowMod = "U";
                helpDeskSvc.Update(ref helpDeskTableset);
            }
            else
            {
                // Handle the case when HelpDeskTableset is null or empty
                PublishInfoMessage("HelpDeskTableset is null or empty", Ice.Common.BusinessObjectMessageType.Error, Ice.Bpm.InfoMessageDisplayMode.Individual, "", "");
            }
        }
        else
        {
            // Handle the case when CASENUM is invalid
            PublishInfoMessage("Invalid CASENUM", Ice.Common.BusinessObjectMessageType.Error, Ice.Bpm.InfoMessageDisplayMode.Individual, "", "");
        }
    }
}
catch (Exception ex)
{
    // Log the exception
    PublishInfoMessage($"Error: {ex.Message}", Ice.Common.BusinessObjectMessageType.Error, Ice.Bpm.InfoMessageDisplayMode.Individual, "", "");
    // Rethrow the exception if needed
    throw;
}

Is it hitting the PublishInfoMessage in your catch statement? If not, the only think I can think of is that the query isn’t returning any rows, and it’s hitting the error when trying to find your queryResultDataset.Results[0] row.

The issue seems to revolve around using BPM Update: Update Method: UpdateExt and making BAQ fields Updatable. Then it works! Oddly going from E10 to Kinetic has broken HelpDeskContractSvc custom code for me as seen in my intial topic post.

So the solution seems to be using BPM Update Processing on my UBAQ instead of “Advanced BPM update only” at least for what I’m trying to achieve with .js programs sending input to Rest API to update a Case Entry tableset. Thank you

1 Like