• SFDC_Devloper
  • SMARTIE
  • 668 Points
  • Member since 2013

  • Chatter
    Feed
  • 18
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 25
    Questions
  • 141
    Replies
Hi everyone the folowing code gives an error


System.QueryException: unexpected token: 'Product_Category__c'


public List<Product__c> getsearchproduct(){
       
         List<Product__c> searchlist = new List<Product__c>();
         string qry ='select Product_Name__c,Price__c,Product_Image__c, Company__c from Product__C where Product_Department__c =: selecteddept';    
        
         if(selectedcat != 'none')
             {
               qry+=  'AND Product_Category__c=: selectedcat';
             }
        
         if(choosegender!= 'none')
             {
               qry+= 'AND Trending_For__c =: choosegender';
             }
         searchlist = database.query(qry);
         return searchlist;  
         }

need help to sort  out...
Hello,

is something wrong with system.debug? It is not showing new Debug logs. The lines that were entered
some time ago are still displayed. The lines that were entered yesterday are not showing. Here is the
Visualforce Page line whith the button I clicked:

<apex:commandButton action="{!BarVerkaufLieferungen_speichern}" value="Zuordnung speichern" onclick="return confirmCancel()" immediate="true" rendered="{!Sani_prop}"/>

Her is the controller code snippet:

