• Vadivel Murugan
  • NEWBIE
  • 35 Points
  • Member since 2015

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 79
    Questions
  • 42
    Replies
I have just added render as pdf in visualforce page it's showing internal server error occurrend. This is problem is caused only lightning view. In classic view it's working perfect. I don't know why this is happening only in lightning view. Please let me know what the exact solution i need to resolve this issues.

An internal server error has occurred
An error has occurred while processing your request. The salesforce.com support team has been notified of the problem. If you believe you have additional information that may be of help in reproducing or correcting the error, please contact Salesforce Support. Please indicate the URL of the page you were requesting, any error id shown on this page as well as any other related information. We apologize for the inconvenience. 

Thank you again for your patience and assistance. And thanks for using salesforce.com! 

Error ID: 646268433-79671 (-1467699107)
Hi,

I have created the custom object with related to order. I have created the rollup summary in Order page. But when i have made changes in related list that time the rollup summary values not affected in parent pahe for Order. When i hae try to edit and save that time shown the error "Some one has modified the record, please reload" that time only the rollup summary values has been chaned. 

So please suggest any one when i have modify/create/delete record in related list that  time auto refresh the Order page(Parent Page) also. How to acheive this in lightning related list(Custom object)
Hi,

I have refresh the View page using e.force:refreshView for one component. But that time not rendering or Refersh the Other component. How we can refersh all the lightning components when Referesh View page time.
Hi All,

My original request, I have integreated salesforce with wecho256 categorey2 that field as id,name,quantity and price. 

But when i have try to update or delete the data via salesforce to wecho256 it's not working. below is my sample code here.

Update:

public void updatecat(){
    
        Token__c tkn=CollectToken();
        if(tkn==NULL){
            ApexPages.Message warningMsg = new ApexPages.Message(ApexPages.Severity.WARNING,'Connection has not been established. Please Connect with the server'); 
            ApexPages.addMessage(warningMsg );
        }
       
       String jsonsapaccounts = JSON.serializePretty(resData.category2);
        HttpRequest req = new HttpRequest();
        req.setMethod('PUT');
        req.setEndpoint('http://wecho256.com/api6/v1/update/category2?access_token='+tkn.Token__c);
        req.setBody( jsonsapaccounts );
        System.debug( '##### Serialized list of sapaccounts into JSON format: ' + req.getBody() );
        Http http = new Http();
        HTTPResponse resp = http.send( req );
        res = resp.getBody();
        if(res=='SUCCESS'){
            resData=new ResponseData();
            Delete tkn;
            showConnectBtn=true;
        }
        system.debug('>>>>res'+res);
        SaveRender=false;
    }

Delete:

public void deleteRow(){
     
     Token__c tkn=CollectToken();
        if(tkn==NULL){
            ApexPages.Message warningMsg = new ApexPages.Message(ApexPages.Severity.WARNING,'Connection has not been established. Please Connect with the server'); 
            ApexPages.addMessage(warningMsg );
        }
        
        Integer toDelPos=-1;
          for (Integer idx=0; idx<resData.category2.size(); idx++)
          {
           if (resData.category2[idx].id==rowIndex)
           {
            toDelPos=idx;
           }
          }
          system.debug('>>>toDelPos'+toDelPos); 
          if (-1!=toDelPos)
          {
            String jsonsapaccounts = JSON.serializePretty(resData.category2[toDelPos]);
            HttpRequest req = new HttpRequest();
            req.setMethod('POST');
            req.setEndpoint('http://wecho256.com/api6/v1/delete/category2?access_token='+tkn.Token__c);
            req.setBody( jsonsapaccounts );
            System.debug( '##### Serialized list of sapaccounts into JSON format: ' + req.getBody() );
            system.debug('req>>>>>'+req);
            Http http = new Http();
            HTTPResponse resp = http.send( req );
            res = resp.getBody();
            if(res=='SUCCESS'){
                resData=new ResponseData();
                Delete tkn;
                showConnectBtn=true;
            }
            system.debug('>>>>res'+res);
          }
           
     }

If anyone fknow kidly reply me. 
Hi I am going to diaply the more than records with action like edit and remove.

When i have click the edit commandlink button that row only allow to able to modify. suppose i have to click the third row edit commandlink button that row only allow to able to modify. If any know reply me.

i have attached my sample screen shot.User-added image

 
Hi All,

My original request, I have integreated salesforce with wecho256 categorey2 that field as id,name,quantity and price. 

But when i have try to update or delete the data via salesforce to wecho256 it's not working. below is my sample code here.

Update:

public void updatecat(){
    
        Token__c tkn=CollectToken();
        if(tkn==NULL){
            ApexPages.Message warningMsg = new ApexPages.Message(ApexPages.Severity.WARNING,'Connection has not been established. Please Connect with the server'); 
            ApexPages.addMessage(warningMsg );
        }
       
       String jsonsapaccounts = JSON.serializePretty(resData.category2);
        HttpRequest req = new HttpRequest();
        req.setMethod('PUT');
        req.setEndpoint('http://wecho256.com/api6/v1/update/category2?access_token='+tkn.Token__c);
        req.setBody( jsonsapaccounts );
        System.debug( '##### Serialized list of sapaccounts into JSON format: ' + req.getBody() );
        Http http = new Http();
        HTTPResponse resp = http.send( req );
        res = resp.getBody();
        if(res=='SUCCESS'){
            resData=new ResponseData();
            Delete tkn;
            showConnectBtn=true;
        }
        system.debug('>>>>res'+res);
        SaveRender=false;
    }

Delete:

public void deleteRow(){
     
     Token__c tkn=CollectToken();
        if(tkn==NULL){
            ApexPages.Message warningMsg = new ApexPages.Message(ApexPages.Severity.WARNING,'Connection has not been established. Please Connect with the server'); 
            ApexPages.addMessage(warningMsg );
        }
        
        Integer toDelPos=-1;
          for (Integer idx=0; idx<resData.category2.size(); idx++)
          {
           if (resData.category2[idx].id==rowIndex)
           {
            toDelPos=idx;
           }
          }
          system.debug('>>>toDelPos'+toDelPos); 
          if (-1!=toDelPos)
          {
            String jsonsapaccounts = JSON.serializePretty(resData.category2[toDelPos]);
            HttpRequest req = new HttpRequest();
            req.setMethod('POST');
            req.setEndpoint('http://wecho256.com/api6/v1/delete/category2?access_token='+tkn.Token__c);
            req.setBody( jsonsapaccounts );
            System.debug( '##### Serialized list of sapaccounts into JSON format: ' + req.getBody() );
            system.debug('req>>>>>'+req);
            Http http = new Http();
            HTTPResponse resp = http.send( req );
            res = resp.getBody();
            if(res=='SUCCESS'){
                resData=new ResponseData();
                Delete tkn;
                showConnectBtn=true;
            }
            system.debug('>>>>res'+res);
          }
           
     }

