• shashi lad 4
  • NEWBIE
  • 249 Points
  • Member since 2014

  • Chatter
    Feed
  • 8
    Best Answers
  • 0
    Likes Received
  • 1
    Likes Given
  • 0
    Questions
  • 54
    Replies
hello, I'm trying to affect a value to a field depending on the value of two other, for example if the quantity of a product requested by a seller is greater than the quantity in the store, the value of our field must be the value of the quantity in the store, this is my code and thank you in advance

VF page:
 
<apex:page controller="ProduitDemandeClass"  >
    
    <apex:form >
        
        <apex:pageBlock >
            <apex:commandButton value="Enregistrer" />
            
            <apex:pageBlockSection >
                <apex:pageBlockTable value="{!produitsDemande}" var="pr">
                    <apex:column value="{!pr.Produit__c}"/>
                    <apex:column value="{!pr.Quantit_demande__c}" />
                    <apex:column value="{!pr.Quantit_Accorde__c}"/>
                    <apex:column headerValue="Action">
                        <apex:commandButton value="Modifier"  onclick="window.location='/apex/ValeurAccorde?id={!pr.Produit__c}'; return false;" />
                    </apex:column>
                </apex:pageBlockTable>
            </apex:pageBlockSection>
            
        </apex:pageBlock>
    </apex:form>
</apex:page>

apex class:
 
public with sharing class ProduitDemandeClass {
    public String  idcharg {get;set;}
    LIST<les_Produit_demander__c> produitsDemande  {get;set;} 
    
    public List<les_Produit_demander__c> getproduitsDemande() {
        
        if(produitsDemande == null){
            
            produitsDemande = [select Id,Produit__c,Quantit_demande__c,Quantit_Accorde__c from  les_Produit_demander__c where Demande_de_Chargement__c= :idcharg];
            Integer i=0;
            for(les_Produit_demander__c pr :produitsDemande){
                list<Stock_par_agence__c> p =[select QuantiteTotaleRestante__c from 	Stock_par_agence__c where 	Produit__c= :pr.Produit__c];
                if(p != null && p.size() > 0){
                    if(p.get(0).QuantiteTotaleRestante__c > pr.Quantit_demande__c){
                        pr.Quantit_Accorde__c=pr.Quantit_demande__c;
                   
                        update pr;
                    }
                    else {
                        pr.Quantit_Accorde__c=p.get(0).QuantiteTotaleRestante__c;
                        
                       update pr;
                       
                    }
                } 
            }
             
        }
        return produitsDemande;
    }
    
    public ProduitDemandeClass(){
        idcharg=ApexPages.currentPage().getParameters().get('id');
    }
}



 
can we set two bulk schedule at one time salesforce?
  • August 31, 2015
  • Like
  • 0
I wrote a custom controller(Wizard based) and two VF pages.

My Intention is to capture the details of custom object(Candidate)Using first page I and
Using Next page I am displying the same fields and save button.

But the records are not saving and not displaying in the VF2.

Controller:
Apex Controller:

public with sharing class CanrecordCon {

public Candidate__C Can{ get; private set; }
public CanrecordCon() {
Id id = ApexPages.currentPage().getParameters().get('id');
if(id == null) 
 new Candidate__C();
 else
Can=[SELECT Name, Phone__C FROM Candidate__C WHERE Id = :id];
}

public PageReference Next() 
{
      return Page.newCanrecord1;
 }

public PageReference save() {
try {

insert(Can);
} catch(System.DMLException e) {
ApexPages.addMessages(e);
return null;
}
// After Save, navigate to the default view page:
return (new ApexPages.StandardController(Can)).view();
}
}

Vf-page1:
<apex:page Controller="CanrecordCon" >

<apex:form >
<apex:pageBlock mode="edit">
<apex:pageMessages />
<apex:pageBlockSection >
<apex:inputField value="{!Can.name}" id="No1"/>
<apex:inputField value="{!Can.Phone__c}" id="No2"/>

</apex:pageBlockSection>
<apex:pageBlockButtons location="bottom">
<apex:commandButton value="Next" action="{!Next}"/>
</apex:pageBlockButtons>
</apex:pageBlock>
</apex:form>
  
