System Admin and Configuration

Get Involved. Join the Conversation.

Topic

    Andy Townshend
    Cumulative Summing using Data Import Wizard
    Topic posted February 15, 2018 by Andy TownshendSilver Medal: 2,000+ Points 
    69 Views, 3 Comments
    Title:
    Cumulative Summing using Data Import Wizard
    Content:

    I am trying to see if the Data Import Wizard has the capability to add a column's value to an existing field rather than overwrite its value.


    We are looking to see if we can sum the total dollar value spent on a contact record, and potentially display this field on the agent workspace. We have several data sources available for import that have columns for email address and net sales. We would like to store this cumulative value for all of these sales figures. 

    Is there a way to do this with the Data Import Wizard, or by any other method? 

    Version:
    Oracle Service Cloud

    Comment

     

    • Suresh Thirukoti

      I think you can do this via CPM if you are ok with development....In the data import wizard, enable run external events/CPMs in the main screen of the Data Import wizard screen....pseudo code

      public static function apply( $run_mode, $action, $obj, $n_cycles )
        {

             $existingvaluequery = RNCPHP\ROQL::query("select customfields.c.customfield from contact where ID=".$obj->ID)->next()->next();

              $existvalue = $existingvaluequery['customfield'];

             $updatedvalue =   $obj->CustomFields->c->customfield + $existvalue;

            $obj->CustomFields->c->customfield = $updatedvalue;

         $obj->save(RNCPHP\RNObject::SuppressAll);

              }

        

      ~Suresh

       

       

       

    • Anuj Behl

      Hi Suresh,

      I think querying a custom field will get you the updated value and is the only way to do it since custom fields are not available in the object passed in CPM.

      And, to get the existing (or previous) value, prev should be used. $obj->prev->CustomFields->c->customfield

      -Anuj

    • Suresh Thirukoti
      Oops..thanks for correction Anuj!