How to handle Emergency Financial Need Situations ?

 

The value of money is constantly changing due to the effects of inflation and other economic indicators. However, even without the participation of these external agents, its value is still relative. And that is not all the same makes the same use of capital or, in other words, what each person does with the money, the importance given and the decisions you make are the ones that end defining the “price” of money in every moment. Everyone strives to maximize that value, but in the end only a few succeed. The rest struggle to get more out of your money every time.

Financial problems are really an unfortunate situation that many people might have to face at some point in their lives. College students, workers in mid-career and even retirees can find similar economic problems. When financial problems occur, some people are looking for answers and advice in the wrong places. Friends and family may have the best intentions, but not always qualified to provide financial aid. Understanding the most common causes of financial problems can help you to avoid or reduce stress during tough times and ways to manage them are also discussed below. One major solution for any financial emergency is also discussed here.

Poor or not planning your income and expenditure budget is one of the most common causes of financial problems. If a person is spending more than they are earning, it is predisposing themselves to suffer for financial problems. Many people start using credit cards and loans to offset their higher costs of living which they created out of their lifestyle. As interest accrues, these debts become larger and more difficult to pay. Developing a household budget is essential to avoid these financial problems. Plan monthly charges considering loans, mortgages and other bills before spending money on entertainment and luxuries.

Even the best financial planners are not always prepared for unexpected and expensive financial emergencies. Sudden medical, educational and household expenses can erode savings accounts and monthly budgets which people have spend time and efforts and accrued money in it over years of time. People often come to additional loans to pay emergency expenses, but then fail to account for loan payments in future budgets. Remember that every new spending requires a careful balance to previous costs.

For Emergency Financial Need Situations

Whenever people face with an emergency financial situation where they require amounts of money which is more than what they have at hand and is beyond their borrowing capacity from others and above all when there is no time to apply for loans and wait till its processed, for such a complicated emergency cash need scenario, the only solution would be to go for best rated cash advance loans.

The advantages in going for these online advance loans are they are processed quickly which is the most required aspect to look for in a emergency financial situation. For these cash advance loans, there are no credit checks and hence in spite having bad credit history, people can get these loans. Above all, flexible repayment terms available with these online loans which is another most required aspect as borrowers can feel confident about repaying.

How to create RowID in Tables : Here is the Code or Script Code for ID creation

If you are looking for to How to create RowID in Tables : Here is the Code or Script Code for ID creation,
Find below a simple Script or Code for generating Row ID or Record ID in Tables for Salesforce
public void viewTracking(){
if(trackingRow != null){
list rowId = trackingRow.split(‘:’);
if(rowId.size() >1){
//system.debug(‘***’+ integer.valueof(rowId[(rowId.size()-2)]));
Tracking =orderDetails[integer.valueof(rowId[(rowId.size()-2)])].Tracking;
}
}
}
Using RowID can be helpful in many ways to identify a record, count the records, classify, add, insert or delete a record or row just with a command in Tables.

How to Sort an Apex class Object List

[Edit : Now there is an interface natively provided by salesforce to sort the class object lists]

I recently needed to sort an apex class object List which was retrieved through a webservice callout as it could not be sorted at the service end.