If anyone fknow kidly reply me.
Hi All,

I want to implement the Round Robin Job assignment for marketing user. If any one know how to implement this kindly reply...

Example:
I have created the Marketing User profile as a priority(Picklist) basics.
1.User1 - 1st priortiy
2.User2- 2nd priority
3. User3- No priority
Suppose i have create the record that time the user1 assign automatically to this job.
I have create another record user2 assign this job like repeatelly for user3 and again user1,user2,user3 and so....
I have create the one check box. if the check box is true the rule has been applied other wise it assign queue user. When tick that box automatically assign the who is the next user for Round Robin and assign it.

The above is my configuration. I will need to implement the using apex class.
<apex:page standardController="Service_Report__c" extensions="Photoupload1" showHeader="false" sidebar="false">
<html>
    <head>
        <script src="https://localhost/cordova.js"></script>
        <script type="text/javascript" src="https://code.jquery.com/jquery-1.9.1.min.js"></script>
        <script src="//ajax.googleapis.com/ajax/libs/jquery/2.0.3/jquery.min.js" ></script>
        
        <style>
        #wrapper {
      width:1600px;
      clear:both;
    }
        #first {
          width:800px;
          float:left;
        }
        #second {
          width:800px;
          float:left;
        }
        </style>
  </head>

           <title>Webcam</title>
<div  style="background-color:#FFF">
    <div  style="padding-top: 2%;padding-bottom: 1%;">
        <div class="col-md-2 col-md-offset-3" >
            <button class="btn btn-primary" style="margin-top:10px" id="snap" >Capture</button>
            <button class="btn btn-primary" style="margin-top:10px;display:none" id="new">Retake</button>    
            <button class="btn btn-primary" style="margin-top:10px;display:none" id="upload">Upload</button>
        </div>


        <div >
            <select class="form-control" style="margin-top:10px;display:none" id="videoSource"></select>
        </div>

    </div>
    <div style="padding-top: 2%;padding-bottom: 1%;" >
        <div align="center">
            <canvas id="canvas" style="display:none;width:100%;height:70%;"></canvas>
            <video class="myvideo" id="video" autoplay="autoplay" style="background-color: white;width:100%; height:70%;"></video> 
            <input id="video" type="file" accept="image/*;capture=camera"/>
        </div>
    </div> 

    <div id="el_loading" style="display:none;position: fixed;top:0;background-color: #fbfbfb; height:100%;opacity:0.65;width:100%;">
        <div  style="top: 50%; width: 91px;  margin: 20% 47%;"> 
            <img  src="/img/loading.gif" title="Please Wait..."/>
            <span>Saving...</span>
        </div>
    </div>  
</div>

<script>

function hideTheBoxComponent(){
        $("#myModal1").modal('hide'); 
    }

    function showDialogComponent(){
        $("#myModal1").modal({
          "backdrop"  : "static",
          "keyboard"  : true,
          "show"      : true 
        });
    }

    // Put event listeners into place
    window.addEventListener("DOMContentLoaded", function() {

        // Grab elements, create settings, etc.
        var canvas = document.getElementById("canvas"),
            context = canvas.getContext("2d"),
            video = document.getElementById("video"),
            videoObj = { "video": true },
            errBack = function(error) {
                console.log("Video capture error: ", error.code); 
            };

        // Capture Snap Photo
        document.getElementById("snap").addEventListener("click", function() {
            canvas.width = video.videoWidth;
            canvas.height = video.videoHeight;
            context.drawImage(video, 0, 0);
            // Littel effects
            $('#video').hide();
            $('#canvas').show();
            $('#snap').hide();
            $('#new').show();
            $('#upload').show();
        });

        // Capture New Photo
        document.getElementById("new").addEventListener("click", function() {
            $('#video').show();
            $('#canvas').hide();
            $('#snap').show();
            $('#new').hide();
            $('#upload').hide();
        });



    }, false);

    'use strict';

 var videoElement = document.querySelector("video");
 var videoSelect = document.querySelector("select#videoSource");
 navigator.getUserMedia = navigator.getUserMedia ||
 navigator.webkitGetUserMedia || navigator.mozGetUserMedia;

 function gotSources(sourceInfos) {
    for (var i = 0; i != sourceInfos.length; ++i) {
        var sourceInfo = sourceInfos[i];
         var option = document.createElement("option");
          option.value = sourceInfo.id;
         if (sourceInfo.kind === 'video') {
           option.text = sourceInfo.label || 'camera ' + (videoSelect.length + 1);
           videoSelect.appendChild(option);
              if( i == sourceInfos.length - 1 ) {
              option.selected = true;
               }
        } else {
            console.log('Some other kind of source: ', sourceInfo);
        }
     }
     start();
   }

   if (typeof MediaStreamTrack === 'undefined') {
    alert('This browser does not support MediaStreamTrack.\n\nTry Chrome Canary.');
   } else {
    MediaStreamTrack.getSources(gotSources);
   } 


   function successCallback(stream) {
    window.stream = stream; // make stream available to console
    videoElement.src = window.URL.createObjectURL(stream);
    videoElement.play();
   }

   function errorCallback(error) {
    console.log("navigator.getUserMedia error: ", error);
   }

    function start() {
    if (!!window.stream) {
        videoElement.src = null;
        window.stream.stop();
    }

    var videoSource = videoSelect.value;

    var constraints = {
        video: {
            optional: [{ sourceId: videoSource}]
       }
    };
    navigator.getUserMedia(constraints , successCallback, errorCallback);
    }
 </script>   
 
     
        <apex:form > 
             
             
     <apex:actionRegion >
    <apex:actionFunction action="{!saveImage}" name="saveImage" rerender="dummy">
        <apex:param name="imageBase" assignTo="{!imageBase}" value="" />
    </apex:actionFunction>
    <apex:outputPanel id="dummy"/>
</apex:actionRegion>


  </apex:form> 

</html>
</apex:page>

Hi All,