</apex:page>

Vf page2:

<apex:page controller="CanrecordCon" tabstyle="Account">
  
  <apex:form >
<apex:pageBlock >
<apex:pageBlockSection title="Details" collapsible="false"  columns="2">
            <apex:outputField id="a1" value="{!Can.Name}"/> 
            
            <apex:outputField id="a3" value="{!Can.Phone__c}"/>          
        </apex:pageBlockSection></apex:pageBlock>
   <apex:commandButton value="Save" action="{!save}"/>
</apex:form>
</apex:page>

 
Hello Guys,

I am trying to split Apex column into two sub columns. How do we do this in VisualForce.

I am using the below code :
    <apex:pageBlockTable border="true" align="center" value="{!lstwrapper}" var="x" >  
           
           <apex:column headerValue="Admin Ticket" style="text-align:center" colspan="2">
               
            </apex:column>

             <apex:column headerValue="Answer Sheet" style="text-align:center"  colspan="2">
               
            </apex:column> 
            <apex:column headerValue="Exam Book" style="text-align:center"  colspan="2">
               
            </apex:column>
   
        </apex:pageBlockTable>




I need two sub columns under 3 main columns.
Ex:        Admin Ticket
               AM     PM

 
Hi guys,

I have a apex class that call webservice to integrate with PI and SAP, until now it work without any problem, but SAP team had to change for other Endpoint, when I try access this new Endpoint I receive this error:

<p><b>Access Denied.</b></p>

I already configured IP in the whitelist and Site Remote, the might be happening?

Thanks for help.
I'm almost successful creating an excel file but I need some help to style two more things:
1) Cell borders - There is a border around the whole table, but I also need each cell to have a border. I tried using this css, which does give the cell borders in the VF page, but not in the excel doc. 
table.details td {
    border: 1px solid black;
      }
2) Cell width - I used a td class to set the width of the column in the VF page but again, the style does not render in the excel file.

Can anyone help with this?

The full page code is here for reference;
<apex:page standardController="Dumping_Grounds__c" >
<head>
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8" />

 <style type="text/css">


  body {
   font-family: Calibri;
   font-size:10pt;
  }

  p {
      font-family: Arial;
      font-size: 10pt;
      }
  table.details {
      border: 1px solid black;
      border-collapse: collapse;
      }

  table.details td {
    font-size:11pt;
    font-family: Calibri;
    border: 1px solid black;
    

  }
  br {
      mso-data-placement:same-cell;
      }
  .head {
      background-color: #C1EEF5;
      text-align: center;
      font-size: 18pt;
      }
  .title {
      font-size: 16pt;
      font-weight: bold;
      }
  .instructions {
      font-size: 16pt;
      font-style: italic;
      color: red;
      }
  .blue {
      background-color: #C1EEF5;
      font-size: 14pt;
      font-style: bold;
      }
      .col1 {
      width: 400px;
      }
      .col2 {
      width: 200px;
      }
</style>

