• Praful Gadge
  • NEWBIE
  • 70 Points
  • Member since 2012
  • Sr. Tech Lead
  • Trekbin Technologies Pvt. Ltd.


  • Chatter
    Feed
  • 2
    Best Answers
  • 1
    Likes Received
  • 2
    Likes Given
  • 4
    Questions
  • 37
    Replies
Hi, 
I have enabled state and picklist value in client's unlimited org. I need to access only dependent state based on selected Country code. There are some integration and other apex changes where I need only dependent state value in a Map( like  : 'MH'=> 'Maharastra')... I am using below code but It will give all the state values. I need only states based on country values. e.g. : For Indian it should have only 35 state which belong to India only. 
Schema.DescribeFieldResult F = Contact.MailingStateCode.getDescribe();
List<Schema.PicklistEntry> P = F.getPicklistValues();

System.debug('-----P--->>'+P[0]);
Map<String, String> tempMap = new Map<String, String>();
for(Schema.PicklistEntry sp : P){
    tempMap.put(sp.getValue(), sp.getLabel());
}

System.debug('----tempMap-----'+tempMap.get('MH'));  // Here it is returning 'Meath' as MH will be state code for some other states as well 
System.debug('----tempMapVALUE-----'+tempMap.get('UP'));

Any help will be appreciated. Thanks in Adance !!
 

Here is the situation.   I have a list of account ID's.  I want to send en email to an email field on each of those accounts.  I have a visualforce template that I want to use as the body of the email.  How do I get the email to go out to each of the accounts and have the fields referenced on the template apply to the account that he email is set to go to?  Maybe I am just overthinking this, but any help would be appreciated, I am expirienced with apex but have never used the email portion of it before.  Thanks.

I tried using this but it is not working in Lightning Experience:
<apex:outputLink value="{!URLFOR($Action.Account.List,$ObjectType.Account)}}" target="_blank">
        View All Accounts
</apex:outputLink>
Please let me know if you found any solution.

Thanks,
Praful
We are trying to create a global action which is dynamic (as it can be added for any sObject).
However we need to fetch the current recordId from the detail page of the sObject's record into our VisualForce page(which is called from global action). We can't use a standard controller in VF page to fetch the Id as the action can be fired from any sObject.

The URL we see for record detail page in Lightning Experience window is - 
https://trekbindev-dev-ed.lightning.force.com/one/one.app?source=aloha#/sObject/001B0000004XwqlIAC/view?t=1441350807320

The javascript's methods for fetching URL doesn't seem to give the recordId in Lightning view either, as the page is opening in iFrame, screenshot
is added below:
VF page opening in iFrame

However, this function was achieved via button to add ID parameter in page for SF Classic UI, it is as follows.

Button

How can we accomplish this in Lightning Experience?

Thanks in advance!
Hi Geeks,

I have created a MIME construction snippet for sending email through Amazon SES.

While sending a large attachment I am getting error "smtp; 500 Line limit exceeded" which means the maximum limit of characters in one line is exceeded and it leads to email bounce/failure. Because the blob of the large attachment is coming in a single line.

I tried splitting the attachment blob in the following way but it is not rendering attachment. I need to split a blob in such a way that the resulting multiline blob is still base64 encoded blob and can render as pdf/text attachment.

Code I have written is as follows:


String strLongBlob = attachmentBlob.toString();

System.debug('---strLongBlob----'+strLongBlob);

String strNewLineBlob = '';

Integer intMaxLineLength = 50;

while( strLongBlob.length() > intMaxLineLength )
{
strNewLineBlob += Encodingutil.base64Encode(blob.valueOf(strLongBlob.left(intMaxLineLength))) + '\r\n';

strLongBlob = strLongBlob.substring(intMaxLineLength);
}

if( strLongBlob.length() <= intMaxLineLength )
strNewLineBlob += Encodingutil.base64Encode(blob.valueOf(strLongBlob));
else
strNewLineBlob += Encodingutil.base64Encode(blob.valueOf(strLongBlob));

System.debug('---strNewLineBlob.length----'+strNewLineBlob.length());


If anyone has worked on this earlier please let me know.

Thanks
Hi guys,