The above code i have used to capture the snapshot for mobile. But i have face one problem. This above code is working fine for Laptop Cam, Web Cam and Mobile browser app also. But does not work in android Salesforce1 app. How this could be recify the problem. Kindly reply to me...
Hi,

I am query Opportunity for Last 90 days. I would like to show the each table for weekly opportunity record in this 90days opportunity. So how to i have split the weekly record for sperate from last 90 days record. For example below like this

First Table: 2-12-2015 to 9-12-2015
Name Createddate Amount

Second Table: 10-12-2015 to 17-12-2015
Name Createddate Amount

This is again repeated for Last 90days Record. If anyone know reply to me how to achieve this.
Hi All,

I have query last 90days record for opportuniy. I need to put monthwise record in map. For exmaple.

opportunity Created date - 12-12-2015
Opportunity Created date - 03-01-2016

The above opportunity stored in different maps. how to store it in maps. Any one know please reply to me.
Hi,

I want to Show the tabular format for Created Opportunity in Last 90 days recode. I would like to shown in below:

1 - Month Record for one table
2 - Month Record for another table
3 - Month record for another table

1 - Month for Weekly table Opportunity
2 - Month for Weekly table Opportunity
3 - Month for Weekly table Opportunity

Finally i have shown all 3 month record in single table. If any know about this idea, Please share with me.
Hi,

I have implemented my below code has in future Method. But When I have done 'Mass Edit' for list view that time the Error has occurred in  System.StringException: Invalid id: at highlighted line.

 Private void UpdateVisitComplete(Map<Id,Service_Sheet_STD__c> newReActMap){

        String RSIdCollection;       
        for(Service_Sheet_STD__c rs:newReActMap.values()){
                if(String.valueOf(rs.id)!=Null){
                RSIdCollection=((RSIdCollection==NULL||RSIdCollection=='')?rs.id:RSIdCollection+','+rs.Id);    // The error has been occured this line.
                }
    }
        if(RSIdCollection!=NULL && ShouldIRun.CanIRun()) Future_UpdateVisitComplete(RSIdCollection);
        
    }
/*============== UpdateVisitComplete-FUture Method ======*/
 @future
Private static void Future_UpdateVisitComplete(String RSIdStringCollection){  
        
        Map<Id,Service_Sheet_STD__c> newReActMap;
        ShouldIRun.StopTrigger(); 
        List<String> rsIds=RSIdStringCollection.split(',',0);
        
        newReActMap =New Map<Id,Service_Sheet_STD__c>([SELECT id, Visit__c,Close_Visit__c,Fire_Extinguisher_Service_complete__c  from Service_Sheet_STD__c where ID IN:rsIds]);


        //Variable Declaration
        List<id> visitIds=new List<id>();
        for(Service_Sheet_STD__c rs:newReActMap.values()){
            if(rs.Visit__c!=NULL)
                visitIds.add(rs.visit__c);
        }
        System.debug('--------'+visitIds);
        //to get a list of Visits 
        List<Visits__c> visitList=[select id,Visit_Complete__c from Visits__c where ID IN:visitIds ];
        System.debug('--------'+visitList);
        for(Service_Sheet_STD__c rs:newReActMap.values()){
            for(Visits__c  vt :visitList){
                if(rs.Visit__c == vt.Id && rs.Close_Visit__c=='Yes' && rs.Fire_Extinguisher_Service_complete__c){
                    //assign  Visit Complete Field
                     vt.Visit_Complete__c =true;
               }
           }
        }
        try{
            if(visitList.size()>0){
            update visitList;     //update the Visits
            }    
        }Catch(Exception e){
            String msg=e.getMessage();
            for(Service_Sheet_STD__c ss:newReActMap.values()){
                ss.addError(msg);
            }
        }

}

If anyone know, Please suggest how to rectify this problem.
Hi All,

I want to create a report for Compare the two years last 90 days reports.

For Ex: This report must show the number of clients that bought(create opportunity) within 90 days from the last date of every month. Example: X-number of customer bought(createdopportunity) within 90 days from 31 March 2015, 30 April 2015, 31 May 2015 etc. The report must also compare 2014 to 2015
Hi,

Please any know how add more than 1000 values in multipick list. When i have to add more than 1000 values in multipick list values to show the error in: Collection size 2,821 exceeds maximum size of 1,000. How to rectify these problem.

My Vf page is:

<apex:page standardController="Engineer__c" extensions="MultiListselectController" showHeader="false">
 
 <apex:form >
  <apex:pageBlock title="Postal Code">
  
            <c:MultiselectPicklist leftLabel="Available Postal Code" 
            rightLabel="Selected Postal Code" 
            width="150px" size="14" 
            leftOption="{!allCodes}" rightOption="{!selectedCode}">
            </c:MultiselectPicklist>
 

            <apex:pageBlockButtons >
                <apex:commandButton action="{!save}" value="OK" />
                <apex:commandButton action="{!cancel}" value="Cancel"/>
            </apex:pageBlockButtons>
        </apex:pageBlock>
    
  </apex:form>
  
</apex:page>

My Controller:

public with sharing class MultiListselectController {

    public SelectOption[] selectedCode { get; set; }
    public SelectOption[] allCodes { get; set; }
    String code;
    
  /*  public PaginatedSelectList allCodes{
        get{
            if(allCodes==null){
                  allCodes=new PaginatedSelectList();
                  for(Postal_Code__c c:[SELECT Name FROM Postal_Code__c]){
                        allCodes.add(new SelectOption(c.Name,c.Name));
                  }
            }
            return allCodes;
        }
        set;
    }
    */
    
    List <String> Postalexscode;
    List<Postal_Code1__c> prd =new List<Postal_Code1__c>();
    
    Engineer__c codes;
 
    public MultiListselectController(ApexPages.StandardController controller) {
        
        selectedCode = new List<SelectOption>();
        
      allCodes= new List<SelectOption>();
        
        codes = [select Postcode_Areas__c from Engineer__c where id=:apexpages.currentpage().getparameters().get('id')];
        
        if(codes.Postcode_Areas__c != null){
        Postalexscode = codes.Postcode_Areas__c.split(',',0);
        prd = [SELECT Name FROM Postal_Code1__c where Name!=: Postalexscode];
        }
        else{
        prd = [SELECT Name FROM Postal_Code1__c];
        }
        
       for (Postal_Code1__c c: prd) {
               
               allCodes.add(new SelectOption(c.Name,c.Name));
       }
      
 }
      
    public PageReference save() {
    
    if(codes.Postcode_Areas__c == null)
    codes.Postcode_Areas__c ='';
    
        for (SelectOption so : selectedCode) {
        if(codes.Postcode_Areas__c == '')
        codes.Postcode_Areas__c += so.getLabel();
        else
        codes.Postcode_Areas__c += ','+so.getLabel();
        }
        
        update codes;
        
        return new PageReference('/'+apexpages.currentpage().getparameters().get('id'));       
    }
    
    public PageReference cancel() {
    return new PageReference('/'+apexpages.currentpage().getparameters().get('id')); 
    }
}

