Posts

Showing posts from March 24, 2017

Show Hyper Link On Add Error in Salesforce Trigger

Requirement: Check Duplicate record in system and show the add error in form of hyperlink corresponding duplicate record ID Solution : Write a trigger and show add error objExistingRecord >>> OldRecord Id objNewRecord >> New Record  objNewRecord.addError('Same Combination of Record already Inserted in System: <a href=\'/'+ objExistingRecord.id +'\'>'+objExistingRecord.Name+'</a>', false);                                                                           Thanks                                                Sumit Shukla

Schedule Class for every One Hour Everyday in Salesforce

Write below code in "Developer Console" to schedule class for every One Hour Everyday.  Apex Code: NameofScheduleclassEveryhour objschclass =  new NameofScheduleclassEveryhour (); string strSeconds = '0'; string strMinutes = '0'; string strHours = '0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23'; string strDay_of_month = '*'; string strMonth = '*'; string strDay_of_week = '?'; String sch = strSeconds + ' ' + strMinutes + ' ' + strHours + ' ' + strDay_of_month + ' ' + strMonth + ' ' + strDay_of_week; system.schedule('ScheduleclassEveryhour', sch, objschclass);                                    Thanks,                               Sumit Shukla