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
Ross JamesRoss James 

Trigger to match Calls with Call Rates

Can I get some feedback, ideas or game plan for the following: 

 

When a CDR Call_Detail_Record__c is imported, it needs to be matched to a Call Rate Call_Rate__c. The Call Rates are based on a prefix of between 3 and 8 digits long (there are 100's of these). The string from the CDR (to match to the rates) can be between 5 and 15 digits long.

 

A (5 to15 digit) Call_Detail_Record__c.DST__c needs to be match to the longest Call_Rate.Prefix__c possible, checked in a descending order (the first 8 of DST__c compared to the 8 digit Prefix__c records first, then 7, etc.).

 

This Call Rate Id is then assigned to the CDR. 

 

CDR data is imported via the Bulk API. Could be 1 or 10,000 records.

 

Any ideas on best way to handle this will be appreciated. 

Ispita_NavatarIspita_Navatar

I think should try the following:-


1. First Upload all the Call Rate records and then export them , save the csv.


2. Now Upload all the Call Detail records and then export them, save the csv. Take care that the lookup to Call Rate in Call Detail record is not required field.


3. Now you have 2 csv files build a program in C# to import all the data in SQL and then do the necessary manipulations via the C# code and update the Call Detail record with the appropriate Call Rate record ID. Then generate the csv for Call Detail Record after the necessary modification w.r.t. insertion of appropriate Call Rate ID and update the Call detail record using Data-loader.