I am using USAePay SOAP(XML) request.
 
Here are my few queries:
  1. I am not sure about EndpointURL and HostEndpointURL in my Http callouts as its nowhere mentioned in their doc. Currently I am using "https://www.sandbox.usaepay.com/gate" and "sandbox.usaepay.com" as endpoint URL and HostEndpointURL respectively, is it correct?
  2. I have created a Sandbox Account on USAePay and using a Source key in my XML which I found after adding a Source, is it corret?
  3. Also want to know is it mandatory to describe Hash value and Seed value in my XML?
     
Please advice or reply on prafulgadge36@gmail.com or skype - praful.gadge.
 
Thanks in advance.
Hi Geeks,

I have created a MIME construction snippet for sending email through Amazon SES.

While sending a large attachment I am getting error "smtp; 500 Line limit exceeded" which means the maximum limit of characters in one line is exceeded and it leads to email bounce/failure. Because the blob of the large attachment is coming in a single line.

I tried splitting the attachment blob in the following way but it is not rendering attachment. I need to split a blob in such a way that the resulting multiline blob is still base64 encoded blob and can render as pdf/text attachment.

Code I have written is as follows:


String strLongBlob = attachmentBlob.toString();

System.debug('---strLongBlob----'+strLongBlob);

String strNewLineBlob = '';

Integer intMaxLineLength = 50;

while( strLongBlob.length() > intMaxLineLength )
{
strNewLineBlob += Encodingutil.base64Encode(blob.valueOf(strLongBlob.left(intMaxLineLength))) + '\r\n';

strLongBlob = strLongBlob.substring(intMaxLineLength);
}

if( strLongBlob.length() <= intMaxLineLength )
strNewLineBlob += Encodingutil.base64Encode(blob.valueOf(strLongBlob));
else
strNewLineBlob += Encodingutil.base64Encode(blob.valueOf(strLongBlob));

System.debug('---strNewLineBlob.length----'+strNewLineBlob.length());


If anyone has worked on this earlier please let me know.

Thanks
Hi All, We have our project built on communties Napili template. We need to migrate this to another Sandbox.
We have tried the following steps but the template is not updated.
http://blogs.perficient.com/salesforce/2015/12/22/deploy-community-builder-templates-in-3-simple-steps/

We have deployed Site also through Change set. Let us know how can we get all configurations migrated from one sandbox to another. All Apex, Classes,Lightning Components have been migrated.


 
Hi,

I have two objects, contact(standard object) and Callrecord__c (custom object),Contact has lookup relationship with Callrecord__c,I would like to  display Call_Date__c field  which is in  custom object when we enter the phone number in inputfield and submit button is clicked.We should make sure Call_Date__c field should be related to the phone number that we enter in inputfield.My code is given below,iam not getting any error but the code is not displaying Call_Date__c field .
<apex:page Standardcontroller="Contact" extensions="Retrievefields" >

 <apex:form >
<apex:pageblock title="Callrecords" >
 <apex:inputText value="{!phnum}" />
 
 <apex:commandButton value="Submit" action="{!find}"/>
 </apex:pageblock>
 <apex:pageBlock title="Search Result">
      <apex:pageblockTable value="{!CallList}" var="a">

      <apex:column value="{!a.Call_Date__c}"/>

                 </apex:pageBlockTable>     
    </apex:pageBlock>    

  </apex:form>
 </apex:page>



public class Retrievefields{

     public Integer Phnum {get; set;}
  public List<Call_Record__c>  CallList {get; set;}
   

    
public Retrievefields(ApexPages.StandardController controller) {

}

public void find()
  {
    string sql = 'SELECT Call_Date__c FROM Call_Record__c WHERE Donor__c.phone LIKE \'%'+Phnum+'%\' LIMIT 5 ';
    CallList = Database.query(sql);
    
   }
   
   }



 
I need to access images from external system using HTTP callouts and display them in Salesforce.
Content-Type →image/png is the format of the reponse Salesforce is receiving
Can we use Blob to store images?
Could anyone throw light on this
We have certain accounts in the org which contain "\" in their names. Also, there is a 3rd party mobile application which is being managed in the org for visit record sync,upload and download purposes. However, when you schedule visit from the calendar with such accounts and download them to mobile app and complete, sync the records it gives the error "An Invalid XML character (0*0) found in the element content of the document".