This is the apex method which was used to build it

 public void testsort(){
map<string,List> stracc = new map<string,list>();
for(accClass a:accClassobj ){
if(stracc.containsKey(a.name))
                stracc.get(a.name).add(a);
else
stracc.put(a.name,new accclass[]{a});
}
accclassobj= new list();
list nameList = new list();
nameList.addAll(stracc.keyset());
nameList.sort();
for(string s:nameList){
accclassobj.addAll(stracc.get(s));
}

Above is the code involved in sorting to build a map with object parameter as the key by which we gonna sort and List.

 

How to Filter list alphabetically

How to Filter list alphabetically

There was a requirement where i needed to build a list which can be filtered based on the starting alphabet. And also the List needs to remember the selections made as we move through other pages.


|

Please wait…

In the VF page i am displaying the List ‘CurrentLsit‘ which would hold the contact list with checkbox which is paginated and ‘DisplaySelectedList‘ which would remember the selected contact. Array Alphabet is used in repeat to build the link of alphabets at the top of page

Controller method

 
 
public with sharing class Pagin_alpha {    
    private List contactSetList{get;set;}
    private string contactListQuery;
    private set selectedContact;
   
    public List alphabet{get;set;}
    public boolean fals{get;set;}  
   
    public Pagin_alpha(){
      fals=false;
¬†¬†¬†¬†¬† alphabet=new string[]{‘All’,’a’, ‘b’, ‘c’, ‘d’, ‘e’, ‘f’, ‘g’, ‘h’, ‘i’, ‘j’, ‘k’, ‘l’, ‘m’, ‘n’, ‘o’, ‘p’, ‘q’, ‘r’, ‘s’, ‘t’, ‘u’, ‘v’, ‘w’, ‘x’, ‘y’, ‘z’ };¬†
      contactSetList = new List();
      selectedContact = new set();
¬†¬†¬†¬†¬† contactListQuery= ‘select id,name,phone from contact limit 1000’;¬†¬†¬†
    }
   
     Private void updateSelectedContact(){
        for(contactSet cs:contactSetList ){
           if(cs.checked)
               selectedcontact.add(cs.ocontact);
           else{
               if(selectedcontact.contains(cs.ocontact))
                   selectedcontact.remove(cs.ocontact);
               }
       }  
    }
   
      public ApexPages.StandardSetController standardSetCon {
        get {
            if(standardSetCon == null) {
                standardSetCon = new ApexPages.StandardSetController(Database.getQueryLocator(contactListQuery));
                // sets the number of records in each page set
                standardSetCon .setPageSize(20);
            }
            return standardSetCon ;
        }
        set;
    }
 
    public List getCurrentList() {
       updateSelectedContact();
       contactSetList = new List();      
        for (contact category : (List)standardSetCon.getRecords()){       
            if(selectedContact.contains(category))         
¬†¬†¬†¬†¬†¬†¬†¬†¬†¬†¬† contactSetList.add(new contactSet(category,’true’));
            else
            contactSetList.add(new contactSet(category));
        }
        fals=false;
        return contactSetList;
    }
   
    public PageReference refreshList2() {      
       standardSetCon = null;    
       string s;
¬†¬†¬†¬†¬†¬† if(apexpages.currentpage().getparameters().get(‘alpha’) == ‘All’)
¬†¬†¬†¬†¬†¬†¬†¬†¬†¬† s=’%’;
       else
¬†¬†¬†¬†¬†¬†¬†¬†¬†¬† s= apexpages.currentpage().getparameters().get(‘alpha’)+’%’;
      
¬†¬†¬†¬†¬†¬† contactListQuery= ‘select id,name,phone from contact where name like’ +”’+s +”’+ ‘limit 5000’;¬†¬†¬†¬†¬†¬†¬†¬†¬†¬†
        return null;
    }
   
  
   
    public List getDisplaySelectedList(){
        updateSelectedContact();
        List displaycon = new list();
        displaycon.addall(selectedcontact);
        return displaycon;
    }
      
    public class contactSet {
        public Boolean checked{ get; set; }
        public contact ocontact { get; set;}         public contactSet(){
            ocontact = new contact();
            checked = false;
        }
        public contactSet(contact c){
            ocontact = c;
            checked = false;

        }
        public contactSet(contact c,string s){
            ocontact = c;
            checked = true;

        }
    }
   
 
}

getCurrentList populates the currentList in the page. refreshList2 will refresh the list when the link on top of the page to filter the contact is clicked.

This concept can be extended to multiple fields in the List .

 

How to Identify SobjectType Dynamically in Apex

Here is a script that answers your How to Identify SobjectType Dynamically in Apex
getKeyPrefix of Schema.getGlobalDescribe can be used to identify dynamically the SobjectType in Apex.

String prefix = recordId.substring(0,3);
String objectType;
Map<String, Schema.SObjectType> gd = Schema.getGlobalDescribe();
for(Schema.SObjectType s : gd.values()){
    if(prefix == s.getDescribe().getKeyPrefix()){
        objectType = s.getDescribe().Name;
    }
}

recordId consists the Id of the sobject Record for whose SobjectType needs to be identified. Above piece of code does it well.

How to Build your Own Standard set controller

Standard set controller can be used for many objects . Recently i found that it cannot be used with activity objects(Open activity and activity history). Also there are many other Restrictions placed on these objects. You cannot query on these objects directly. It has to be a nested SOQL within an object using a relationship name.So coming back to my requirement i needed to roll up related list for all the activities in the account hierarchy for the topmost parent. For other related list i achieved it through standardset controller. But for activity alone i created a class which would behave like a standard set controller.

Now here is the script on How to Build your Own Standard set controller

public class SetActivityClass {
public integer pagenumber{get;set;}
public integer totalpages{get;set;}
public integer pagesize{get;set;}
public list sobjectList{get;set;}
public SetActivityClass(list sobjectList){
pagenumber =1;
pagesize = 60;
this.sobjectList=sobjectList;
totalpages= Integer.valueof(math.ceil((double)sobjectList.size()/(double)pagesize ));
}
public boolean gethasprevious(){
return (pagenumber != 1);
}
public boolean gethasnext(){
return (pagenumber != totalpages);
}
public pagereference Previous(){
if(gethasprevious())
pagenumber–;
return null;
}
public pagereference next(){
if(gethasnext())
pagenumber++;
return null;
}
public list getRecords(){
list Sactivity = new list();
for(integer counter2=(pagenumber-1)*pagesize;counter2<(math.min(pagenumber*pagesize,sobjectList.size()));counter2++){
Sactivity.add(sobjectList.get(counter2));
}
return Sactivity;
}

} 
oActivityHistory= new SetActivityClass(ActivityHistoryList);
oOpenActivity= new SetActivityClass(OpenActivityList); 
public List getGoToListOpenActivities() {
return oOpenActivity.getRecords();
}

public List getGoToListActivityHistories() {
return oActivityHistory.getRecords();
}

Just like the standard set controller, this SetActivityClass has methods to return next set or previous set of records. These can be added to command links as they are pagereference method. Also Hasprevious and Hasnext can be called from the page to check if the previous or next set of records exist.Pagenumber denotes the current page number. Pagesize determines no of records to be displayed in the page. I would recommend a size of 40 -60 in a page for better readability by Users(I have hardcoded it as 60). Total pages is calculated based on this pagesize.

Also note that getRecord function accepts and returns generic sobject. I used the same class for both activityhistory and openactivity.This Class can be slightly tweaked to handle list of objects of your custom class  as well.

Here is how i would display it in the page

 
                 
  Previous
Next
 


…….

And whenever the next and previous is click make sure atleast the pageblock tabele is rerendered if not the whole page based on your logic. I  have shown the VF for openactivity. similarly u can use it for activity history. Also you can use the same logic in building your own custom class wrapper object standard set controller this way.