</head>
<body>


       <table >
         <tr >
             <td colspan="2" class="title">DAS Canada - Legal Expense Insurance</td>
         </tr>
         <tr>
             <td colspan="2" class="instructions">Instructions: Please complete and email to underwriting@das.ca</td>
         </tr>
         <tr>
             <td><br/></td>
         </tr>
         </table>

       <table class="details">
           <tr >
               <td colspan="2" class="head">DASbusiness - Application</td>
           </tr>
           <tr>
               <td colspan="2" class="blue">Broker Information</td>
           </tr>
           <tr>
               <td class="col1" >Broker name</td>
               <td class="col2"> Richard Little</td>
           </tr>
           <tr>
               <td>Broker office</td>
               <td>{!Dumping_Grounds__c.Agency__c}</td>
           </tr>
           <tr>
               <td>Broker Contact Tel Number:</td>
               <td>1-855-505-1525 ext 102</td>
           </tr>
           <tr>
               <td>Date this Application Completed:</td>
               <td>{!Dumping_Grounds__c.CreatedDate}</td>
           </tr>
           <tr>
               <td colspan="2" class="blue">Client Details</td>
           </tr>
           <tr>
               <td>Client/Business Name:</td>
               <td>{!Dumping_Grounds__c.Contact_First_Name__c} {!Dumping_Grounds__c.Contact_Last_Name__c}/{!Dumping_Grounds__c.Business_Name__c}</td>
           </tr>
           <tr>
               <td>Client Full Address:</td>
               <td>{!Dumping_Grounds__c.Business_Street__c}, {!Dumping_Grounds__c.Business_City__c}, {!Dumping_Grounds__c.Business_Province__c}, {!Dumping_Grounds__c.Business_Postal_Code__c}, {!Dumping_Grounds__c.Business_Country__c}</td>
           </tr>
           <tr>
               <td>Client Full Business Description:</td>
               <td>{!Dumping_Grounds__c.Client_Full_Business_Description__c}</td>
           </tr>
           <tr>
               <td>Client Annual Payroll:</td>
               <td></td>
           </tr>
           <tr>
               <td>Client Annual Revenue:</td>
               <td></td>
           </tr>
           <tr>
               <td>Client Email Address:</td>
               <td>{!Dumping_Grounds__c.Contact_Email_Address__c}</td>
           </tr>
           <tr>
               <td>Client Phone #:</td>
               <td>{!Dumping_Grounds__c.Contact_Phone_Number__c}</td>
           </tr>
           <tr>
               <td>Policy Subsidiary Companies</td>
               <td><apex:outputText value="{!IF(Dumping_Grounds__c.Number_of_Subsidiary_Accounts__c == '0', 'No', 'Yes')}"/></td>
           </tr>
           <tr>
               <td>Please List all Subsidiary Company Names if applicable:</td>
               <td><apex:outputText rendered="{!IF(Dumping_Grounds__c.Number_of_Subsidiary_Accounts__c = '0', false,true)}">{!Dumping_Grounds__c.Subsidiary_Account_Name1__c} <br/> {!Dumping_Grounds__c.Subsidiary_Account_Name2__c} <br/> {!Dumping_Grounds__c.Subsidiary_Account_Name3__c}</apex:outputText></td>
           </tr>
           <tr>
               <td>Please List all Subsidiary Company Addressses if applicable:</td>
               <td><apex:outputText rendered="{!IF(Dumping_Grounds__c.Number_of_Subsidiary_Accounts__c = '0', false,true)}">{!Dumping_Grounds__c.Subsidiary_Account_Address1__c} <br/> {!Dumping_Grounds__c.Subsidiary_Account_Address2__c} <br/> {!Dumping_Grounds__c.Subsidiary_Account_Address3__c}</apex:outputText></td>
           </tr>
           <tr>
               <td>How should policy be sent?</td>
               <td>Email</td>
           </tr>
           <tr>
               <td>Required Policy Start Date:</td>
               <td>{!Dumping_Grounds__c.Policy_Start_Date__c}</td>
           </tr>
           <tr>
               <td colspan="2">Has this company had two or more legal disputes that could have given rise to a claim under this policy in the past three years? <br/>{!Dumping_Grounds__c.Legal_Claims_Risk__c}</td>
               
           </tr>
           <tr>
               <td colspan="2">Note <br/>{!Dumping_Grounds__c.Legal_Claims_Risk_Explanation__c}</td>
               
           </tr>
           <tr>
               <td colspan="2" class="blue">Total Premium Calculated:</td>
           </tr>
           
       </table>

</body>
</apex:page>


 
Hi 
I have a picklist field that should disable upon checking check box, can any one help me here. Thanks in advance.
I'm curious if anyone has a good explanation why the exception below is thrown in the first case but not the second case.
Exception Thrown (and rightly so):
sobject so = [SELECT Id FROM Contact LIMIT 1];
System.debug(so.get('Name'));
...but not here:
sobject so = [SELECT Id FROM Contact LIMIT 1];
so.put('Description', 'This is a description');
System.debug(so.get('Name'));