We saw that in online, for such visits the subject line is being created with additional space of characters and if you remove them by pressing backspace for 2 times, then the subject line gets corrected and accordingly the error is removed. However, the same issue did not happen for any accounts containing forward slash /.

Please suggest how to overcome the issue of invalid xml character
Hi, 
I have enabled state and picklist value in client's unlimited org. I need to access only dependent state based on selected Country code. There are some integration and other apex changes where I need only dependent state value in a Map( like  : 'MH'=> 'Maharastra')... I am using below code but It will give all the state values. I need only states based on country values. e.g. : For Indian it should have only 35 state which belong to India only. 
Schema.DescribeFieldResult F = Contact.MailingStateCode.getDescribe();
List<Schema.PicklistEntry> P = F.getPicklistValues();

System.debug('-----P--->>'+P[0]);
Map<String, String> tempMap = new Map<String, String>();
for(Schema.PicklistEntry sp : P){
    tempMap.put(sp.getValue(), sp.getLabel());
}

System.debug('----tempMap-----'+tempMap.get('MH'));  // Here it is returning 'Meath' as MH will be state code for some other states as well 
System.debug('----tempMapVALUE-----'+tempMap.get('UP'));

Any help will be appreciated. Thanks in Adance !!
 
I'm replacing the ideas page with a custom VF page.  I have everything working apart from the vote up and down buttons.

