This is a public Forum  publicRSS

Topic

    JJ
    Run a script after a data import wizard has finished
    Topic posted December 6, 2017 by JJPro 
    30 Views, 7 Comments
    Title:
    Run a script after a data import wizard has finished
    Content:

    Hi,

    We have a data import wizard for a custom object. Runs fine.

    Separate from this, we have a widget which loops through each record and performs various things and then updates a field within this custom object. Runs fine.

    Yes - we *could* look at doing all this from within the excel via VBA... but we have RightNow, right here, right now!

    So my question is whether we can run the script automatically after the data import wizard has completed. Would custom processes come into play? How would I trigger any script after a data upload has taken place? Would it done after every row change or can I do it once it finishes?

    Answer

     

    • Venkateswar Bollapalli

      There is a option in the Data Import wizard to run the External Events/CPMs. You can add the field update logic in a CPM with create action, import the CO records using Data Import Wizard.

      Regards, Venkat B

    • Pramod Vasudeva Murthy

      Two points:

      • If you are using OOTB data import wizard then use CPM. But there is a downfall to it. As and when you import there is too much load on the server to execute CPM. 
      • If your record count is less(< 10K) then use the custom script and import the records. Do all the logic manipulations in this script itself.

      ~VIP

    • JJ

      Record count is > 10k

      Would the CPM be done on each row as-and-when it uploads or will it be ran right at the end? I would only want to update maybe 10%

    • Venkateswar Bollapalli

      CPM will run at the end of each row.

      Since you would like to update only 10% of the load, the best way is to get this done using the custom script. You will have to run the custom script manually after completing the import using Data Import Wizard.

      Regards, Venkat B

    • JJ

      Ah ok - this isn't ideal - I think we'll just do some VBA macros in excel instead

    • Venkateswar Bollapalli

      Yeah. That is the ideal way to have as many fields as possible in the source data file. But not always, we will be able to derive/calculate the values using macros. In those scenarios, we can use the CPM / custom script to update the imported records.

      Regards, Venkat B

       

    • Pramod Vasudeva Murthy

      Custom script is the ideal solution because you can use OOTB Connect PHP APIs and the object reachability is neared compared to Web Services. For eg: to set a incident primary contact in Custom script you need to do this:

      $incident->PrimaryContact = RNCPHP\Contact::fetch(<contact_ID);

      But for a web service it is a bit far:

      Incident inc = new Incident();

      IncidentPrimaryContact inc_prim = new IncidentPrimaryContact();

      NamedID namedID = new NamedID();

      ID con_ID = new ID();

      con_ID.setid(<contact_ID>);

      namedID.setID(con_ID);

      inc_prim.setNamedID(namedID);

      inc.setPrimaryContact(inc_prim);

      So, in summary Connect PHP is easier reach than of Web services.

      ~VIP