In both cases I would hope that so.get('Name') would throw the exception but I have found this not to be the case.

Exception:
System.SObjectException: SObject row was retrieved via SOQL without querying the requested field: Contact.Name
  • August 27, 2015
  • Like
  • 0
I'm trying to configure the IDE and I'm not getting the Perspective in the options for the Force.com.  I am on a Mac iOS 10.9.5
Below are the things I've done and have looked at:
  1. I have read the Install Guide at: https://developer.salesforce.com/page/Force.com_IDE_Installation
  2. I've installed the JDK from http://www.oracle.com/technetwork/java/javase/downloads/index.html (However this version listed is 8, not 7)
  3. From the guide I'm not sure what plugin this statment is refering to "(note: the full JDK is not the default JRE installation on Mac OS X)"
  4. I've tried to go to the Eclipse market place and install the plugin from there but I'm getting this error below, about not able to read the repository.
Any and all help appricated.

Error:
Unable to read repository at http://www.adnsandbox.com/tools/ide/install/.
http://www.adnsandbox.com/tools/ide/install/ is not a valid repository location.
I am creating a test class for a trigger on Quote. Below is the trigger:
trigger updateOpptyAccount on Quote (before insert,before update) {
    for (Quote QuoteInLoop : Trigger.new){
        /*****************************
         * Created by Gaurav Agnihotri 07/25/2015
         * Updates Price Book and 
         * Quote Accounts
         * Inserting new records in 
         * Quote Account
         * ***************************/
       // if(QuoteInLoop.Opportunity.name != '.'){
        Boolean sMainAccount=QuoteInLoop.Main_Account__c;
        String sMainAccountId=QuoteInLoop.AccountId;
        String sQuoteAccountId=QuoteInLoop.Pelco_Account_Name__c;
        String sQuotePriceBook=QuoteInLoop.PriceBook2Id;
        String sQuoteId=QuoteInLoop.Id;
        String sOptyId=QuoteInLoop.OpportunityId;
        String currencyCode;
        String currencyNumber;
        //String quoteAccountID;
        Decimal exchangeRateForQuote;  
        //checking if price book is attached to the quote
        //if no price book exist than defaulting the standard price book
        if(sQuotePriceBook == null)
        {
            QuoteInLoop.Pricebook2Id =[SELECT Id FROM Pricebook2 Limit 1].Id;
        }
       
        //if pelco quote account is null
        if (sQuoteAccountId == null)
        {
            QuoteInLoop.Pelco_Account_Name__c=QuoteInLoop.AccountId;
            sQuoteAccountId=QuoteInLoop.AccountId;
        }
        //if pelco quote account is not null
        if (sQuoteAccountId != null)
        {    
            if(sMainAccountId <>sQuoteAccountId)
              {
               //make sure pelco account is not added to opportunity
               Integer iPelAccnt1=[SELECT count() FROM Pelco_Account__c WHERE AccountName__c = :sQuoteAccountId AND OpportunityName__c =:sOptyId ];
               if(iPelAccnt1 == 0)
                 {
                      // Inserting a new Pelco Account
                      String sAccountName=[SELECT Name FROM Account WHERE Id = :sQuoteAccountId].Name;
                      List <Pelco_Account__c > PelcoAccountLst =new List <Pelco_Account__c>();
                      Pelco_Account__c PelAcc1= new Pelco_Account__c();
                      PelAcc1.OpportunityName__c=sOptyId;
                      PelAcc1.AccountName__c=sQuoteAccountId;
                      PelAcc1.Name=sAccountName;
                      PelcoAccountLst.add(PelAcc1);
                      insert PelcoAccountLst;  
                  }//closing if for iPelAccnt1 
             }//end if
        }//end if 
      /*********************************
       * Created by Ron 09/04/2015
       * Update Exchange rate
       * 
       * *******************************/     
      

        
        //sQuoteAccountId = QuoteInLoop.Pelco_Account_Name__c;
        /*Account quoteAccount; 
        quoteAccount = [SELECT Currency_Code__c,Currency_Number__c FROM Account where ID = :sQuoteAccountId];
        currencyCode = quoteAccount.Currency_Code__c;
        currencyNumber = quoteAccount.Currency_Number__c;
        */
        currencyCode=[SELECT Currency_Code__c FROM Account where ID = :sQuoteAccountId LIMIT 1].Currency_Code__c;
        CurrencyNumber=[SELECT Currency_Number__c FROM Account where ID = :sQuoteAccountId LIMIT 1].Currency_Number__c;

        exchangeRateForQuote = [SELECT Exchange_Rate__c FROM Exchange_Rate__c Where Currency_Code__c = :currencyCode AND Currency_Number__c = :currencyNumber LIMIT 1].Exchange_Rate__c;
       
       if(exchangeRateForQuote == NULL){
           exchangeRateForQuote = [SELECT Exchange_Rate__c FROM Exchange_Rate__c WHERE Currency_Code__c = :currencyCode AND Default_Rate_for_Currency__c = TRUE LIMIT 1].Exchange_Rate__c;
       }
       
       QuoteInLoop.Exchange_Rate__c = exchangeRateForQuote;
       QuoteInLoop.Currency_Code_of_Account__c = currencyCode;
      
     }//closing forLoop
 }//closing trigger updateOpptyAccount