Has anyone else done this and able to assist in getting the buttons working?  I have a look at this thread (https://developer.salesforce.com/forums/ForumsMain?id=906F0000000AsPHIA0)with the same question but there was no resolution.
  • May 30, 2015
  • Like
  • 0
Hello, 

I have a Trigger and Handler APEX class that creates an ID on a custom field on a custom object in my org that is not firing when you mass update records in a list view. The Class creates a list on all records in the object, using a custom setting i have set both the min and max values and the last assigned value for the records (the last assigned value is updated once the trigger fires for the ID that is created). What code should be added to tell the handler that the updates are coming from the List view, in a batch of records?  Im going to assume a few OR clauses that tell the handler that the updates are coming from the record OR the list view and then a batch sequence. I want to make sure i cover everything in the code so i do not miss a step.

The post will not allow me to post my full code. 


    
   
public with sharing class Tes_SWAssetController {
    
    public string SWAssertNameLable {get;set;}
    public Account currentAccount;//variable to hold current Account
    public List<Software_Asset__c> lstSWI; //{set;get;}
    public List<Software_Asset__c> lstSWI_All; //{set;get;}
    public PageManager objPageManager {get;set;}
    public boolean displayPagenation {get;set;}
    /*
*   Constructor 
*/
    public Tes_SWAssetController(ApexPages.StandardController controller) {
        currentAccount = (Account) controller.getRecord();
        List<account> lstAcc = [SELECT ID, Party_Number__c, Global_DUNS_Entity_Hub__c, IsCustomerPortal FROM Account WHERE ID =: currentAccount.ID];
        if(lstAcc.size() == 1){
            currentAccount = lstAcc[0];
        }
        //currentAccount = [SELECT ID, Party_Number__c, Global_DUNS_Entity_Hub__c, IsCustomerPortal FROM Account WHERE ID =: currentAccount.ID];
        System.debug('*** currentAccount = ' + currentAccount);
        Map<String, Schema.SobjectField> fields = Software_Asset__c.getSObjectType().getDescribe().fields.getMap();
        SWAssertNameLable = fields.get('Name').getDescribe().getLabel();
        //If Account is CPA query with Party Number
        if(currentAccount.IsCustomerPortal){// IF Account is CPA account
            lstSWI_All = [SELECT s.Id, s.Description_formula__c, s.Name, s.Product_Line__c, s.Account__c, s.Account_City__c, s.Status__c, s.Unit_of_Measure__c, s.Entitled__c, s.Activated__c, s.Available__c FROM Software_Asset__c s WHERE s.Account__r.Global_DUNS_Entity_Hub__c =: currentAccount.Global_DUNS_Entity_Hub__c AND s.Status__c != 'Expir' ORDER BY s.Account__c, s.Account_City__c, s.Product_Line__c, s.Description__c limit 1000 ];
        } else {// IF Account is Non-CPA account
            lstSWI_All = [SELECT s.Id, s.Description_formula__c, s.Name, s.Product_Line__c, s.Account__c, s.Account_City__c, s.Status__c, s.Unit_of_Measure__c, s.Entitled__c, s.Activated__c, s.Available__c FROM Software_Asset__c s WHERE s.Account__r.Party_Number__c =: currentAccount.Party_Number__c AND s.Status__c != 'Expir' ORDER BY s.Account__c, s.Account_City__c, s.Product_Line__c, s.Description__c limit 1000];
        }        
        displayPagenation = (lstSWI_All.size() == 0 ? false : true);
        objPageManager = new PageManager(10); 
        objPageManager.numberOfRows = lstSWI_All.size(); 
    }
    /*
*   Method to query and  return lstSWI list to show in VF page
*   Query defers based on Account type(CPA/NON-CPA)
*/
    public List<Software_Asset__c> getlstSWI(){
        
        List<Software_Asset__c> toReturn = new List<Software_Asset__c>();
        for(integer i=objPageManager.startIndex;i<objPageManager.endIndex&&i<lstSWI_All.size();i++)
        {
            toReturn.add(lstSWI_All.get(i));
        }        
        
        return toReturn;
        
    }
    
}
Could I please get some help creating a trigger that could somehow attach the email alerts from the workflows to the Account/Opportunity Activity History? I'm actually surprised that this isn't already part of SF.
Hi,

I am working on Idea Exchange. Currently I need to show the Promote and Demote button only if the user has not voted for the idea before. How to achieve it? Is there any flags available for it. Please help me out.
I'm trying to use custom buttons to set the Vote object as "Up" or "Down". I have the buttons up, but I'm having trouble with the beginning part of the extension. I am still fairly new to apex.

Any help would be appreciated!

VF Page Sample
<apex:form >
                   <apex:commandButton styleclass="btn-lg btn-data" value="Vote Up" action="{!setValue1}"/>
                   <apex:commandButton styleclass="btn-lg btn-data" value="Vote Down" action="{!setValue2}"/>
                   </apex:form>


Extension so far
public class detailExt{
public myControllerExtension(ApexPages.StandardController stdController) {
         public Vote setVote {get; set;}

public void setValue1() {
    setVote.Type = 'Up';
    setVote.ParentId = Idea.Id;
}
public void setValue1() {
    setVote.Type = 'Down';
    setVote.ParentId = Idea.Id;
}



}
}



 

Am new to salesforce,

Someone please help me with these terms,

 

Whats an ajax request?

What does  calling asynchronously means??

 

Hi Friends,

I am unable to write code for save and new button on VF page. When I tried saving a record I got Error Message as follows

Visualforce Error
 


System.NullPointerException: Attempt to de-reference a null object

Error is in expression '{!saveandnew}' in component <apex:page> in page familybankingnewpage

 

 

Class.familyController.saveandnew: line 18, column 1

 --------------------------------------------------------------------------

 

Please help me

The controller I tried is as follows:

 

public with sharing class familyController {

public familyController(ApexPages.StandardController controller) {

}

public Family__c family{get;set;}
List<Family__c> rec;
public familyController(){
rec = new List<Family__c>();
}
public PageReference save(){
return null;
}
public PageReference saveandnew(){
try{
//family = new Family__c();
update family;
} catch(System.DMLException e) {
ApexPages.addMessages(e);
return null;
}

return (new ApexPages.StandardController(new Family__c())).edit();
/* public PageReference cancel(){
return null;
} */
}

}

 

Thanks In advance    -----

 

 

Hi

 

I want to send an email once in every 30 days when the lead rating field in Lead object is warm until it is changed to hot.

 

I am trying to write a apex scheduler class, can anybody please help me with this.

 

Its very urgent.

 

 

Thanks in advance.

Hi,

I have 4 fields First Name, Last Name, Destination City, Destination State. These 4 columns have some duplicate values. I want to remove those Duplicate rows and these duplicate rows have different "Created Date".   have to delete only old dated rows. can someone help me. These records are already in database.

Lead IDCreate DateFirst NameLast NameDestination CityDestination State
00QU0000006ideK3/23/2008danramirez TX
00QU0000006idQI3/26/2008ErinJeffersReadingPA
00QU0000006igC03/25/2008ErinJeffersReadingPA

 

Thanks,
Uday

  • December 14, 2012
  • Like
  • 0

HI,

  while writting test clla I ma getting error like Argument 1 cannot be null: External entry point in test Class,

 

My test code is

 

@isTest
private class TestAIOlineitems
{
static TestMethod void testAI01Line()
{

AIOlineitems.wrappo w=new AIOlineitems.wrappo();

Products__c p=new Products__c(name='xxxxx',Price__c=2334.78);
insert p;
Purchase_Order__c po=new Purchase_Order__c();
insert po;
Availability_In_Order__c ava =new Availability_In_Order__c(Purchase_Order__c=po.id);
insert ava;
Availability_In_Order_Lineitems__c ao=new Availability_In_Order_Lineitems__c(Availability_In_Order__c=ava.id,Products__c=p.id);
insert ao;
ApexPages.Currentpage().getParameters().put('id',ava.ID);

ApexPages.StandardController sc = new ApexPages.StandardController(ava);
AIOlineitems ai=new AIOlineitems(sc);
ai.Cancelpoedit();
ai.getproducts1();
ai.newPoline();
ai.poedit=ApexPages.Currentpage().getParameters().put('editid',ao.ID);
ai.sno=5;
ai.editprodu();

//ai.edu='aaaa';
//PageReference pag=new PageReference();
PageReference nextPage= ai.savepoedit();
PageReference nextPage1= ai.deleteprodu();

}
}

-------------------------------

apex class is

 

public class AIOlineitems {
public boolean check{set;get;}
id pid;
public boolean Newpol{set;get;}
public Integer sno{set;get;}
public Id poedit{set;get;}
public Availability_In_Order_Lineitems__c newPO{set;get;}
public Id poid{set;get;}
public map<id,Availability_In_Order_Lineitems__c> polmap{set;get;}
public Id productname{set;get;}
public integer cou{set;get;}
public List<SelectOption> productlist{set;get;}
public Availability_In_Order_Lineitems__c edu{set;get;}
public list<wrappo> POlist{set;get;}
public class wrappo{
public Availability_In_Order_Lineitems__c pol{set;get;}
public boolean newp{set;get;}
public integer no{set;get;}
public wrappo(){
pol=new Availability_In_Order_Lineitems__c();
newp=false;
}
}
    public AIOlineitems(ApexPages.StandardController controller) {
    productlist=new List<SelectOption>();
     polmap=new map<id,Availability_In_Order_Lineitems__c>();
    for(products__c p:[select id,Name from products__c ORDER BY Name DESC limit 1000])
    productlist.add(new SelectOption(p.Id,p.Name));
NewPol=false;
PoId=Apexpages.currentpage().getParameters().get('id');
POlist=new list<wrappo>();
cou=0;
general();

    }
    public void Cancelpoedit(){
    edu=null;
    }
    public void general(){
    edu=null;
    if(polist.size()>0)
    polist.clear();
for(Availability_In_Order_Lineitems__c pol:[select Id,Name,Products__c,Products__r.name,Ordered_Quantity__c,Available_Quantity__c,Total_Product_price__c  from Availability_In_Order_Lineitems__c where Availability_In_Order__c=:poid ORDER BY Name DESC limit 1000])
{
wrappo w=new wrappo();
w.pol=pol;
w.newp=false;
w.no=cou+1;
cou=cou+1;
polmap.put(pol.id,pol);
polist.add(w);

}
for(Availability_In_Order__C a:[select id,Purchase_Order__c from Availability_In_Order__C where id=:poid])
pid=a.Purchase_Order__c;
Purchase_Order__c p1=[select id,Available_Order_Accepted_by_executive__c from Purchase_Order__c where id=:pid];
check=p1.Available_Order_Accepted_by_executive__c;
}
    public List<SelectOption> getproducts1(){
return productlist;
}
    Public void newPoline(){
   wrappo w=new wrappo();
   
    newpo=new Availability_In_Order_Lineitems__c();
    w.pol=newpo;
    w.newp=true;
    w.no=cou+1;
cou=cou+1;
    polist.add(w);
    }
    
    public void editprodu(){
     poedit=Apexpages.currentpage().getParameters().get('editid');
     edu=polmap.get(poedit);
     productname=edu.products__c;
    sno=Integer.valueof(Apexpages.currentpage().getParameters().get('sno'));
    }
public pagereference savepoedit(){
pagereference p;
if(edu!=null){
If(edu.products__c!=productname)
edu.products__c=productname;
update edu;
polist[sno-1].newp=false;
}
else{
polist[cou-1].pol.Availability_In_Order__c=poid;
polist[cou-1].pol.Products__c=productname;
insert polist[cou-1].pol;
polist[cou-1].newp=false;
}
general();
p=new pagereference('/'+poid);
return p;
}
public pagereference deleteprodu(){
pagereference p;
   poedit=Apexpages.currentpage().getParameters().get('deid');
     Availability_In_Order_Lineitems__c delpo=polmap.get(poedit);
     if(delpo!=null)
     delete delpo;
     //polist.clear();
     p=new pagereference('/'+poid);
    //general();
    return p;
}
} this  red mark  colour code is not  covering;

 

 

Hi

 

I am working on a old code. The line  sforce.connection.sessionId = "{!$Api.Session_ID}"; does not work anymore and prevents any other code line to get executed!!

 

Any Suggestions/ Alternatives?

 

Thanks

Pallavi

Hi everybody,

I have a mobile application Salesforce, in the user details's page, there is an SMS boutton, when I click on, I have to choose a template (Text body) and click Send .
The button have to send me to my mobile' SMS section with the choosed the template.
I'm stuck in the last step . How can i get from a mobile salesforce to SMS section ?

It works great with email and seletion templates too. So I just changed some paramettres as [Email = account.PersonEmail ;] by [Email = account.PersonMobilePhone ;]

VF page IC_GenerateSMS

<apex:page showHeader="false" docType="html-5.0" standardStylesheets="false" cache="false" Controller="IC_GenerateSMS_VFCx">
<html>
<head>
<title>{!$Label.IC_GenerateSMS}</title> 
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta name="apple-mobile-web-app-capable" content="yes" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />

<link rel="stylesheet" href="{!URLFOR($Resource.JQuery_120, 'jquery.mobile-1.2.0.min.css')}" />
<apex:includeScript value="{!URLFOR($Resource.JQuery_120, 'jquery-1.8.2.min.js')}"/>
<apex:includeScript value="{!URLFOR($Resource.JQuery_120, 'jquery.mobile-1.2.0.min.js')}"/>   

<!-- New Relic integration -->
<apex:includeScript value="{!IF($Setup.ICONSettings__c.NewRelic__c, $Resource.NewRelic, '')}"/>

<script>
    $j = jQuery.noConflict();
    var backUrl = '/apex/IC_ClientDetails?id={!accountId}';
    
    function logTask(subject) {
        console.log('Selected Template ' + subject);
        IC_GenerateSMS_VFCx.createTask('{!accountId}','{!Email}',subject,
                                          function(records, e) {console.log(records);}, {escape:true});
    }
    
    function createMail(){
        
        logTask(document.getElementById("initSubject").innerHTML);
        var email = document.getElementById("Email").innerHTML;
        var subject = encodeURIComponent(document.getElementById("initSubject").innerHTML);
        var body = encodeURIComponent(document.getElementById("initBody").innerHTML);
        window.location = "mailto:"+email+"?subject="+subject+"&body="+body;
    }
</script>    
</head>
<body>
    <!-- EMAIL TEMPLATE PREVIEW AND SELECTION -->
    <div data-role="page" data-theme="a" id="mainpage" data-fullscreen="true" data-add-back-btn="true">
        <!-- HEADER -->
        <div data-role="header">
            <a href="#" onclick="window.location.href=backUrl;" data-icon='arrow-l' style="box-shadow: none;" data-iconshadow="false" data-iconpos="notext"></a>
            <h1>{!$Label.IC_ChooseTemplate}</h1>
        </div>
        <!-- CONTENT -->
    <div data-role="content" data-fullscreen="true">   
       <ul data-role="listview" data-theme="a"  data-inset="true" >
           <li>
           <div>
            <!-- SMS TEMPLATE SELECTION FORM -->
            <apex:form >
             <!-- SMS TEMPLATE SELECTION LIST -->
             <center>
             <div data-role="fieldcontain">
                <label for="selectedTemplate">{!$Label.IC_SelectTemplate}</label>   
                <apex:selectList value="{!selectedTemplate}"  size="1" id="selectedTemplate">
                    <apex:selectOptions value="{!templateOptions}"/>
                    <apex:actionSupport event="onchange" action="{!previewTemplate}" rerender="counter"/>
                </apex:selectList>
             </div>  
             </center> 
                <!-- SMS TEMPLATE SELECTION PREVIEW -->
                <apex:outputpanel id="counter">
                    <!-- SMS TEMPLATE ENCODED FOR BROWSER PREVIEW -->          
                    <!-- <div id="Email">{!Email}</div>  -->
                    <br/>
                    <div id="Subject"></div>
                    <br/>
                    <div id="Body"></div>
                    <!-- SMS TEMPLATE ENCODED FOR MOBILE MAIL SYSTEM -->
                    <div id="initSubject" style="display:none;visbility:hidden;">{!initSubject}</div> 
                    <div id="initBody" style="display:none;visbility:hidden;">{!initBody}</div> 
                    <script>
                        document.getElementById("Subject").innerHTML = "{!Subject}";
                        document.getElementById("Body").innerHTML = "{!Body}";
                    </script>      
                </apex:outputpanel>
            </apex:form>
            <br/>
            <!-- BUTTON TO GENERATE SMS IN MOBILE MAIL SYSTEM -->
            <a data-role="button" data-direction="reverse" data-transition="none" href="javascript:createMail();" data-icon="false" data-iconpos="left">
                {!$Label.IC_GenerateSMS}
            </a>
            </div>
          </li>
          </ul>
        </div>
    </div>
</body>
</html>
</apex:page>


IC_GenerateSMS_VFCx Controller

public with sharing class IC_GenerateSMS_VFCx {
 /** Variable declarations **/
    public String accountId{get;set;}
    public String ownerId;
    private Account account;
    private User owner;
    private User Sender;
    //public String SMS{get;set;}
    public String Email{get;set;}
    public String Subject{get;set;}
    public String initBody{get;set;}
    public String initSubject{get;set;}
    public String Body{get;set;}
    private List<EmailTemplate> emailtemplates;
    private List<SelectOption> tempList = new List<SelectOption>();
    private EmailTemplate emailTemplate;
    public string selectedTemplate{get;set;}
    
    public IC_GenerateSMS_VFCx() {
        /** Retrieve sms templates dedicated to mobile device **/
        List<Folder> Folders = [Select Id, Name From Folder Where Type = 'Email' AND DeveloperName like  '%Mobile'];
        emailtemplates = [select Id,Name,Subject,body,IsActive from EmailTemplate Where Folder.Id IN :Folders AND IsActive = true  Order By Folder.Name, Name Limit 1 ];
        tempList.add(new SelectOption('NONE', '----- ' + Label.IC_None +' -----'));
        for (EmailTemplate emailTemp : emailtemplates) {
            tempList.add(new SelectOption(emailTemp.id, emailTemp.Name));
        }
        /** Retrieve current account and owner information **/
        accountId = ApexPages.currentPage().getParameters().get('id');
        //account = [select id, Salutation, FirstName, LastName, PersonEmail, OwnerId from Account where id =: accountId];
        account = IC_Factory.getAccountt(accountId);
        //Email = account.PersonEmail;
        Email = account.PersonMobilePhone;
        //owner = [select id, FirstName, LastName from User where id = :account.OwnerId];
        //Sender = [select id, defaultStore__c from User where id =: UserInfo.getUserId()];
        owner = IC_Factory.getUser(account.OwnerId);
        Sender = IC_Factory.getUser(userInfo.getUserId());
    }
    
    /** Provide options for email template list **/
    public List<SelectOption> getTemplateOptions() {
        return tempList;
    }
        
    /** Encode and provide email template content **/
    public PageReference previewTemplate(){
        if(selectedTemplate <> 'NONE'){
            emailTemplate = [select Id,Name,Subject,Body from EmailTemplate where Id =: selectedTemplate LIMIT 1];
            Subject = renderMergeFieldsAndReplaceEncoding(emailTemplate.Subject);
            Body = renderMergeFieldsAndReplaceEncoding(emailTemplate.Body);
            initSubject = renderMergeFields(emailTemplate.Subject);
            initBody = renderMergeFields(emailTemplate.Body);
        }else{
            Subject = '';
            Body = '';
            initSubject = '';
            initBody = '';
        }
        return null;
    }
    
    private String nullToText(String value) {
        return (value == null?'':value);
    }
    
    private String nullToText_Title(String value) {
        return IC_UTILS.getTranslationPicklistValue('Contact', 'Salutation', value);
    }
    
    private String nullToText_Salutation(String value) {
        return IC_UTILS.getTranslationPicklistValue('Contact', 'Salutation', value);
    }
    
    /** Replace dynamic fields by value **/
    private String renderMergeFields(String textToRender) {
        textToRender = textToRender.replace('{!Contact.Salutation}', account.Title__pc == null ? nullToText_Salutation(account.Salutation):nullToText_Title(account.Title__pc) );
        textToRender = textToRender.replace('{!Contact.FirstName}',  nullToText(account.FirstName));
        textToRender = textToRender.replace('{!Contact.LastName}',  nullToText(account.LastName));
        textToRender = textToRender.replace('{!Contact.OwnerFirstName}',  nullToText(owner.FirstName));
        textToRender = textToRender.replace('{!Contact.OwnerLastName}',  nullToText(owner.LastName));
        textToRender = textToRender.replace('{!User.FirstName}',  nullToText(UserInfo.getFirstName()));
        textToRender = textToRender.replace('{!User.LastName}',  nullToText(UserInfo.getLastName()));
        textToRender = textToRender.replace('{!User.DefaultStore__c}', nullToText(Sender.defaultStore__c));
        return textToRender;
    }
    
    /** Replace dynamic fields by value and formate for brower display **/
    private String renderMergeFieldsAndReplaceEncoding(String textToRender) {
    /*    
        textToRender = textToRender.replace('{!Contact.Salutation}', account.Salutation);
        textToRender = textToRender.replace('{!Contact.FirstName}', account.FirstName);
        textToRender = textToRender.replace('{!Contact.LastName}', account.LastName);
        textToRender = textToRender.replace('{!Contact.OwnerFirstName}', owner.FirstName);
        textToRender = textToRender.replace('{!Contact.OwnerLastName}', owner.LastName);
        textToRender = textToRender.replace('{!User.FirstName}', UserInfo.getFirstName());
        textToRender = textToRender.replace('{!User.LastName}', UserInfo.getLastName());
        textToRender = textToRender.replace('{!User.DefaultStore__c}', Sender.defaultStore__c);
     */
        textToRender = renderMergeFields(textToRender);    
        textToRender = textToRender.replace('\\n', '<br/>');
        return textToRender;
    }
    
    
    
    /**
    * Create new Task for current user and selected client when user click on SMS or Mobile
    **/
    @RemoteAction
    public static String createTask(String accountId, String numberPhone, String selectedTemplate) {
        system.debug ('*** createTask ');
        String tskSubject = Label.IC_SendEmail + ': ' + selectedTemplate; 
         
        String tskDescription =  String.format(Label.IC_TaskDescriptionEmail, new String[] {String.valueOf(Date.toDay()), UserInfo.getName(),  numberPhone, selectedTemplate });       
        
        Task newTask = IC_Factory.createTask(accountId, tskSubject, tskDescription, null, null, null, null, 'Email');
        newTask.TECH_is_AutoSave__c = true;
        return IC_Factory.insertTask(newTask);
    } 
    


Help Please !!

Am new to salesforce,

Someone please help me with these terms,

 

Whats an ajax request?

What does  calling asynchronously means??