• kjtseng
  • NEWBIE
  • 20 Points
  • Member since 2014

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 5
    Questions
  • 5
    Replies
Hi,

I have the following statement to token a string into words using the following delimiters. It's not working for comma and dash. Please advise. Thank!!
String[] words = inputStr.split('[,|.|-|\b\f\n\r\t| ]', -2);
Hi,

I like to migrate my custom objects, Apex classes and triggers in one sandbox to another production org that do not have any deployment connectiion w/ the sandbox. Is it possible at all? Use Eclipse IDE?

Thanks!
Hi,

I have a scheduled Apex job that query a child object and order by the parent Id. Then I have a for loop that groups all the child objects w/ the same parent Id into a list and then cache them in a map using the parent Id as a key. Before cache into a map, the key-value pair was correct, but then after if's put into a map, the value gets overwritten. How come? Below is the job and the debug log right before and after put to the map. Thanks for all your help!!
global class LScheckforDefaultIntPayment implements Schedulable {
    global void execute(SchedulableContext ctx) {
        CronTrigger ct = [SELECT Id, CronExpression, TimesTriggered, NextFireTime, State, CronJobDetailId
                          FROM CronTrigger WHERE Id = :ctx.getTriggerId()];
        
        Map<Id, List<Loan_Servicing__c>> tsid_lsListMap = new Map<Id, List<Loan_Servicing__c>>();
        List<Loan_Servicing__c> lsList = new List<Loan_Servicing__c>();
        
        LSClass.loadRTMap();         
        List<Loan_Servicing__c> lsListTemp = 
            [SELECT Id, Name, Term_Sheet__c, Status__c
             FROM Loan_Servicing__c 
             WHERE Amount__c > 0
             AND Status__c != 'Invalidated'
             AND Name LIKE 'TS -%'
             AND (RecordTypeId = :LSClass.rtMap.get(LSClass.INT_ACCR_UNPAID) OR
                  RecordTypeId = :LSClass.rtMap.get(LSClass.INT_ACCR))
             ORDER BY Term_Sheet__c];
        System.debug('LScheckforDefaultIntPayment() >> lsListTemp='+lsListTemp);
        ID ts_id = null;
        tsid_lsListMap.clear();
        for (Loan_Servicing__c ls : lsListTemp) {
            if (ts_id != ls.Term_Sheet__c) {
                if (ts_id != null) {
                    System.debug('ts_id='+ts_id+' lsList='+lsList);
                    tsid_lsListMap.put(ts_id, lsList);
                    System.debug(tsid_lsListMap.size()+' '+tsid_lsListMap);
                    lsList.clear();
                }
                ts_id = ls.Term_Sheet__c;
            }
            lsList.add(ls);
        }
        //		System.debug('LScheckforDefaultIntPayment() >>> tsid_lsListMap size='+tsid_lsListMap.size()+''+ tsid_lsListMap);
        //        LSClass.checkforDefaultIntPayment(tsid_lsListMap);
    }   
}
ts_id=a0mc00000022nuCAAQ lsList=(Loan_Servicing__c:{Name=TS - 000000026, Term_Sheet__c=a0mc00000022nuCAAQ, Id=a0pc0000001JFDAAA4, Status__c=Statement})

1 {a0mc00000022nuCAAQ=(Loan_Servicing__c:{Name=TS - 000000026, Term_Sheet__c=a0mc00000022nuCAAQ, Id=a0pc0000001JFDAAA4, Status__c=Statement})}

ts_id=a0mc00000022qM0AAI lsList=(Loan_Servicing__c:{Name=TS - 000000027, Term_Sheet__c=a0mc00000022qM0AAI, Id=a0pc0000001J5fbAAC}, Loan_Servicing__c:{Name=TS - 000000027, Term_Sheet__c=a0mc00000022qM0AAI, Id=a0pc0000001JAREAA4}, Loan_Servicing__c:{Name=TS - 000000027, Term_Sheet__c=a0mc00000022qM0AAI, Id=a0pc0000001JAAfAAO}, Loan_Servicing__c:{Name=TS - 000000027, Term_Sheet__c=a0mc00000022qM0AAI, Id=a0pc0000001JAAkAAO})

2 {a0mc00000022nuCAAQ=(Loan_Servicing__c:{Name=TS - 000000027, Term_Sheet__c=a0mc00000022qM0AAI, Id=a0pc0000001J5fbAAC}, Loan_Servicing__c:{Name=TS - 000000027, Term_Sheet__c=a0mc00000022qM0AAI, Id=a0pc0000001JAREAA4}, Loan_Servicing__c:{Name=TS - 000000027, Term_Sheet__c=a0mc00000022qM0AAI, Id=a0pc0000001JAAfAAO}, Loan_Servicing__c:{Name=TS - 000000027, Term_Sheet__c=a0mc00000022qM0AAI, Id=a0pc0000001JAAkAAO}), a0mc00000022qM0AAI=(already output)}