Here is the test class:
@istest
private class TestUpdateOptyAccount {
    static testMethod void TestOptyUpdate() {
        //Get pricebook Id
        Id PBId=test.getStandardPricebookId();
        //Create Account a
        Account a = new Account();
    	a.Name = 'Ritzy';
        a.Currency_Code__c='EUR';
        a.Currency_Number__c='2';
    	insert a;
        system.debug('Account a ID='+a.Id);
        
        //Create Account b
        Account b=new Account();
        b.Name='Testb';
        b.Currency_Code__c='EUR';
        b.Currency_Number__c='3';
        insert b;
        system.debug('Account b ID='+b.Id);
        
        //Create Opportunity
        Opportunity opty=new Opportunity();
		opty.Name='Test Opportunity';
        opty.StageName='Prospecting';
        opty.CloseDate=date.valueof('2015-09-10');
        opty.AccountId=a.Id;
        //opty.Pelco_Account_Name__c=PA.id;
		Insert opty; 
         system.debug('Opty Id='+Opty.Id);
        
        //Create pelco account
       /* Pelco_Account__c PA =new Pelco_Account__c();
        PA.Name='Ritzy';
        PA.AccountName__c=b.Id;
        PA.OpportunityName__c=Opty.id;
        Insert PA;
         system.debug('Pelco Account Id='+PA.id);
        */
         //Insert Quote
        Quote q =new Quote();
         q.name='Test Quote';
         q.opportunityId=opty.id;
         q.Pricebook2Id=PBId;
         //q.Pelco_Account_Name__c=a.Id;
        insert q;
        system.debug('qUOTE Id='+q.id);
        
        //insert Exchange Rate
        Exchange_Rate__c ER= new Exchange_Rate__c();
        ER.Currency_Code__c='USD';
        ER.Currency_Description__c='US DOLLARS DELIV';
        ER.Currency_Number__c='0';
        ER.Exchange_Rate__c=1.0;
        ER.Default_Rate_for_Currency__c=false;
        insert ER;
        
    }//end Method 1  

}

I am getting an error message when I am trying to create quote data 
 
16:45:17:934 EXCEPTION_THROWN [46]|System.DmlException: Insert failed. First exception on row 0; first error: CANNOT_INSERT_UPDATE_ACTIVATE_ENTITY, updateOpptyAccount: execution of BeforeInsert
Any Suggestions?

 
Hi ,
Can some one please to add the space before FROM in Dynamic SOQL.
string query ='SELECT ' + qFields +
                       'FROM contact'+
                       ' WHERE user_num__c = \'' + String.escapeSingleQuotes(uNum) + '\''+
                       ' LIMIT 1';
  • September 08, 2015
  • Like
  • 0
Can someone help me with this trigger/test class. I am trying to create a contract when the status of a DocuSign = Completed.