Any one know reply me.
I have create a visualforce page to use fullcalendar in jquery. Here i have using the views: type is time. when i have use time line type my header date format not changed using columnFormat:'DD/MM/YYYY'. If any one know reply me.

views: {
                            timelineThreeDays: {
                                type: 'timeline',
                                slotLabelInterval: '12:00:00',
                                titleFormat: 'DD/MM/YYYY',
                                duration: { days: 5 }
                            },
resourceLabelText: 'Technicians Name',
                        resources: [
                            <apex:repeat value="{!AllVisitList}" var="e">
                            {
                            'id': '{!e.techid}',
                            'title' : '{!e.techname}' 
                            },
                            </apex:repeat>
                        ],
                        events: [
                            <apex:repeat value="{!AllVisitList}" var="e">
                            {
                            title: '{!e.title}'+"\n"+'{!e.serviceType }'+"\n"+'{!e.siteName}',
                            start: '{!e.startString}',
                            end: '{!e.endString}',
                            allDay: false,
                            url: '{!e.url}',
                            className: '{!e.className}',
                            
                            resourceId: ['{!e.Techresource}']
                            },
                                                </apex:repeat>
                                                
                                                ],
                            
                                                columnFormat: 'DD/MM/YYYY' //Not Working for when Type is 'Timeline' , but its work for agenda,basic.                                                                                                   But not work in timeline type. 
                                                });
Screen Shot:

User-added image
 
Hi,

I have create a rich text area custom field. In this field allow to image also. Then how to check the rich text area is null or not when image is displayed. Any one know reply it.
Hi,