line 5354  public PageReference BarVerkaufLieferungen_speichern() {
line 5355 system.debug(LoggingLevel.DEBUG,'################## LiPosList_prop ' + LiPosList_prop);

And here you see the debug log lines:

13:06:17.205 (205702000)|CODE_UNIT_STARTED|[EXTERNAL]|01pA0000002QLUm|BarVerkaufWizardController invoke(BarVerkaufLieferungen_speichern)
13:06:17.205 (205817000)|SYSTEM_MODE_ENTER|false
13:06:17.205 (205854000)|STATEMENT_EXECUTE|[5354]
13:06:17.205 (205871000)|STATEMENT_EXECUTE|[5355]
13:06:17.206 (206496000)|PUSH_TRACE_FLAGS|[5355]|01pA0000002QLUm|BarVerkaufWizardController|APEX_CODE,INFO;APEX_PROFILING,INFO;CALLOUT,INFO;DB,INFO;SYSTEM,DEBUG;VALIDATION,INFO;VISUALFORCE,INFO;WORKFLOW,INFO
13:06:17.206 (206597000)|STATEMENT_EXECUTE|[128]
13:06:17.206 (206613000)|STATEMENT_EXECUTE|[2678]
13:06:17.206 (206625000)|STATEMENT_EXECUTE|[2679]

After this I can't find any lines with the hash in the debug log!

The debugs that were entered before, are still displaying.

Any ideas? Thanks!


Harald
I cannot create a new Activity History record when using message.setSaveAsActivity(true);

so i added mail.setTargetObjectId(con.id); its working fine.

but actual issue is when i am sending mail to my gmail id its coming properly. and when i am sending mail to my organization email id its coming multiple times.

e.g for 2 accounts sending mail to gmail id recieving 2 only. !!!working!!!

for 2 accounts sending mail to my organization email id recieving 4. !!!multiple same mails!!! 2 for each.

This is my code:

    Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage();
    String[] toAddresses = new String[] {recipient.Email};
    mail.setToAddresses(toAddresses);
    mail.setBccSender(true);
    String[] bccAddresses = new String[] {person.Email};
    mail.setBccAddresses(bccAddresses);
    mail.setTargetObjectId(con.id);
    mail.setSaveAsActivity(true);
    mail.setSubject(subject);
    mail.setPlainTextBody(templateBody);
   Messaging.sendEmail(new Messaging.SingleEmailMessage[] {mail});
Am I doing something wrong?
Hi

I want to encryption and decryption password field using apex and vfpage any ideas appreciate

Thanks,
Hareesh
  • April 28, 2014
  • Like
  • 0
I'm new to VF development. I'm trying to create a button that makes a new opportunity from an existing opportunity and uses some of the values from the old opportunity and changes others. Similar to a clone button but with control over what goes into each field.

I'm using a controller extension for this operation.

I've seen 2 examples of how to get the Id of the current record I'm starting with and I'm trying to determine method is best (or at least the pros/cons of each).  Both methods are in the controller constructor.

Method #1: Using controller.getRecord()
public class myExtension {

    Opportunity currentRecord;
    
    public myExtension(ApexPages.StandardController controller) {
        this.currentRecord = (Opportunity)controller.getRecord();
        currentRecord = [SELECT Id, Name, Amount FROM Opportunity WHERE Id = :currentRecord.Id];
    }

    public Opportunity getcurrentRecord(){
        return currentRecord;
    }
}

Method #2: using Page Parameters
public class myExtension {

    Opportunity currentRecord;
    
    public myExtension(ApexPages.StandardController controller) {
        currentRecord = [SELECT Id, Name, Amount FROM Opportunity WHERE Id = :ApexPages.currentPage().getParameters().get('id')];
    }

    public Opportunity getcurrentRecord(){
        return currentRecord;
    }
}

Alternatively, if there is another method better than either of these, please let me know.
Hi,

I have on picklist it store some number EX: (1,2,3,4,5,6,7,8)
i want to get this number by using Formula Field..
Iam trying to display the selected list of records into the data table. there is no error invoked but still the data is not visible...
here is the code

<apex:page standardController="Product__c" extensions="prosearch">
  <apex:form >
  <apex:pageblock >
   <apex:pageBlockSection >
  
   <apex:pageBlockSectionItem >
   <apex:outputLabel >Select Department</apex:outputLabel>
      <apex:selectList value="{!selecteddept}" size="1">
           <apex:selectOptions value="{!deptitems}" rendered="true" />
      </apex:selectList>
   </apex:pageBlockSectionItem>
        <apex:commandButton id="search" Value="search" action="{!search}"/>

  
    <apex:outputPanel >
    <apex:outputtext value="{!selecteddept}"></apex:outputtext>
      <apex:datatable value="{!searchlist}" var="a" id="theTable" title="Iam HERE" >

            <apex:facet name="retrieved">We Have The Following Products</apex:facet>
       
       <apex:column >
            <apex:facet name="ProductName">Product Name</apex:facet>
            
            <apex:outputtext value="{!a.Product_Name__c}"/>
        </apex:column>
      
        <apex:column >
            <apex:facet name="ProductPrice">Product Price</apex:facet>
            <apex:outputText value="{!a.Price__c}"/>
        </apex:column>
      </apex:datatable>

    </apex:outputPanel>
   </apex:pageBlockSection>
 
  </apex:pageBlock>
 
  </apex:form>
</apex:page>


here is the apex code

public with sharing class prosearch {

    public prosearch(ApexPages.StandardController controller) {
     
    }
    public List<Product__c> searchlist{set; get;}
    public string selectedDept{set;get;}
    public string productname{ set; get;}
    public decimal productprice{ set;get;}
    public  string productimage{ set;get;}
    
    public string getselectedDept(){
      
       return selecteddept;
       
       }
        public void setselecteddept() {
           this.selecteddept = selecteddept;
    }
   public string deptItems{set; }

   public List<SelectOption> getdeptItems() {
            List<SelectOption> options = new List<SelectOption>();
             Schema.DescribeFieldResult fieldResult =Product__c.Product_department__c.getDescribe();   
        List<Schema.picklistEntry> ple = fieldResult.getPicklistValues();
          for(Schema.picklistEntry f:ple)   
        {   
            options.add(new selectOption(f.getLabel(),f.getValue()));                   
        }   
        return Options;
       
       
}


    public pagereference search(){
      return null;
      }
 
public List<Product__c> searchproduct(){


List<Product__c> searchlist = new List<Product__c>();
        searchlist = [select Product_Name__c,Price__c,Product_Image__c from Product__C where product_department__C =: selecteddept];
  
     return searchlist; 
     
 

    
 

}
}
I am trying to add members to a chatter group via dataloader. For some reason I cannot find the object for this. Can somebody help me understand what the issue is ?
Hi,

Just wondering if the trigger below is written properly? this trigger is looking for a newly entered BillingPostalCode value and then check this value against a given list of values if it matches it then updates a custom field Region name by code.

As you can see this trigger only works when a new record is created I would like to update regionName value for existing records too..... I would really help if someone can help, thanks

trigger regionName on Account (before insert) {
set<string> a=new Set<string>{'3125','3352','3014'};
for(Account myAccount: Trigger.new){
     if(myAccount.BillingPostalCode !=NULL){
         String s = myAccount.BillingPostalCode;
                if(a.contains(s)){
               
                string errMsg = 'This area belong to hume!';
                myAccount.regionName__c = 'ABC';
        }
   
     }
  }
}
  • April 16, 2014
  • Like
  • 0
This is the visualforce code :
Payment Method
    <apex:form >
    <apex:pageMessages />
        <apex:pageBlock >
       
        <p>
        <apex:inputCheckbox value="{!Efectivo}">
         <apex:actionSupport event="onchange" action="{!toogle_a}" rerender="the_outputpanel_0"/> 
        </apex:inputCheckbox> Efectivo <br/>
        <br/>
        <apex:inputText value="{!EfectivoP}" rendered="{!(!Efectivo == false)}"/>
        
        </p>
        <p>
        <apex:inputCheckbox value="{!Tarjeta}">
        <apex:actionSupport event="onchange" action="{!toogle_b}" rerender="the_outputpanel_0"/> 
        </apex:inputCheckbox> Tarjeta
        </p>
       
        <br/>
        <apex:commandButton value="Pagar" >
                       <apex:actionSupport event="onclic"  action="{!Pagar()}"/>
                        
                       </apex:commandButton>
                       <br/>  
                                         
        </apex:pageBlock>
    </apex:form>
</apex:outputPanel>


This is the method i want to call in the controller :

public void Pagar(){
   
   
    if(Efectivo=true && total_str > '0'){
      /*  
        calcular_total();
                     
        current_factura.Descuento__c == ;
        current_factura.Efectivo__c == ;
        current_factura.Estado__c == 'Pagado';
        current_factura.Fecha_y_Hora_de_Factura__c == system.now().addHours(-6);
        current_factura.Forma_de_Pago__c == ;
        current_factura.Porcentaje__c == ;
        current_factura.Subtotal__c == ;
        current_factura.Tarjeta__c == ;
        current_factura.Total__c == ;
        current_factura.Vuelto__c == ;
        
        insert(current_factura):
        */
        ApexPages.addMessage(new ApexPages.Message(ApexPages.Severity.ERROR,'Gracias por pagar en Efectivo'));
    }
       
    else if (Tarjeta=true && total_str > '0')
   
    {
    ApexPages.addMessage(new ApexPages.Message(ApexPages.Severity.ERROR,'Gracias por pagar con Targeta'));
    }
   
    else
   
    {
    ApexPages.addMessage(new ApexPages.Message(ApexPages.Severity.ERROR,'Por favor seleccione un metodo de pago'));
   
    }

}

I also have this already declared

public boolean Efectivo {get;set;}
public boolean Tarjeta {get;set;}

public pageReference toogle_a(){

if(Efectivo==false){Tarjeta=true;}
else{Efectivo=true;Tarjeta=false;}

return null;
}
public pageReference toogle_b(){

if(Tarjeta==false){Efectivo=true;}
else{Tarjeta=true;Efectivo=false;}

return null;
}
hi im new to the apex code can any one explain me with some example to show the notes and attahment of the cutom record in new window i knw that related list is there but i need help on that related list how to fetch the fields of notes and attachment in that
Is it possible to automatically submit a specific approval step in an approval process once an opportunity has reached a certain stage?  I'm new to apex so I'm not even sure where to begin.  I've come across the following article http://www.salesforce.com/us/developer/docs/apexcode/Content/apex_process_example.htm but I'm assuming this only works if you have one approval process per object? I'm not too sure how to loop through the approval processes to pick the one I'm trying to use.
Any help would be greatly appreciated.
Thanks!

what is a recursive trigger?Please explain me with an example...
Hi All,

  I a facing below issue while inserting new quote line iteam, please help to fix this.

 Insert failed. First exception on row 0; first error: FIELD_INTEGRITY_EXCEPTION, The pricebook entry is in a different pricebook than the one assigned to the Quote, or Quote has no pricebook assigned.: [PricebookEntryId]
 
lineItemList=[select Name,ID,product2.Name,PriceBookEntryID,priceBookEntry.product2.productcode,Discount,product2ID,OpportunityID,ProductCode,ListPrice,UnitPrice,Quantity,TotalPrice  from OpportunityLineItem where OpportunityID=:recordID];
     for(OpportunityLineItem  lineItem:lineItemList)
     {
//Quote.iD is recoord id
QuoteList.add(new QuoteLineItem(QuoteID=Quote.ID,
PriceBookEntryID=lineItem.PriceBookEntryID,
Product2ID=lineItem.product2ID,
UnitPrice=lineItem.ListPrice,
Quantity=lineItem.Quantity));

} 

insert QuoteList;

Thanks.
Hi Below code I am getting null values;
 
trigger CompareValues on Account__c (before insert) 
{
     
    for(Account appObj:Trigger.new)
    {
    
      If(appObj.City_Code__c !=  appObj.Sales_Name__r.City_Code__r.Code__c || appObj.Sales_Name__r.Salesman_Status__c=='Inactive')
        {
            appObj.addError('City Trigger Error');
  
        }
        
    
    }

below fields i am getting nullvalues..
appObj.Sales_Name__r.City_Code__r.Code__c
appObj.Sales_Name__r.Salesman_Status__c


Thansk in advance

 
Hi All,

  I am cerating new record(ISNEW()),here I have one number field(field is empty) in this when i trying perform any actions it will through error otherwise it will won't through any error.

 
Hi All,

   How to get current record id using formula fields (Hyperlink) ?

Thanks
Hi All,

   At a time how many records can we able insert by using INSERT statement ?What is the limitation of inser (or) update (or) delete ?

  Example:   insert account;

Thanks

Hi All,

   
    Can any one Explain me Before and After events in trigger?When we are going for Before and when we are going for After in Triggers?


Thanks

Hi All,

       How do I show an edit button for a custom object in a visual force page and allow the user to edit the custom object?Please proviode me code?


Thanks
Hi All,

  I am very new to Web services .Which is commanly using web services in Salesforce(SOAP,REST..etc)?

  Can any one provide me meterial for the Webservices.

Thanks,
Rockzz
Hi All,

  I want remove this option called Gmail Internal.Please find attched image.

User-added image

Thanks,
Rockzz
Hi All,

<apex:dataTable value="{!account.Contacts}" var="contact" cellPadding="4" border="1">--here account and acontact both are standard objectes 

 in Value attribute  I want give the both are custom objects ..Please share me any ideas

Thnaks
Hi All,

VisualForce Page:
<apex:page standardController="Account" showHeader="true"
tabStyle="account" >
<style>
.activeTab {background-color: #236FBD; color:white;
background-image:none}
.inactiveTab { background-color: lightgrey; color:black;
background-image:none}
</style>
<apex:tabPanel switchType="client" selectedTab="tabdetails"
id="AccountTabPanel" tabClass='activeTab'
inactiveTabClass='inactiveTab'>
<apex:tab label="Details" name="AccDetails" id="tabdetails">
<apex:detail relatedList="false" title="true"/>
</apex:tab>
<apex:tab label="Contacts" name="Contacts" id="tabContact">
<apex:relatedList subject="{!account}" list="contacts" />
</apex:tab>
<apex:tab label="Opportunities" name="Opportunities"
id="tabOpp">
<apex:relatedList subject="{!account}"
list="opportunities" />
</apex:tab>
<apex:tab label="Open Activities" name="OpenActivities"
id="tabOpenAct">
<apex:relatedList subject="{!account}"
list="OpenActivities" />
</apex:tab>
<apex:tab label="Notes and Attachments"
name="NotesAndAttachments" id="tabNoteAtt">
<apex:relatedList subject="{!account}"
list="CombinedAttachments" />
</apex:tab>
</apex:tabPanel>
</apex:page>

We need to specify the ID of a particular account :https://na1.salesforce.com/apex/tabbedAccount?id=001D000000IRt53.

After you add in an account ID,

My page should display as follows:

User-added image


here I dnt want pass url like this:https://na1.salesforce.com/apex/tabbedAccount?id=001D000000IRt53.

here I want pass AccountId from Apex class to VF Page.

Thanks
Hi All,

I have one checkbox (left side) when ever i checked  the checkbox and click on Edit button here I want edit the the that particula  record in VF page(here User__c is a custom object).Please share any idea...

Please find my attaches image..

User-added image


Thanks
Hi All,

  data migration exsisting system(JAVA) to salesforce.com..I want steps for doing migration Please Share your ideas .

Thanks,
Rockzz
Hi All,

  Can any one explain me sales cloud application process flow?


Thanks,
Rockzz
Hi All,

I am very very new to Annotations, but not new to Salesforce.Why @ Symbol before Annotations?(Annotations are defined with an initial @ symbol, followed by the appropriate keyword)

Thanks,
Rockzz
Hi All,

  Why Assignment Rules are available for Lead and Case object?

Thanks,
Rockzz
Hi All,

Why @ Symbol before Annotations?(Annotations are defined with an initial @ symbol, followed by the appropriate keyword)

Thanks,
Allways Cool
Hi All,

   Why Analytical Snapshots not supported matrix report?(It only supports tabular and summary report as a source report. It does not support matrix report)

Thanks,
Allways Cool
Hi All,

what is dynamic approval process?what is the need of dynamic approval process?

Thanks,
Always Cool
Hi All,

   Why Governor Limits are introduced in Salesforce.com?

Thanks,
Allways Cool
Hi Below code I am getting null values;
 
trigger CompareValues on Account__c (before insert) 
{
     
    for(Account appObj:Trigger.new)
    {
    
      If(appObj.City_Code__c !=  appObj.Sales_Name__r.City_Code__r.Code__c || appObj.Sales_Name__r.Salesman_Status__c=='Inactive')
        {
            appObj.addError('City Trigger Error');
  
        }
        
    
    }

below fields i am getting nullvalues..
appObj.Sales_Name__r.City_Code__r.Code__c
appObj.Sales_Name__r.Salesman_Status__c


Thansk in advance

 
 I am very new to Force.com. I am looking to download and install Force.com IDE on PC running windows 7 pro. I did not find the actual download anywhere. But I found some exaples of installing the IDE as an Eclipse plug in. Is the stand alone not availbe any more?  Can someone tell me the best way  to install the IDE

Yes, I know this is out there, but I still do not understand what is going on.  I am pretty new to SF, but have a lot of development experience in Java and other languages.

I am working in my free developer account, and wanted to create my first Apex code using a trigger.  Here is my business process.  I added a custom field to Account called Customer Level.  It is a picklist of "NORMAL" and "PREFERRED", with the default being NORMAL.   When the level is changed to PREFERRED, I want to create a trigger to create a new custom object called Preferred Customer Data, which has a one-to-one relationship with an Account (so there is a reference back to the account).  I put in another data field called Preferred Level which is a picklist of BRONZE, SILVER, and GOLD, with the default at creation being BRONZE.

So using the online Apex documentation, I dove in.

First, though, I created my objects and fields via the GUI.

I created a class with a static method that took an account ID and a level, and which creates the Preferred Customer object with the specified level.

public class UpdatePreferredCustomer{

    public static String CreatePreferredCustomerData(String accountId, String level) {
        Account acc = [select Id, Name, Customer_Level__c, AccountNumber
                       from Account where id=:accountId];
       
        if (acc == null) {
            System.debug('>>>> ERROR: could not find account');
        }
       
        System.Debug('>>>> Found account Id: ' + acc.Id + ', Name: ' + acc.Name);
        System.Debug('>>>> Customer level: ' + acc.Customer_Level__c);
       
        Preferred_Customer_Data__c pref = new Preferred_Customer_Data__c();
       
        pref.Name = 'Preferred data, test6';
        pref.Preferred_Level__c = level;
        pref.Account__c = accountId;
       
        // NOTE: the Preferred_Customer_Data custom object uses the Account's
        // AccountNumber as a unique external reference ID so we do not create
        // multiple records
       
        pref.Account_Number__c = acc.AccountNumber;
       
        upsert pref Account_Number__c;

        System.Debug('>>>> Upserted preferred customer level: ' + level);
       
        return 'SUCCESS';
    }
}

I next tested this method manually via the Developer Console and saw that it worked.

Next, I created a trigger for both after insert and after update, as it seemed like I need to cover both of those cases.

trigger MyAccountTrigger on Account (after update) {
   
    if (Trigger.isInsert) {
        System.debug('>>>> got insert trigger');
    } else {
        System.debug('>>>> got update trigger');
    }
   
    for (Account a : Trigger.new) {
        System.debug('>>>> Found account in trigger: ' + a.Name);
        String s = UpdatePreferredCustomer.CreatePreferredCustomerData(a.ID, 'BRONZE');
    }
}

Finally, I created a test class.

@isTest
public class UpdatePreferredCustomerTestClass{
    static testMethod void validateUpdatePreferredCustomer() {
        // Create a test account
       
        Account acc = new Account(Name='PreferredTestCustomer',
                                 AccountNumber='7275551212',
                                 Customer_Level__c='NORMAL');
       
        System.debug('>>>> Inserting account');
       
        // Insert
        insert acc;
       
        // Retrieve the new account
        acc = [SELECT ID FROM Account where Id =:acc.Id];
       
        // Now set the Customer Level.. this should trigger the creation
        // of the PreferredCustomer object via our trigger.
        
        acc.Customer_Level__c = 'PREFERRED';
        upsert acc;
       
        // Validate that the Preferred Customer Object got created, and
        // that the preferred level was set initially to BRONZE
        
        Preferred_Customer_Data__c pref = acc.Preferred_Customer_Data__r;
       
        System.debug('>>>> Get the Preferred Customer Object');
       
        System.debug('>>>> Preferred Customer level: ' + pref.Preferred_Level__c);
       
        System.assertEquals('BRONZE', pref.Preferred_Level__c);
       
    }
}

So, as my title says, when I run this, I get the aforementioned error.

The error line is pointing to this line in the test class:

     Preferred_Customer_Data__c pref = acc.Preferred_Customer_Data__r;

This made me think that there could be a race condition, because it *seems* as though the Preferred Customer Data
object *is* being created, yet it is not there when I go to look for it in the test class.

I would greatly appreciate any suggestions.  I am sure this is a simple issue that I am missing.

Mitch

Hi All,

  I want remove this option called Gmail Internal.Please find attched image.

User-added image

Thanks,
Rockzz

Hi,

  I created a page redirect inside controller. Below highlited is the code to call page redirect. I am redirect the page to opporunity after data is saved. 
  
 Please suggest me how to modify its not working

// Store Selected Records to Object/Table
public void processSelected() {
    Integer currentPageNumber = setCon.getPageNumber();
    selectedAssets = new List<Asset>();
    list<Temp_Assets__c> TempAssetList = new list<Temp_Assets__c>(); 
       
     
     setCon.setpageNumber(1);
    

while(true){
    List<Asset>  TempAssetLists = (List<Asset>)setCon.getRecords();
    for(Asset assetIns : TempAssetLists  ) {
          if(this.selectedContactIds.contains(assetIns.Id)){
             selectedAssets.add(assetIns);
            
            
           }
     }
if(setCon.getHasNext()){
  setCon.next();
  }
  else{
  break;
  }
  

        /**********Added by Unnat*********************************/
        //below code should only execute if Expiry term has a value
        Date maxDate=Date.valueOf('2000-1-1');
        Date minDate;
       
        //Calculate the maximum Date off of the selected dates
     
        //finds the latest expiry date out of the selected assets
        for (Asset assets: selectedAssets) {
            if(assets.Service_End_Date_Max__c > maxDate) {
                maxDate=assets.Service_End_Date_Max__c;
            }
        }
        System.debug('== Latest Service end Date is:'+ maxDate);
        minDate = maxDate;
        for (Asset assets: selectedAssets) {
            if(minDate > assets.Service_End_Date_Max__c) {
                minDate=assets.Service_End_Date_Max__c;
            }
        }
        System.debug('== Least Service end Date is:'+ minDate);
       
         
        //Validations
        if ((selectedAssets.size() < 1 ) || (expireTerms == '0' && GetExpireDate.Expire_Date__c== null )|| (expireTerms != '0' && GetExpireDate.Expire_Date__c!= null ) || (GetDistributor.Primary_Distributor__c == null ) || (GetReseller.Primary_Reseller__c == null ) || (GetOpportunity.Opportunity__c==null && GetNewOpportunity.New_Opportunity__c== null ) || (GetOpportunity.Opportunity__c!=null && GetNewOpportunity.New_Opportunity__c!= null )|| (GetExpireDate.Expire_Date__c < maxDate )) {
        //Validates that atleast one of the assets is selected from the install base
        if(selectedAssets.size() < 1 ){
            ApexPages.addmessage(new ApexPages.message(ApexPages.severity.Error,'Please select atleast one Asset to renew from the Install Base.'));
        }
        //Validates that atleast one of the Expiry Dates needs to have a value
        if(expireTerms == '0' && GetExpireDate.Expire_Date__c== null ){
            ApexPages.addmessage(new ApexPages.message(ApexPages.severity.Error,'Please enter the Expiry Term or Expiry Date for the selected Assets.'));
        }
        //Valation that only of the Expirty Dates can have a value
        else if(expireTerms != '0' && GetExpireDate.Expire_Date__c!= null ){
            ApexPages.addmessage(new ApexPages.message(ApexPages.severity.Error,'You can enter a value either in Expiry Date or Expiry Term, but not in both.'));
        }
        //Validation that the Distributor Name is required
        if(GetDistributor.Primary_Distributor__c == null ){
            ApexPages.addmessage(new ApexPages.message(ApexPages.severity.Error,'Please enter a value in Distributor'));
        }
        //Validation that Reseller Name is required
        if(GetReseller.Primary_Reseller__c == null ){
            ApexPages.addmessage(new ApexPages.message(ApexPages.severity.Error,'Please enter a value in Reseller'));
        }
        //Validation that atleast one Opportunity needs to have a value
        if(GetOpportunity.Opportunity__c==null && GetNewOpportunity.New_Opportunity__c== null ){
            ApexPages.addmessage(new ApexPages.message(ApexPages.severity.Error,'Please enter a value in either of the Opportunity'));
        }
        //Validation that only one of the Opportunities can have a value
        else if(GetOpportunity.Opportunity__c!=null && GetNewOpportunity.New_Opportunity__c!= null ){
            ApexPages.addmessage(new ApexPages.message(ApexPages.severity.Error,'You can enter a value either in Opportunity or New Opportunity, but not in both.'));
        }
        //Validation that will check if the Expiry Date has value less than the selected Asset Service End Date
        if(GetExpireDate.Expire_Date__c < maxDate ){
            ApexPages.addmessage(new ApexPages.message(ApexPages.severity.Error,'Expiry Date that you entered is lower than Service End Date of the Asset'));
        }
        }
        else {
        //below code should only execute if Expiry term has a value
        //Date maxDate=Date.valueOf('2000-1-1');
        //Calculate the maximum Date off of the selected dates
       
        if (ExpireTerms !=null) {
        System.debug('== Expire Terms has a value');
       
            //There will be another condition to add the expiry term to the latest expiry date
            //String a='1 Year';
            System.debug('== ExpireTerms is: '+ ExpireTerms);
            if (ExpireTerms=='1') {
                System.debug('== First if condition');
                maxDate=maxDate.addYears(1);
            }
            else if (ExpireTerms == '3') {
            System.debug('== Second if condition');
                maxDate=maxDate.addYears(3);
            }
            else if (ExpireTerms == '5') {
            System.debug('== third if condition');
                maxDate=maxDate.addYears(5);
            }
            else {
                maxDate= GetExpireDate.Expire_Date__c;
            }
        }
        else {
        System.debug('== Else condition');
            maxDate= GetExpireDate.Expire_Date__c;  
        }
        System.debug('== Max Date is: ' + maxDate);
        Integer totalDays = minDate.daysBetween(maxDate);
        System.debug('== Total days difference is: '+ totalDays);
        /****************Completed by Unnat*****************************/
       
        //checks if the Monthly Quote is going to be more than 36 months and Monthly Quote Checkbox is selected
        /*if (totalDays > 1080 && Monthly_Quote == true ) {
            ApexPages.addmessage(new ApexPages.message(ApexPages.severity.Error,'Since the Renewals in Months is more than 3 years, please uncheck the Monthly Quote checkbox'));
        }
        else {*/       
            System.debug('=- after the if condition');          
            Account ResellerAct;
            Account DistributorAct; 
            Opportunity Oppt;          
                               
            for(Asset Act : selectedAssets)
            {              
                Temp_Assets__c TempAsset = new Temp_Assets__c();
                TempAsset.Name = 'Sudhir';
                TempAsset.AccountId__c = Act.AccountId;
                TempAsset.Product__c = Act.Product2Id;
                //Added by Unnat
                TempAsset.Product_lookup__c= Act.Product2Id;
                TempAsset.Asset_Id__c = Act.Id;
                TempAsset.Serial_Number__c = Act.SerialNumber;
                TempAsset.Last_Contract_Number__c = Act.last_contract_number__c;
                TempAsset.Service_Start_Date__c = Act.Service_Start_Date_Min__c;
               
                //TempAsset.Service_End_Date__c = Act.Service_End_Date_Max__c;
                /***************Added by Unnat********************************************/
                TempAsset.Opp_Close_Date__c = minDate;
                TempAsset.Monthly_Quote__c = Monthly_Quote;
                System.debug('=- Monthly Quote is: ' + monthly_Quote);
               
                if (Act.Service_End_Date_Max__c != null) {
                    TempAsset.Service_End_Date__c = Act.Service_End_Date_Max__c;
                }
                else {
                    TempAsset.Service_End_Date__c = Act.InstallDate;
                }
               
                TempAsset.Install_Date__c = Act.InstallDate; 
                System.debug ('==== Reseller id is: '+ GetReseller.Primary_Reseller__c);
                TempAsset.Reseller__c = GetReseller.Primary_Reseller__c;
                TempAsset.Distributor__c = GetDistributor.Primary_Distributor__c;
               
                /****************Commented by Unnat****************************************************************************
               
                If (GetReseller.AccountId <> NULL)
                {     
                ResellerAct = [ SELECT Id FROM Account WHERE ID = :GetReseller.Primary_Reseller__c Limit 1];
                TempAsset.Reseller__c = ResellerAct.Id;     
                 System.debug ('==== Reseller id 2 is: '+ ResellerAct.Id);       
                }
              
                If (GetDistributor.AccountId <> NULL )
                {
                DistributorAct = [ SELECT Id FROM Account WHERE ID = :GetDistributor.Primary_Distributor__c Limit 1];
                TempAsset.Distributor__c = DistributorAct.Id;
                }
               
                ****************Completed by Unnat *****************************************************************************/
                If ( GetOpportunity.Opportunity__c <> NULL )
                {
                Oppt = [SELECT Id FROM Opportunity WHERE ID = :GetOpportunity.Opportunity__c Limit 1];
                TempAsset.Existing_Opportunity__c = Oppt.Id;
                }               
                TempAsset.Incumbent_Reseller__c = IncumbentReseller;
                TempAsset.Education__c = Education;
                //TempAsset.Expiry_Date__c = GetExpireDate.Expire_Date__c;
                TempAsset.Expiry_Date__c= maxDate;
               
                TempAsset.New_Opportunity__c = GetNewOpportunity.New_Opportunity__c;
                TempAsset.Expiry_Term__c = ExpireTerms;
               
                /* Insert Bundel Checkbox Value */               
                if (this.selectedContactIds2.contains(Act.Id)){
                    bundsprt=true;
                }
                else {
                    bundsprt=false;
                }
               
               
                TempAsset.Bundle_Support__c = bundsprt;
                System.debug('== Bundle Value is: ' + bundsprt);
               
                             //Add the selected Assets to the List
                TempAssetList.add(TempAsset);
            }
               
            Insert TempAssetList;                           
           
           
       // } //end of if Condition for check of days more than 3 years
       }
        setCon.setpageNumber(currentPageNumber);
        Redirect();
    }
   
   public pagereference Redirect()
   {
     String optyURL2 = 'https://cs20.salesforce.com/006m0000002MqNf';
     PageReference pageref = new PageReference(optyURL2);   //<----- changed here
     pageref.setRedirect(true);  
     return pageref;
    }


Thanks
Sudhir

Hi,

We have created an visualforce email template,which has to translated based on Users language.Here is the code,but this didn't get translated when we change the language.Any suggestions plz?
<messaging:emailTemplate subject="Last Login" recipientType="User" relatedToType="User_Status__c" language="{!recipient.LanguageLocaleKey}">

<messaging:htmlEmailBody >
<html>
<body>

<p>Hello "{!recipient.name}",</p>
<p>You have not logged into Salesforce.com in last 15 days. Is something wrong? Is there something that we can help you with? </p>
<p>Please login to Salesforce.com and keep your account active.</p>

<p>Regards,</p>
<p>Salesforce Support Team</p>

</body>
</html>
</messaging:htmlEmailBody>


</messaging:emailTemplate>
Hi All,

VisualForce Page:
<apex:page standardController="Account" showHeader="true"
tabStyle="account" >
<style>
.activeTab {background-color: #236FBD; color:white;
background-image:none}
.inactiveTab { background-color: lightgrey; color:black;
background-image:none}
</style>
<apex:tabPanel switchType="client" selectedTab="tabdetails"
id="AccountTabPanel" tabClass='activeTab'
inactiveTabClass='inactiveTab'>
<apex:tab label="Details" name="AccDetails" id="tabdetails">
<apex:detail relatedList="false" title="true"/>
</apex:tab>
<apex:tab label="Contacts" name="Contacts" id="tabContact">
<apex:relatedList subject="{!account}" list="contacts" />
</apex:tab>
<apex:tab label="Opportunities" name="Opportunities"
id="tabOpp">
<apex:relatedList subject="{!account}"
list="opportunities" />
</apex:tab>
<apex:tab label="Open Activities" name="OpenActivities"
id="tabOpenAct">
<apex:relatedList subject="{!account}"
list="OpenActivities" />
</apex:tab>
<apex:tab label="Notes and Attachments"
name="NotesAndAttachments" id="tabNoteAtt">
<apex:relatedList subject="{!account}"
list="CombinedAttachments" />
</apex:tab>
</apex:tabPanel>
</apex:page>

We need to specify the ID of a particular account :https://na1.salesforce.com/apex/tabbedAccount?id=001D000000IRt53.

After you add in an account ID,

My page should display as follows:

User-added image


here I dnt want pass url like this:https://na1.salesforce.com/apex/tabbedAccount?id=001D000000IRt53.

here I want pass AccountId from Apex class to VF Page.

Thanks