trigger CreateContractDocSignComp on dsfs__DocuSign_Status__c (after insert)
{
    List<Contract> ctr = new List<Contract>();
    
      for(dsfs__DocuSign_Status__c dsfs : Trigger.new)
      {
        if(dsfs.dsfs__Envelope_Status__c == 'Completed')
        {
             Contract c = new Contract(Name = dsfs.Name,
             Status = 'Draft',
             Total_Contract_Value__c =dsfs.Total_Contract_Value__c,
             StartDate = dsfs.Contract_Start_Date__c,
             Payment_Status__c = 'Ready to be Invoiced',
             AccountId = dsfs.dsfs__Company__c,
             Opportunity_Name__c = dsfs.dsfs__Opportunity__c);
             ctr.add(c);
         }
      }
      if(ctr.size() > 0)
      {
            System.debug('-ctr------->'+ctr.size());
            insert ctr;
      }     
}



@isTest
private class TestCreateContractDocSignCompTrigger 
{
    static testMethod void validateCreateContractDocuSignComp() 
    {   
       Account a = new Account(
       Name = 'Test Account');
    insert a;

       Opportunity o = new Opportunity(
       Name = 'Test Opp',
       Ready_for_Contract__c = true,
       CloseDate = System.Today(),
       AccountId = a.Id,
       StageName = 'Signed / Closed Sale',
       Amount = decimal.valueof('6995'));
    insert o;
    
       dsfs__DocuSign_Status__c  dsfs = new dsfs__DocuSign_Status__c(
       dsfs__Company__c = o.AccountId,
       dsfs__Opportunity__c = o.Name,
       dsfs__Envelope_Status__c = 'Completed',
       dsfs__DocuSign_Envelope_ID__c = '1001A123-1234-5678-1D84-F8D44652A382',
       dsfs__Subject__c = 'Document for eSignature');
    insert dsfs;
 Test.StartTest();
       
            
            List<Contract> lstContr = [select id from contract where Opportunity_Name__c =:o.id];
                 //System.assertNotEquals(1stContr,null);
                 
        Test.StopTest();
       
      }
}

Thanks!

Shannon
Hello,

Looking for a little direction to get my org cleaned up. I've inherited a few years worth of unmaintaned Apex and VF pages that are causing all kinds of problems - the most immediate of which is preventing me from deploying change sets. 

I fixed a number of SOQL related errors for one specific change set, but I'm still unable to delpoy. Apparently my code coverage is only 66%. So my question is: Where do I even start looking to address the gap from 66% to 75% ?  

Short term goal is simply to get a change set deployed. I know longer term we'll need a more comprehensive update to existing customizations.

