Customer Portal

Get Involved. Join the Conversation.


    Janusz Jasinski
    Looping through CSV and updating object results in DB API...
    Topic posted October 18, 2019 by Janusz JasinskiSilver Crown: 22,500+ Points 
    27 Views, 3 Comments
    Looping through CSV and updating object results in DB API Error


    We have a CSV with 10,000 rows. We loop through each one and depending on whether it exists as a CO, we either update or insert the record. There are about 20 columns.

    At around 230 rows, we get the error

    Exception: line 222: Cannot save/update: NameCustomObject(ID=14239): DB API Error

    Is there any setting we need to adjust or any workaround?





    • Gursimran Singh Saini

      Oh I have struggled through this error for a long time. My workaround was Data Import Wizard + CPMs.

      You are probably uploading a CSV in a Custom Script, right? Well its going to timeout at some point of time or throw these DB API Errors.
      Try adding a RNCPHP\ConnectAPI::commit();

      Anyway, here's what you should do.
      Upload the CSV through Data Import Wizard and execute CPMs for each record. Make sure the CPM is Async.
      The Data Import Wizard will finish the import of 10,000 records within a minute or two. But the CPM for these 10,000 records may take longer to finish executing. It will keep processing in the backend. Be patient and keep checking the logs.

      • Janusz Jasinski

        Thanks - the process is already using the data import wizard but it's very much a manual process that we want to avoid.

        The plan is that "System A" dumps the CSV to the WebDav and then "Process A" calls the controller to process the data, all automated, all scheduled.

        I tried the commit() and it didn't make any difference. It gets through 200+ fairly quickly

    • Sebastiaan Draaisma

      Hi Janusz.

      Just a word of caution (since you mentioned webdav), I recently looked into automated CSV import myself and found an old topic that said:

      John, the best method of integrating with RightNow is to use the Connect Web Services for SOAP API. Would it be possible for you to use this API to push the data to RightNow?

      If that is not possible, you could engage RightNow Professional Services to build a custom scheduled import. You would be provided with a WebDAV location (separate from the Customer Portal WebDAV) to place your import files, and the scheduled job would retrieve them and process them.

      I also want to note that any files placed in the /euf/assets directory are publicly accessible. Placing import data there is extremely dangerous.

      I also want to note that Customer Care likely would not support an import script written in the CP framework. I would also investigate if this violates your user agreement.

      I'm not sure if this applies to your use case but thought, never hurts to mention right? :-)