Hi,

I have roll-up summary fields in the parent object and I store this object in a Map when a trigger gets fired. Later in the code, new child records were created that change the values of all those formula fields. Since formula fields are not writable, what's the best practice to have the Map refreshed with the latest values for those formula fields without doing another SOQL query.

Thanks in advance for your help!
Hi,

I have two custom buttons: one in the list view and one in the detail page for a custom object. The onClick Javascript code for the list button was able to get all the record Ids. But the code for the detail page button was not able to get any id at all. Both buttons call the same Apex class. I followed the code sample from http://developer.force.com/cookbook/recipe/creating-a-button-with-apex.
onClick Javascript Code for the Custom List Button on the Listview:
{!REQUIRESCRIPT("/soap/ajax/14.0/connection.js")}
{!REQUIRESCRIPT("/soap/ajax/14.0/apex.js")}

var recordIdArray = {!GETRECORDIDS($ObjectType.Term_Sheet__c)};
console.log('the record Ids are' + recordIdArray);

if (recordIdArray.length) {
    alert("Calculating...");
    var retStr = sforce.apex.execute("LScurrMonthInterest",     "calculateInterestToDate",{ts_idList: recordIdArray});
    alert(result[0] + " Done!"); //response

} else if (recordIdArray.length == 0) {
    alert("Please select the Term Sheet to which" +
         " you would like to calculate current month interest as of today.");
}

~~~~~~~~~~~~
onClick Javascript Code for the Custom Detail Page Button on the Detail Page:
{!REQUIRESCRIPT("/soap/ajax/14.0/connection.js")}
{!REQUIRESCRIPT("/soap/ajax/14.0/apex.js")}

var recordIdArray = {{!Term_Sheet__c.Id}};
console.log('the record Ids are' + recordIdArray);

if (recordIdArray.length) {
    alert("Calculating...");
    var retStr = sforce.apex.execute("LScurrMonthInterest",     "calculateInterestToDate",{ts_idList: recordIdArray});
    alert(result[0] + " Done!"); //response

} else if (recordIdArray.length == 0) {
    alert("Please select the Term Sheet to which" +
         " you would like to calculate current month interest as of today.");
}

~~~~~~~~~~~~~
Apex Class:
global class LScurrMonthInterest{

  WebService static void calculateInterestToDate(List<Id> ts_idList) {
   .......
  }
}


Hi,

I have the following statement to token a string into words using the following delimiters. It's not working for comma and dash. Please advise. Thank!!
String[] words = inputStr.split('[,|.|-|\b\f\n\r\t| ]', -2);
Hi,

I have roll-up summary fields in the parent object and I store this object in a Map when a trigger gets fired. Later in the code, new child records were created that change the values of all those formula fields. Since formula fields are not writable, what's the best practice to have the Map refreshed with the latest values for those formula fields without doing another SOQL query.

Thanks in advance for your help!
Hi,

I have two custom buttons: one in the list view and one in the detail page for a custom object. The onClick Javascript code for the list button was able to get all the record Ids. But the code for the detail page button was not able to get any id at all. Both buttons call the same Apex class. I followed the code sample from http://developer.force.com/cookbook/recipe/creating-a-button-with-apex.
onClick Javascript Code for the Custom List Button on the Listview:
{!REQUIRESCRIPT("/soap/ajax/14.0/connection.js")}
{!REQUIRESCRIPT("/soap/ajax/14.0/apex.js")}

var recordIdArray = {!GETRECORDIDS($ObjectType.Term_Sheet__c)};
console.log('the record Ids are' + recordIdArray);

if (recordIdArray.length) {
    alert("Calculating...");
    var retStr = sforce.apex.execute("LScurrMonthInterest",     "calculateInterestToDate",{ts_idList: recordIdArray});
    alert(result[0] + " Done!"); //response

} else if (recordIdArray.length == 0) {
    alert("Please select the Term Sheet to which" +
         " you would like to calculate current month interest as of today.");
}

~~~~~~~~~~~~
onClick Javascript Code for the Custom Detail Page Button on the Detail Page:
{!REQUIRESCRIPT("/soap/ajax/14.0/connection.js")}
{!REQUIRESCRIPT("/soap/ajax/14.0/apex.js")}

var recordIdArray = {{!Term_Sheet__c.Id}};
console.log('the record Ids are' + recordIdArray);

if (recordIdArray.length) {
    alert("Calculating...");
    var retStr = sforce.apex.execute("LScurrMonthInterest",     "calculateInterestToDate",{ts_idList: recordIdArray});
    alert(result[0] + " Done!"); //response

} else if (recordIdArray.length == 0) {
    alert("Please select the Term Sheet to which" +
         " you would like to calculate current month interest as of today.");
}

~~~~~~~~~~~~~
Apex Class:
global class LScurrMonthInterest{

  WebService static void calculateInterestToDate(List<Id> ts_idList) {
   .......
  }
}