The options I see are: 
  - Get coverage up to 75% percent (unsure where to start here since I'm just getting a general error message - and no specific classes or triggers are called out)
  - Start deleting classes that are no longer relevant (scary because I'm unsure of what other issues this may cause....)

Any help, or general direction on how to start tackling this issue would be great. Thanks!



 
Hi,
I have a partner portal page which contains a phone number field which needs to be auto populated based on the URL..
Here s the code:
<apex:page standardcontroller="case" 
            extensions="ContactUs"
> 
   
    
    <apex:form id="formid">
        <apex:inputHidden value="{!selectedlanguageParam}" id="theHiddenInput"></apex:inputHidden>
        <apex:actionFunction name="languagefunction" action="{!languageSearch}" status="fetchStatus"  />                  
        <apex:pageBlock id="PbId" rendered="{!firstBlock}">
        
        <span style="color:red;"> <apex:pagemessages /> </span>
            
                <div>
                    <div class="headerText">
                        <h1 class="h1Text">{Case}</h1>
                    </div> 
                </div>
            
                    
                <apex:outputpanel id="firstBlock1">
                    <div width="90%" cellspacing="10" cellpadding="5">
                        <div>
                            <apex:outputPanel rendered="{!isReqPhNo2}">
                                <b class="textlabel">{!$Label.Phone_Number}</b>
                            </apex:outputPanel>
                            <apex:outputPanel rendered="{!isReqPhNo}">
                                <b class="textlabel">{!$Label.Phone_Number}<span class="required">*</span></b>
                            </apex:outputPanel>
                        </div>
                        <div class="test1"> 
                            <apex:inputText id="Number" value="{!phoneNumber}" styleclass="txtbx" maxlength="35"/>                          
                        </div>                        
                    </div> 
                </apex:outputpanel>
                      
        
</apex:page>

public class ContactUs 
{
public ContactUs(ApexPages.StandardController stdController) { 
        csccustom=new Submit_Acase__c();
    }
	
	public PageReference languageSearch(){
        try{
        
        currentRequestURL = URL.getCurrentRequestUrl().toExternalForm();
          system.debug('selectedlanguageParam===='+selectedlanguageParam);
          PageReference p;
          system.debug('currentRequestURL==='+currentRequestURL);
          if(selectedlanguageParam=='Japanese'
          {
                if(currentRequestURL.contains('l=')) currentRequestURL = currentRequestURL.subString(0,currentRequestURL.length()-8);
                p = new PageReference(currentRequestURL+'?l=zh_KN
  
          }
          else
          {
                if(currentRequestURL.contains('l=')) currentRequestURL = currentRequestURL.subString(0,currentRequestURL.length()-8);
                //p = new PageReference(currentRequestURL+'?l=en_US&pageid:formid:PbId:Number=1');//--i was trying something like this
                p = new PageReference(currentRequestURL+'?l=en_US');
                  
  
          }
        
          return p;
          }catch(Exception ex){
        }
        return null;
     }

Also i have attached the screenshot.
User-added image


I was trying something like this:
http://writeforce.blogspot.in/2013/01/prepopulating-fields-using-url-hacking.html
Please advise
Hi i am new to salesforce. i have to implement one functionality in salesforce.I am creating Employee leave system. Scenario is
If u have taken leave on certain date(e.g. 1st may) and it got approved and then again if you try to apply for another leave on the same date(1st may) then your application will not be submitted.How to do that?
please Help.
i have 2 objects, Opportunity and CustomOpportunity(custom obj.) . I want to write a trigger, if i create a record on Opportunity, then one record should be created on CustomOpportunity and if i edit the record, the changes should be reflect on the record of Customopportunity object and vice versa.

 
Hi Team,

I develop a visualforce page and i export table DIV content to PDF but after export it shows horizontally. i want to export results in Table format.
Result:
-----------
PNR
Invoice Number
Invoice Date
Case Number
Ticket Number
Airline
Remarks
Consolidator
asdf234
2342
8/12/2015
00500123
24234
QR
Hariworld
AV45S6
123123
8/19/2015
00500131
24234
AA
Test Remakes1
Test Remakes2
Test Remakes3
Test Remakes4
Test Remakes5
 
HI,

When trying to insert AccountShare record with RowCause 'TerritoryManual', we are getting the following error. What is the problem and how to resolve it. Urgent help required.Thank you.

Field Integrity Exception: RowCause (Cannot insert sharing rows with this cause).

If we comment rowcause and insert then it works fine.
Hi All,

Relative newbie to Apex. I am looking to create a trigger that will create a Record of a custom Object I have created when a Lead Status is changed to 'No'. I would only like this Trigger to apply to Leads owned by Users with a certain Profile. Please see below:

The Profile restriction that I used doesn't seem to work and I have been spinning my tires and Google-ing around to no avail. Does anyone have any insight? Thanks.
trigger EPS_LeadCycleCreator on Lead (before update) {
    List<Lead_Cycle__c> LeadCycles = new List<Lead_Cycle__c>();
    
    for (Lead l : trigger.new) {
        Lead oldLead = trigger.oldMap.get(l.Id);
        
        Boolean oldLeadIsNo = oldLead.Status.equals('No');
        Boolean newLeadIsNo = l.Status.equals('No');
        
        if (l.Owner.ProfileId == '00e60000000rNmn' && (!oldLeadIsNo && newLeadIsNo)) {
            Lead_Cycle__c LeadCycle = new Lead_Cycle__c ();
            LeadCycle.Lead__c = l.id;
            LeadCycle.Cycle_Start_Date__c = l.LastTransferDate;
            LeadCycle.Cycle_End_Date__c = system.today();
            LeadCycle.OwnerId = '00560000002VLHw';
        
            LeadCycles.add(LeadCycle);
        }
    
    }
    
    insert LeadCycles;
}

 
I need to set the Partner Users on previous Opportunities registered by that partner user. Only designation i have to connect the two is the LeadSource field on Opportunities that lists "Partner-XXXX", xxxx is the company name. There are over 10000 records that don't have a partner listed. What would be the best of doing this?
Hi,

I have executed "Run all test" to get code coverage of all apex classes. Is there way to get all apex classes code coverage with percentage copy to excel sheet. I am able to see all classes with percentage in Developer console. But not able to copy all those. Please provide some suggestion.
I wrote a custom controller(Wizard based) and two VF pages.

My Intention is to capture the details of custom object(Candidate)Using first page I and
Using Next page I am displying the same fields and save button.

But the records are not saving and not displaying in the VF2.

Controller:
Apex Controller:

public with sharing class CanrecordCon {

public Candidate__C Can{ get; private set; }
public CanrecordCon() {
Id id = ApexPages.currentPage().getParameters().get('id');
if(id == null) 
 new Candidate__C();
 else
Can=[SELECT Name, Phone__C FROM Candidate__C WHERE Id = :id];
}

public PageReference Next() 
{
      return Page.newCanrecord1;
 }

public PageReference save() {
try {

insert(Can);
} catch(System.DMLException e) {
ApexPages.addMessages(e);
return null;
}
// After Save, navigate to the default view page:
return (new ApexPages.StandardController(Can)).view();
}
}

Vf-page1:
<apex:page Controller="CanrecordCon" >

<apex:form >
<apex:pageBlock mode="edit">
<apex:pageMessages />
<apex:pageBlockSection >
<apex:inputField value="{!Can.name}" id="No1"/>
<apex:inputField value="{!Can.Phone__c}" id="No2"/>

</apex:pageBlockSection>
<apex:pageBlockButtons location="bottom">
<apex:commandButton value="Next" action="{!Next}"/>
</apex:pageBlockButtons>
</apex:pageBlock>
</apex:form>
  
</apex:page>

Vf page2:

<apex:page controller="CanrecordCon" tabstyle="Account">
  
  <apex:form >
<apex:pageBlock >
<apex:pageBlockSection title="Details" collapsible="false"  columns="2">
            <apex:outputField id="a1" value="{!Can.Name}"/> 
            
            <apex:outputField id="a3" value="{!Can.Phone__c}"/>          
        </apex:pageBlockSection></apex:pageBlock>
   <apex:commandButton value="Save" action="{!save}"/>
</apex:form>
</apex:page>

 
I have an object with more than one million records. For same object, I am getting a file for processing every other day. My requirement is to compare all the records(+million) in the file with existing records in the object.(Assume there is a unique key AccountID in the object and file for comparing). If any changes are there like value of any attribute changes, we have to update the existing record.What is the best way to achieve this? .. I know that we can process upto 50 million records using batch. But i have one more concern like how can i fetch more than 50k records in execute method from object(+million) for comparison...?  and also i want to know is there any performance issue if we process this much huge data...?
Hi,

I have written a vf page with controller Example1 to  get sum  of input field A, B in the  third field C. however I  am  getting error while click  on save. code  is mentioned  below, please help.



<apex:page controller="Example1" >
  <apex:form >
 
  <div>
  
  <apex:commandButton value="Save" action="{!soo}"/>
Name:<input type="Text"/><br/>
<br/>
<br/>
A's Count = <input type="Integer"/><br/>
<br/>
<br/>
B's Count = <input type="Integer"/><br/>
<br/>
<br/>

C's Count = <Output type="Integer"/><br/>
<br/>


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



public class Example1 {
 public integer A{get;set;}
 public integer B{get;set;}
 public integer C{get;set;}
 
 public integer soo(){
 C= A+B;
 return C;
 
 }
 
}