I have create a visualforce page with controller. I have create a button "send" when click this button that time i have call the email template. In my email template i have use " Component". But that time <c:PricelistFAELcontroller1 Serviceid="{!relatedTo.id}" ServiceSheet="{!relatedTo}"/>.
b
ut here my id, and type not populate in visualforce page into visualforce email template. How to pass id,object type into visualforce page into visualforce email component. Any one konow reply me.
public PageReference SaveasPdf(){
 Blob b;
system.debug('CurrentId>>>'+currentid);
 Attachment newAttach = new Attachment();
 PageReference ref = Page.Hydrant_Service_Sheet;

 if(!Test.isRunningTest())  // Error: Compile Error: Method does not exist or incorrect signature: [String].isRunningTest() at line 18 column 6
{
 b = ref.getContentAsPDF();
}
else{
 b = Blob.valueOf('Unit Test Attachment Body');



 newAttach.Name = 'Uplift Request';
 newAttach.ParentId = currentid;
 newAttach.Body = b;
 
 Insert newAttach;
 system.debug('CurrentId>>>'+currentid);
 PageReference pageRef = new PageReference('/'+currentid);
 pageRef.setRedirect(true);
 return pageRef;
}

Error occured in above. But i have check code is correct. if any one konow i do anymistake this rely...........
public PageReference sendEmail(){

//Creating the Contact
        Contact tempContact  = new Contact();
            tempContact.LastName ='test';
            tempContact.firstName = 'testmerfantz';
            tempContact.email = 'noreply@salesforce.com';
            tempContact.Account = [select id, name from Account limit 1];
        Insert tempContact;
        
Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage();
emailTo=emailadd;
mail.setToAddresses(new String[] {emailTo});

PageReference ref = Page.PricelistFAEL;
Blob b = ref.getContentAsPDF();
Messaging.EmailFileAttachment efa1 = new Messaging.EmailFileAttachment();
efa1.setFileName('Uplift Request.pdf');
efa1.setBody(b);
mail.setFileAttachments(new Messaging.EmailFileAttachment[] {efa1});

mail.setTemplateId([select id, name from EmailTemplate where Name='Calculate Amount'].id);
    mail.setTargetObjectId(tempContact.id);
    mail.setSaveAsActivity(false);
    mail.setWhatId(apexpages.currentpage().getparameters().get('id'));
    
try{
Messaging.SendEmailResult[] resultMail = Messaging.sendEmail(new Messaging.SingleEmailMessage[] { mail });
if(resultMail[0].isSuccess()) {     
response = 'Your Mail Successfully sent!';
flag=false;
}
else{
response = resultMail[0].getErrors().get(0).getMessage();
}
}catch(System.EmailException ex){
response = ex.getMessage();
}  

// Delete the tempContact
       Delete tempContact; 
       
return null;
}

public PageReference SaveasPdf(){
system.debug('CurrentId>>>'+currentid);
 Attachment newAttach = new Attachment();
 PageReference ref = Page.PricelistFAEL;
 Blob b = ref.getContentAsPDF();
 
 newAttach.Name = 'Uplift Request';
 newAttach.ParentId = currentid;
 newAttach.Body = b;
 
 Insert newAttach;
 system.debug('CurrentId>>>'+currentid);
 PageReference pageRef = new PageReference('/'+currentid);
 pageRef.setRedirect(true);
 return pageRef;
}

Hi, I want the test class for these two methods. If anyone know reply......
<apex:inputField id="sla" value="{!Service_Sheet_STD__c.Order_Date__c}"/> This present one page.
When click the button this page open one vf page.

window.top.location.href ='/'+'{!Service_Sheet_STD__c.id}'+'/e?'+'retURL='+'{!Service_Sheet_STD__c.id}+"&sla="';  i have try this and
window.top.location.href ='/'+'{!Service_Sheet_STD__c.id}'+'/e?'+'retURL='+'{!Service_Sheet_STD__c.id}+"PageRefresh:Form1:complete_page_edit:j_id81:sla="'; with inspect element but not work.

This code present in that page. When  have to close automatically go previous page and clear the above input field using javascript url. In normal custom text field i get inspect element. but input field not work. if any one know reply me.
I am trying to update a contact based on accout Code not a account name (field of contact). this Account code is available in Account.
When i create a new contact i will give a account code , at that time account name need to update based on this account code only...

Here is the following Code, can you please give me a proper trigger for this process

********************************************************************************
trigger ContactMapToAccount on Contact (before insert , before update) {
     
    //Set Of Id In Contact Code & Id
    Set<Id> conId = New Set<Id>();
    Set<Id> conCode = New Set<Id>();
    for(Contact c : Trigger.New){
        conId.add(c.Id);
        
    }
    
    List<Contact> lstCont = [Select id, Account_Code__c, name from Contact Where ID IN :conId];
    Map<Id,Account> acMap = new Map<Id,Account>();
    for(Account a : lstCont){
        acMap.put(a.id, a);
        
    }
    
    for(Contact c : lstCont){
        
        c.Account_Code__c = acMap.get(a.Account_Code__c);
    }
}


**************************

Thnaks in advance
Hi I am going to diaply the more than records with action like edit and remove.

When i have click the edit commandlink button that row only allow to able to modify. suppose i have to click the third row edit commandlink button that row only allow to able to modify. If any know reply me.

i have attached my sample screen shot.User-added image

 
public class sparedetails
{
    public Spare_Details__c sparedet{get;set;}
    public String sparedetail {get;set;}
    public String asparedetail {get;set;}
    public Boolean check{get;set;}
    public Boolean pcheck{get;set;}
    public Engineer_Checklist__c ec{get;set;}
    public List<sparts> ssList{get;set;}    
    
    public class sparts{
        public List<SelectOption> sdetail{get;set;}
        public List<selectOption> sdetaildep{get;set;}
        public integer qty{get;set;}
        public String aparts{get;set;}
        public sparts(){
            this.sdetail=sdetails();  // Here how to call, i have call this type error in "Invalid Field"
            this.sdetaildep=getasparedetails(); // Same as here
            this.qty=0;
            this.aparts='';
        }
    }
    
    public sparedetails(ApexPages.StandardController controller) {
    check=false;
    pcheck=false;
    //ec=[select id,Engineer__r.name from Engineer_Checklist__c where id=:apexpages.currentpage().getparameters().get('id')];
    //sparedet = [select aspareparts__c,qty__c,spareparts__c,sparepartsinp__c from Spare_Details__c where id=:apexpages.currentpage().getparameters().get('id')];
    ssList=new List<sparts>();
    }
    
    public PageReference addrow(){
             
        ssList.add(new sparts());
        return null;
    }
    public void removeRow(){
        Integer count=Integer.valueOf(apexpages.currentpage().getparameters().get('index'));
        ssList.remove(count);
    }
    
    public List<SelectOption> sdetails()
    {
        List<SelectOption> spd = new List<SelectOption>();
        
        spd.add(new SelectOption('None','--- None ---')); 
        spd.add(new SelectOption('sd','Smoke Detector')); 
        spd.add(new SelectOption('hd','Heat Detector')); 
        spd.add(new SelectOption('msd','Multi Sensor Detector')); 
        spd.add(new SelectOption('bs','Base')); 
        spd.add(new SelectOption('ss','Smoke Sounder')); 
        spd.add(new SelectOption('hs','Heat Sounder')); 
        spd.add(new SelectOption('bc','Breakglass Callpoint')); 
        spd.add(new SelectOption('tk','Test Keys')); 
        spd.add(new SelectOption('rg','Replacement Glass')); 
        spd.add(new SelectOption('bc','Breakglass Cover')); 
        spd.add(new SelectOption('es','Electronic Sounder')); 
        spd.add(new SelectOption('fb','Fire Bell')); 
        spd.add(new SelectOption('bec','Beacon')); 
        spd.add(new SelectOption('dr','Door Release')); 
        spd.add(new SelectOption('pc','Printer Consumables')); 
        spd.add(new SelectOption('slab','SLA Battery')); 
        spd.add(new SelectOption('nic','Nicad Hi-Temp Cells X'));
        spd.add(new SelectOption('anic','Additional Nicad Hi-Temp Cells X'));
        spd.add(new SelectOption('el','Emergency Lights'));
        spd.add(new SelectOption('ael','Additional Emergency Lights'));
        spd.add(new SelectOption('elt','EL Tube'));
        spd.add(new SelectOption('aelt','Additional EL Tube'));
        spd.add(new SelectOption('ftt','4,6,8FT Tube'));
        spd.add(new SelectOption('lbs','Log Book Supplied - Qty'));
        spd.add(new SelectOption('oth','Other'));        
        return spd;  
    } 
    
    public List<SelectOption> getasparedetails()
    {
        List<SelectOption> spdl = new List<SelectOption>();   
        
        if(sparedetail  == 'None'){
        check=false;
        }
         
        if(sparedetail  == 'sd' || sparedetail  == 'hd' || sparedetail  == 'ss' || sparedetail  == 'hs' || sparedetail  == 'es' || sparedetail  == 'bec'){
        
        pcheck=true;
        
            spdl.add(new SelectOption('at','ADT'));
            spdl.add(new SelectOption('ad','Apollo Discovery'));
            spdl.add(new SelectOption('as65','Apollo S65'));
            spdl.add(new SelectOption('ax95','Apollo XP95'));
            spdl.add(new SelectOption('aut','Autronica'));
            spdl.add(new SelectOption('ed','EDA'));
            spdl.add(new SelectOption('em','EMS'));
            spdl.add(new SelectOption('get','Gent'));
            spdl.add(new SelectOption('hoc','Hochiki'));
            spdl.add(new SelectOption('nitt','Nittan'));
            spdl.add(new SelectOption('not','Notifier'));
            spdl.add(new SelectOption('men','Menvier'));
            spdl.add(new SelectOption('pro','Protec'));
            spdl.add(new SelectOption('raf','Rafiki'));
            spdl.add(new SelectOption('sys','Systemsensor'));
            spdl.add(new SelectOption('zit','Ziton'));
            spdl.add(new SelectOption('oth','Other'));
        }        
        if(sparedetail  == 'msd'){
        }        
        if(sparedetail  == 'bs'){        
        pcheck=true;
            spdl.add(new SelectOption('db','Detector Base'));
            spdl.add(new SelectOption('dob','Diode Base'));
        }        
        if(sparedetail  == 'bc'){   
        pcheck=true;     
            spdl.add(new SelectOption('at','ADT'));
            spdl.add(new SelectOption('ad','Apollo Discovery'));
            spdl.add(new SelectOption('as65','Apollo S65'));
            spdl.add(new SelectOption('ax95','Apollo XP95'));
            spdl.add(new SelectOption('aut','Autronica'));
            spdl.add(new SelectOption('ed','EDA'));
            spdl.add(new SelectOption('em','EMS'));
            spdl.add(new SelectOption('get','Gent'));
            spdl.add(new SelectOption('hoc','Hochiki'));
            spdl.add(new SelectOption('nitt','Nittan'));
            spdl.add(new SelectOption('not','Notifier'));
            spdl.add(new SelectOption('men','Menvier'));
            spdl.add(new SelectOption('pro','Protec'));
            spdl.add(new SelectOption('raf','Rafiki'));
            spdl.add(new SelectOption('sys','Systemsensor'));
            spdl.add(new SelectOption('zit','Ziton'));
            spdl.add(new SelectOption('wp','Waterproof'));
            spdl.add(new SelectOption('oth','Other'));
        }        
        if(sparedetail  == 'tk' || sparedetail  == 'rg' || sparedetail  == 'bc' || sparedetail  == 'fb' || sparedetail  == 'dr' || sparedetail  == 'pc' || sparedetail  == 'ftt' || sparedetail  == 'lbs' || sparedetail  == 'oth'){
            check = true;
            pcheck=false;
        }        
        if(sparedetail  == 'slab'){
        pcheck=true;        
            spdl.add(new SelectOption('1.2a','12v 1.2Ah'));
            spdl.add(new SelectOption('12a','12v 12Ah'));
            spdl.add(new SelectOption('17a','12v 17Ah'));
            spdl.add(new SelectOption('2.1a','12v 2.1Ah'));
            spdl.add(new SelectOption('2.8a','12v 2.8Ah'));
            spdl.add(new SelectOption('24a','12v 24Ah'));
            spdl.add(new SelectOption('3.2a','12v 3.2Ah'));
            spdl.add(new SelectOption('7a','12v 7Ah'));
            spdl.add(new SelectOption('10a','6v 10Ah'));
            spdl.add(new SelectOption('ed','EDA'));
            spdl.add(new SelectOption('es','EMS'));
        }        
        if(sparedetail  == 'nic' || sparedetail  == 'anic'){     
        pcheck=true;   
            spdl.add(new SelectOption('1c','1 Cell'));
            spdl.add(new SelectOption('2c','2 Cell'));
            spdl.add(new SelectOption('3c','3 Cell'));
            spdl.add(new SelectOption('4c','4 Cell'));
            spdl.add(new SelectOption('5c','5 Cell'));
            spdl.add(new SelectOption('oth','Other'));
        }        
        if(sparedetail  == 'el' || sparedetail  == 'ael'){  
        pcheck=true;      
            spdl.add(new SelectOption('16w','16w 2D'));
            spdl.add(new SelectOption('28w','28w 2D'));
            spdl.add(new SelectOption('38w','38w 2D'));
            spdl.add(new SelectOption('2d','28w 2D c/w P/c'));
            spdl.add(new SelectOption('8w','8w Bulkhead'));
            spdl.add(new SelectOption('eb','Exit Box'));
            spdl.add(new SelectOption('ld','LED'));
            spdl.add(new SelectOption('ldb','LED Bulkhead'));
            spdl.add(new SelectOption('leb','LED Exit box'));
            spdl.add(new SelectOption('lgd','Legend'));
            spdl.add(new SelectOption('tb','Twinspot Beam'));
        }        
        if(sparedetail  == 'elt' || sparedetail  == 'aelt'){   
        pcheck=true;     
            spdl.add(new SelectOption('4w','4 Watt Tube rep.'));
            spdl.add(new SelectOption('6w','6 Watt Tube rep.'));
            spdl.add(new SelectOption('8w','8 Watt Tube rep.'));
            spdl.add(new SelectOption('2d','2D Lamp/Biax'));
        }    
          
        return spdl;
    }       
}


Here how to call my picklist method in wrapper class.
 
MY VF PAGE:

<apex:page standardController="Engineer_Checklist__c" extensions="sparedetail">
    
    <apex:form >
    
    <apex:pageBlock >
    
    
        <apex:pageBlockSection columns="5" title="Spare Details">
        
            <apex:pageblockSectionItem > 
                         
                <apex:selectList size="1" multiselect="false" value="{!selspare}">
                    <apex:selectOptions value="{!Spare}"/>
                    <apex:actionSupport event="onchange" reRender="a"/>
                </apex:selectList>   
                         
            </apex:pageblockSectionItem>
                      
            <apex:pageblockSectionItem >
                <apex:selectList size="1" multiselect="false" value="{!sparedetails}" id="a">
                    <apex:selectOptions value="{!sparedetails}"/>
                </apex:selectList>
            </apex:pageblockSectionItem> 
             <apex:inputField value="{!sparedet.sparepartsinp__c}" rendered="{!check}"/>
             <apex:inputField label="QTY" value="{!sparedet.qty__c}"/> 
                                 
        </apex:pageBlockSection>        
    </apex:pageBlock>

    </apex:form>

</apex:page>

My Controller:

public with sharing class sparedetail {

    public Spare_Details__c sparedet{get;set;}
    public boolean check{get;set;}
    public String selspare{get;set;}
    public List<SelectOption> Spare{get;set;}
    public List<SelectOption> sparedetail {get;set;}
    public List<SelectOption> sparedetails{get;set;}
    public Engineer_Checklist__c ec{get;set;}
    

    public sparedetail(ApexPages.StandardController controller) {
    check =false;
    
    //sparedet = [select spareparts__c,aspareparts__c,sparepartsinp__c,qty__c from Spare_Details__c where id=:apexpages.currentpage().getparameters().get('id')];
    ec=[select id,Engineer__r.name from Engineer_Checklist__c where id=:apexpages.currentpage().getparameters().get('id')];
        Spare=Spares();
        
    }

    
    public PageReference addrow(){
        //sparedet.add(new Spare_Details__c(service_sheet__c=ec.id));
        return null;
    }
    
    public List<SelectOption> Spares() {
    
        List<SelectOption> spd = new List<SelectOption>();
        
        spd.add(new SelectOption('None','--- None ---')); 
        spd.add(new SelectOption('sd','Smoke Detector')); 
        spd.add(new SelectOption('hd','Heat Detector')); 
        spd.add(new SelectOption('msd','Multi Sensor Detector')); 
        spd.add(new SelectOption('bs','Base')); 
        spd.add(new SelectOption('ss','Smoke Sounder')); 
        spd.add(new SelectOption('hs','Heat Sounder')); 
        spd.add(new SelectOption('bc','Breakglass Callpoint')); 
        spd.add(new SelectOption('tk','Test Keys')); 
        spd.add(new SelectOption('rg','Replacement Glass')); 
        spd.add(new SelectOption('bc','Breakglass Cover')); 
        spd.add(new SelectOption('es','Electronic Sounder')); 
        spd.add(new SelectOption('fb','Fire Bell')); 
        spd.add(new SelectOption('bec','Beacon')); 
        spd.add(new SelectOption('dr','Door Release')); 
        spd.add(new SelectOption('pc','Printer Consumables')); 
        spd.add(new SelectOption('slab','SLA Battery')); 
        spd.add(new SelectOption('nic','Nicad Hi-Temp Cells X'));
        spd.add(new SelectOption('anic','Additional Nicad Hi-Temp Cells X'));
        spd.add(new SelectOption('el','Emergency Lights'));
        spd.add(new SelectOption('ael','Additional Emergency Lights'));
        spd.add(new SelectOption('elt','EL Tube'));
        spd.add(new SelectOption('aelt','Additional EL Tube'));
        spd.add(new SelectOption('ftt','4,6,8FT Tube'));
        spd.add(new SelectOption('lbs','Log Book Supplied - Qty'));
        spd.add(new SelectOption('oth','Other'));
        
        return spd;  
    }
    
    public List<SelectOption> sparedetails(){
    
    List<SelectOption> spdl = new List<SelectOption>();
    
    if(selspare == 'sd' || selspare == 'hd' || selspare == 'ss' || selspare == 'hs' || selspare == 'es' || selspare == 'bec'){
    
    spdl.add(new SelectOption('at','ADT'));
    spdl.add(new SelectOption('ad','Apollo Discovery'));
    spdl.add(new SelectOption('as65','Apollo S65'));
    spdl.add(new SelectOption('ax95','Apollo XP95'));
    spdl.add(new SelectOption('aut','Autronica'));
    spdl.add(new SelectOption('ed','EDA'));
    spdl.add(new SelectOption('em','EMS'));
    spdl.add(new SelectOption('get','Gent'));
    spdl.add(new SelectOption('hoc','Hochiki'));
    spdl.add(new SelectOption('nitt','Nittan'));
    spdl.add(new SelectOption('not','Notifier'));
    spdl.add(new SelectOption('men','Menvier'));
    spdl.add(new SelectOption('pro','Protec'));
    spdl.add(new SelectOption('raf','Rafiki'));
    spdl.add(new SelectOption('sys','Systemsensor'));
    spdl.add(new SelectOption('zit','Ziton'));
    spdl.add(new SelectOption('oth','Other'));
    }
    
    if(selspare == 'msd'){
    }
    
    if(selspare == 'bs'){
    
    spdl.add(new SelectOption('db','Detector Base'));
    spdl.add(new SelectOption('dob','Diode Base'));
    }
    
    if(selspare == 'bc'){
    
    spdl.add(new SelectOption('at','ADT'));
    spdl.add(new SelectOption('ad','Apollo Discovery'));
    spdl.add(new SelectOption('as65','Apollo S65'));
    spdl.add(new SelectOption('ax95','Apollo XP95'));
    spdl.add(new SelectOption('aut','Autronica'));
    spdl.add(new SelectOption('ed','EDA'));
    spdl.add(new SelectOption('em','EMS'));
    spdl.add(new SelectOption('get','Gent'));
    spdl.add(new SelectOption('hoc','Hochiki'));
    spdl.add(new SelectOption('nitt','Nittan'));
    spdl.add(new SelectOption('not','Notifier'));
    spdl.add(new SelectOption('men','Menvier'));
    spdl.add(new SelectOption('pro','Protec'));
    spdl.add(new SelectOption('raf','Rafiki'));
    spdl.add(new SelectOption('sys','Systemsensor'));
    spdl.add(new SelectOption('zit','Ziton'));
    spdl.add(new SelectOption('wp','Waterproof'));
    spdl.add(new SelectOption('oth','Other'));
    }
    
    if(selspare == 'tk' || selspare == 'rg' || selspare == 'bc' || selspare == 'fb' || selspare == 'dr' || selspare == 'pc' || selspare == 'ftt' || selspare == 'lbs' || selspare == 'oth'){
    check = true;
    }
    
    if(selspare == 'slab'){
    
    spdl.add(new SelectOption('1.2a','12v 1.2Ah'));
    spdl.add(new SelectOption('12a','12v 12Ah'));
    spdl.add(new SelectOption('17a','12v 17Ah'));
    spdl.add(new SelectOption('2.1a','12v 2.1Ah'));
    spdl.add(new SelectOption('2.8a','12v 2.8Ah'));
    spdl.add(new SelectOption('24a','12v 24Ah'));
    spdl.add(new SelectOption('3.2a','12v 3.2Ah'));
    spdl.add(new SelectOption('7a','12v 7Ah'));
    spdl.add(new SelectOption('10a','6v 10Ah'));
    spdl.add(new SelectOption('ed','EDA'));
    spdl.add(new SelectOption('es','EMS'));
    }
    
    if(selspare == 'nic' || selspare == 'anic'){
    
    spdl.add(new SelectOption('1c','1 Cell'));
    spdl.add(new SelectOption('2c','2 Cell'));
    spdl.add(new SelectOption('3c','3 Cell'));
    spdl.add(new SelectOption('4c','4 Cell'));
    spdl.add(new SelectOption('5c','5 Cell'));
    spdl.add(new SelectOption('oth','Other'));
    }
    
    if(selspare == 'el' || selspare == 'ael'){
    
    spdl.add(new SelectOption('16w','16w 2D'));
    spdl.add(new SelectOption('28w','28w 2D'));
    spdl.add(new SelectOption('38w','38w 2D'));
    spdl.add(new SelectOption('2d','28w 2D c/w P/c'));
    spdl.add(new SelectOption('8w','8w Bulkhead'));
    spdl.add(new SelectOption('eb','Exit Box'));
    spdl.add(new SelectOption('ld','LED'));
    spdl.add(new SelectOption('ldb','LED Bulkhead'));
    spdl.add(new SelectOption('leb','LED Exit box'));
    spdl.add(new SelectOption('lgd','Legend'));
    spdl.add(new SelectOption('tb','Twinspot Beam'));
    }
    
    if(selspare == 'elt' || selspare == 'aelt'){
    
    spdl.add(new SelectOption('4w','4 Watt Tube rep.'));
    spdl.add(new SelectOption('6w','6 Watt Tube rep.'));
    spdl.add(new SelectOption('8w','8 Watt Tube rep.'));
    spdl.add(new SelectOption('2d','2D Lamp/Biax'));
    }
    
 return spdl;
    }
    
 }

Hello I have to like create a dependency picklist in vf page. But my first picklist value has been displayed. But when i have to change first picklist the second picklist not changed and also not displayed. IF anyone know please let me.
<apex:page >   
    <apex:includeScript value="{!URLFOR($Resource.dateformat)}" />
    <apex:includeScript id="a" value="https://www.google.com/jsapi" />  
    
    <apex:sectionHeader subtitle="Reactive Call Outs Per Day"/>
    <!-- Google Charts will be drawn in this DIV -->
    <div id="chart_div" />
   
    <script type="text/javascript" src="/soap/ajax/20.0/connection.js"></script>
    <script type="text/javascript">
    
        sforce.connection.sessionId  = "{!$Api.Session_ID}";
        var result = sforce.connection.query("SELECT DAY_ONLY(CreatedDate) days, count(createdDate) counts FROM Visits__c where createdDate = LAST_N_Days:90 AND Cancelled__c = false AND Visit_Type__c = 'Reactive' AND (Call_Out_Types__c = 'Call Out' OR Call_Out_Types__c = 'Revisit' OR Call_Out_Types__c = 'Recall' OR Call_Out_Types__c = 'Revisit - P&L Only') AND (NOT(Site__r.Name = 'Messages' OR Site__r.Name = 'Holidays' OR Site__r.Name = 'Projects Work' OR Site__r.Name = 'Training' OR Site__r.Name = 'Unifier Test Customer' OR Site__r.Name = 'Unifier Test Customer - Site A' OR Site__r.Name = 'Unifier Test Customer - Site B' OR Site__r.Name = 'Unifier Test Customer - Site C' OR Site__r.Name = 'Unifier Test Customer - Site D')) GROUP BY DAY_ONLY(CreatedDate) order by DAY_ONLY(createdDate) desc");
        
        records = result.getArray("records");
        
        // Load the Visualization API and the piechart package.
        google.load('visualization', '1.0', {'packages':['corechart']});
        google.load("visualization", "1", {packages: ["scatter"]});
        
        google.setOnLoadCallback(drawCharts);
        
        function drawCharts() {         
            var data = new google.visualization.DataTable(); 
            
            data.addColumn('string', 'Created Date');
            data.addColumn('number', 'Record Count');
            data.addRows(records.length);
            
            for(var i = 0 ; i < records.length ; i++){
                       
           var dateformat = moment(records[i].days).format("DD-MM-YYYY");
              
                data.setValue(i,0,dateformat);
                data.setValue(i,1,records[i].counts);
            }
            
            var options = {
                title: '',
                hAxis: {title: 'Created Date'},
                vAxis: {title: 'counts'},
                legend: 'none',
                trendlines: { 0: {color: 'green',} }    // Draw a trendline for data series 0.
              };
        
        var visualization = new google.visualization.ColumnChart(document.getElementById('chart_div')); 
        visualization.draw(data, {showRowNumber: true, width: '1250', height: '500'}, options);
               
    }
    </script>
</apex:page>


IN this above code Trend Line is not showing chart. Why? anyone know reply.
<apex:page >

<apex:includeScript id="a" value="https://www.google.com/jsapi" />

<apex:sectionHeader subtitle="Reactive Call Outs Per Day"/>

<!-- Google Charts will be drawn in this DIV -->
<div id="chart_div" />

    <script type="text/javascript" src="/soap/ajax/29.0/apex.js"></script>
    <script type="text/javascript" src="/soap/ajax/20.0/connection.js"></script>
    <script type="text/javascript">

            var result = sforce.connection.query("SELECT DAY_ONLY(CreatedDate) days, count(createdDate) counts FROM Visits__c where createdDate = LAST_N_Days:90  GROUP BY DAY_ONLY(CreatedDate) order by DAY_ONLY(createdDate) desc");
            records = result.getArray("records");
            alert(records);
            
    
   // Load the Visualization API and the piechart package.
    google.load('visualization', '1.0', {'packages':['corechart']});
    
    google.setOnLoadCallback(drawCharts);

    function drawCharts() {         
     
           var data = new google.visualization.arrayToDataTable();
           
               data.addColumn('date', 'Created Date');
               data.addColumn('number', 'Record Count');
               
                              
             for(var i =0; i<records.length;i++)
                 data.Rows.add(['records[i].days', 'records[i].counts']);
                   
                 
                 var options = {
                title: '',
                hAxis: {title: 'days'},
                vAxis: {title: 'counts'},
                legend: 'none',
                trendlines: { 0: {color: 'red',} }    // Draw a trendline for data series 0.
              };   
               
          var visualization = new google.visualization.ColumnChart(document.getElementById('chart_div'));  
              
          visualization.draw(data,options);
          
           
          
      }
</script>
</apex:page>


In this above code Query working correctly. But Chart is not displayed Why?.......
Hi All,
          I have create a button in Account standard page as "Save as PDF". When i have to click that button to save the current Account standard page save as pdf. If any know how to save Standard page as PDF.
Hello,

Any one know how to create a trend line report in visualforce page. Or if anyone know how to implement the jqwidgets in visualforce page report.

http://www.jqwidgets.com/blog/
List<Decimal> cal =new List<Decimal>();
public decimal fun(){
cal.add(0.0);
cal.add(0.1);
return cal;  // This is possible, But when I have to return that time to display error: "Return value must be of type: Decimal at line"
}

If any one know how to return the list decimal value into function.
I would like to create a report for trend line in below report for salesforce. Then How to do create the Trend Line report for report tab in salesforce

I want to create the trend line report for above report images How?
My old value does not come, only display new map value why. how can i get old map value in apex trigger
I want crate contract tab. That tab containts many records name as visit. How to get all record value when the same contract id visit value in apex class.
I have like to compare previous lookup field value and current lookup field value. If it is same value record is saved, otherwise throw error message.
How to get previous stored lookup value in lookupfield.
I have install the "twilio" api in salesforce and I have register twilio phone number. How to receive the SMS details and how revert back the conformation.Which class should be call and where should I give the accoutsid,authosid and twilio phone number in Installed Package from Sandbox .