• Sagarika Rout
  • NEWBIE
  • 290 Points
  • Member since 2013

  • Chatter
    Feed
  • 7
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 65
    Replies

I don't know where I am going wrong. I am being redirected to other Vfpage yet niether URL changes nor I am able to fetch the values from one Vfpage to other.

And I am using single controller for both Vfpages. Agony is I am getting two develpment mode windows of two visualforce page; when I click "edit".

Vfpage one 

<apex:page controller="WrapperAccountextension">
   <apex:form >
        <apex:pageBlock title="Account List">
        
            <apex:pageBlockButtons >
                <apex:commandButton value="Edit" action="{!geteditormoz}" rerender="out"/>
            </apex:pageBlockButtons>
           
            <apex:pageBlockTable value="{!Accountsz}" var="Acc">
                <apex:column headerValue="Action">
                   
                    <apex:inputCheckbox value="{!Acc.selected}"/>
                </apex:column>
                
                <apex:column value="{!Acc.con.Name}" />
                <apex:column value="{!Acc.con.Phone}" />
                <apex:column value="{!Acc.con.Fax}"/>
                <apex:column value="{!Acc.con.AnnualRevenue}"/>
                <apex:column value="{!Acc.con.AccountNumber}"/>
            </apex:pageBlockTable>
        
        </apex:pageBlock>
        </apex:form>
</apex:page>

 

=========================================================================================================================================================================================================================================================================================================================Vfpage two:-

<apex:page controller="WrapperAccountextension">
<apex:form >
 <apex:pageblock mode="InlineEdit">
        <apex:pageBlockButtons >
        <apex:commandButton value="Save" action="{!rasavez}"/>
        </apex:pageBlockButtons>
      
               <apex:pageBlockTable value="{!selectedAccountsz}" var="Rec" id="out" title="Selected Accounts" columnsWidth="400px,400px">
                    <apex:column headerValue="Account Name">
                        <apex:outputField value="{!Rec.name}"/>
                    </apex:column>   
                    <apex:column headerValue="Phone">
                        <apex:outputField value="{!Rec.Phone}"/>
                    </apex:column>             
                    <apex:column headerValue="Fax">
                    <apex:outputField value="{!Rec.Fax}"/>
                    </apex:column>
                    <apex:column headerValue="Annual Revenue">
                    <apex:outputField value="{!Rec.AnnualRevenue}"/>
                    </apex:column>
                    <apex:column headerValue="Account Number">
                    <apex:outputfield value="{!Rec.AccountNumber}"/>
                    </apex:column>
                </apex:pageBlockTable>   
               
          </apex:pageblock>
</apex:form>
</apex:page>

=========================================================================================================================================================================================================================================================================================================================Controller:-

public class WrapperAccountextension {


Public pagereference rasavez(){

Update selectedAccountsz;
return null;
}

Public Pagereference editmoderz(){

return null;
}

public PageReference geteditormoz(){
Pagereference ldkedit = New PageReference('/apex/WrapperAccountlsteditera');
processSelectedz();

ldkedit.setRedirect(true);

return ldkedit;
}
    
 public List<cAccountz> accListz {get; set;}
  public List<Account> selectedAccountsz{get; set;}
//Adding the Records to inner class and to get the values for page block table.
  public List<cAccountz> getAccountsz(){
        if(accListz == null){
            accListz = new List<cAccountz>();
            for(Account acc : [select Id, Name, Phone,Fax,AnnualRevenue,AccountNumber from Account limit 25]){
                  accListz.add(new cAccountz(acc));
            }
         }
       return accListz;
   }  
//on button click it will show the list of records what we have selected.
  public PageReference processSelectedz(){     
  
  
        selectedAccountsz= new List<Account>();
        for(cAccountz cCon : getAccountsz()) {
            if(cCon.selected == true){
                selectedAccountsz.add(cCon.con);
                
            }
        }            
        return null;
   }
  //  Inner class for capture the records
  public class cAccountz {
        public Account con {get; set;}
        public Boolean selected {get; set;}
        public cAccountz(Account c) {
            con = c;
            selected = false;
        }
   }
     
}

 

Thanks and Regards,

Razzzaq.

Hi,
I have created trigger on the sObject ContentDocument (before delete) and contentVersion (before insert, after insert). We want to create test class for these triggers. While inserting ContentVersion we are getting 'FIELD_CUSTOM_VALIDATION_EXCEPTION' error. For contentDocument we have tried to fetch exising ContentDocument using SOQL and tried to delete it, but it does't work. Please help me to write correct test method for contentVersion and ContentDocument.
Thanks
Hi All,

By this code I am trying to do pagination.

list of records = 131.

when I am trying to click on (>>) button a nd imediately when I click on (<) button, it shown the error as: List index out of bounds: -69
please help me.


Thanks in advance

public List<wrapper> getInventories()
      {
       
        if(StIndex == 0)
        {
            fir = false;
            last = true;
          
           
            if (lstWrapper.size()==0){
            start_record = 0;
            total_records=0;
            }
           
          
           
            else start_record = 1;
            total_records = lstWrapper.size();
            If(lstWrapper.size()<totalNumberOfRecord)
            {
                end_record = lstWrapper.size();
                last = false;
            }
            else
            {
                last = true;
                end_record = totalNumberOfRecord;
            }
        }
        else if(EndIndex == lstWrapper.size()-1)
        {
            fir = true;
            last = false;
            end_record =lstWrapper.size();
        }
        else
        {
            fir = true;
            last = true;
        }
        if(StIndex != -1 && EndIndex != -1)
        {
           
            List<wrapper> lstW = new List<wrapper>();
           
            if(EndIndex > lstWrapper.size()-1)
            {
                EndIndex = lstWrapper.size()-1;
            }
           
           
            for(integer i=StIndex;i<=EndIndex;i++)
            {
           
                lstW.add(lstWrapper[i]);   >>>>>>>>>>>>>>>>>>>>>>>>>>>>>  error
            }
            return lstW;
       
      
       }
        return lstWrapper;
      }
   public pagereference next()
        {
              if(EndIndex == lstWrapper.size()-1){
                return null;
            }
            StIndex = EndIndex+1;
            EndIndex = EndIndex + totalNumberOfRecord;
            if(EndIndex > lstWrapper.size()-1){
                EndIndex = lstWrapper.size()-1;
            }
            system.debug('StIndex-----'+StIndex);
            system.debug('EndIndex -----'+EndIndex);
            return null;          
        }
        public pagereference previous()
        {
            
             if(StIndex == 0){
                return null;
            }
            if(EndIndex < StIndex)
            {
              StIndex = lstWrapper.size() - totalNumberOfRecord; 
            }
            EndIndex = StIndex-1;
            StIndex = StIndex - totalNumberOfRecord;
            system.debug('StIndex-----'+StIndex);
            system.debug('EndIndex -----'+EndIndex);
            return null;
        }
        public pagereference first()
        {
             if(StIndex == 0){
                return null;
            }
            StIndex = 0;
            if(EndIndex > lstWrapper.size()-1){
               EndIndex = lstWrapper.size()-1;
            }else{
                EndIndex = totalNumberOfRecord-1;
            }
            system.debug('StIndex-----'+StIndex);
            system.debug('EndIndex -----'+EndIndex);
            return null;    
        }
        public pagereference last()
        {
             if(EndIndex == lstWrapper.size()-1){
                return null;
            }           
            EndIndex = lstWrapper.size()-1;                        
            StIndex = lstWrapper.size()-totalNumberOfRecord;
            system.debug('StIndex-----'+StIndex);
            system.debug('EndIndex -----'+EndIndex);
            return null;   
        }
I am new to salesforce and would like to know the ideal IDE for apex development. I tried Developer Console, but  for beginners its very difficult to code in that. What are IDE tools that are generally used in industry?
i have written this method but it keeps giving me this error :
Error: Compile Error: Variable does not exist: childOpps at line 14 column 23

public class StandardControllerExtension {
Account acct;
public StandardControllerExtension (ApexPages.standardController std)
{
acct = (Account)std.getRecord();
}
public List<Opportunity> getChildOpps() {
return [Select Name, Amount, StageName, CloseDate From Opportunity
Where AccountId = :acct.Id
and (IsWon = true or IsClosed = false)];
}
private void createTaskOnChildOpps () {
List<Task> tasksToInsert = new List<Task> ();
for (Opportunity opp : childOpps) {
if (!opp.isClosed) {
tasksToInsert.add (
new Task(
WhatId = Opp.Id,
OwnerId = opp.OwnerId,
ActivityDate =Date.today () + 3,
Status = 'Not Started',
Subject = 'Send follow-up email to pirmary contact'
)
);
}
}
if (tasksToInsert.size() >0 )insert taskToInsert;
}
public PageReference save() {
if (acct.Rating =='Hot') {
createTaskOnChildOpps();
}
update acct;
return new PageReference ('/' + acct.Id);
}
}

can anyone help me with this ? 

Good Morning,

 

I am fairly new to apex and have been trying to create a Trigger that updates all OpportunityLineItem Quantity field to a specific value from a named Expected_Number_Of_Students__c on the related Opportunity.

 

I have got the following  compile error:

 

Error: Initial term of field expression must be a concrete SObject: MAP<String,Decimal> at line 23 column 32

 

The code is as follows.

 

trigger opportunityLineItemsQuantity on Opportunity (after update) {
    //Get list of record types from Opportunity
    list<RecordType> rTypes = [Select Name, Id from RecordType Where SObjectType= 'Opportunity'];
    
    //Create a Map for the Opportunity record types
    Map<String,Id> OppRecordTypes = new Map<String, Id>{};
    for(RecordType rt: rtypes)
    OppRecordTypes.put(rt.Name,rt.Id);
       
    //Create a map for Opportunity records
    Map<String, Decimal> oppList = new Map<String, Decimal>{};
    
    //Iterate through the Opportunities
    for(Opportunity opp : Trigger.New)  
    if(opp.RecordTypeId == OppRecordTypes.get('ELT Digital Products Opportunity')){
    if(Opp.Expected_Number_of_Students__c != Null){
    oppList.put(opp.Id,Opp.Expected_Number_Of_Students__c);
    }
    }

    //Get Opportunity Line Items that are associated to the Opportunity
    for(OpportunityLineItem oli :  [Select OpportunityId, Quantity From OpportunityLineItem Where OpportunityId In : oppList.keyset()]){
   //This is where the code is failing. This is where I want the OpportunityLineItem Quantity to be the same as the Opportunity Expected_Number_Of_Sudents__c value.

   oli.Quantity = oppList.get(oppList.Expected_Number_Of_Students__c);
    
    }

}

 

 

I am not sure how to resolve this on line 23 I would be very grateful for some guidance on this.

 

Thanks

need help on test class code coverage of cf page

Hi All ,
I have two RTF fields, 1 is Description , 2nd is Temporarly Description
I have a workflow which is updating Values of Temporarly Description with Description.
Problem: If Description contains Special characters like (‘ ,”,&,<,>,^) , after updating  field Temporarly Description. Special characters are getting replaced with different characters (for eg: ‘ - &quot, &-&amp).
Can anyone suggest how to get rid of this extra characters.

Thanks,
Sagarika
I have Map<String, String> m1 = ........;/(Map Contain only one record information)
And I want to update the record into account How can I do this?
 
Hi,
Can any one help me with an example of a standard object that’s also junction object in salesforce.

Thanks in Advance
Hi,

I have Integer Count in my controller.
The value of this count is dynamically rendered through query.
Count = [Select Count() from User where UserRole.Name =: 'Manager'];

How to render <apex:outputPanel> in visualforce page till count becomes 0.
Also the outputPanel should be displayed only once for one user.

Thanks

 
  • April 08, 2015
  • Like
  • 1
eg for Year 2015 i have four Opportunitites i need to fetch those four opportunites based on parent id
for(Year__c y: ylist)
{
for(Opportunities opp : y.Opportunities)
{

}

I don't know where I am going wrong. I am being redirected to other Vfpage yet niether URL changes nor I am able to fetch the values from one Vfpage to other.

And I am using single controller for both Vfpages. Agony is I am getting two develpment mode windows of two visualforce page; when I click "edit".

Vfpage one 

<apex:page controller="WrapperAccountextension">
   <apex:form >
        <apex:pageBlock title="Account List">
        
            <apex:pageBlockButtons >
                <apex:commandButton value="Edit" action="{!geteditormoz}" rerender="out"/>
            </apex:pageBlockButtons>
           
            <apex:pageBlockTable value="{!Accountsz}" var="Acc">
                <apex:column headerValue="Action">
                   
                    <apex:inputCheckbox value="{!Acc.selected}"/>
                </apex:column>
                
                <apex:column value="{!Acc.con.Name}" />
                <apex:column value="{!Acc.con.Phone}" />
                <apex:column value="{!Acc.con.Fax}"/>
                <apex:column value="{!Acc.con.AnnualRevenue}"/>
                <apex:column value="{!Acc.con.AccountNumber}"/>
            </apex:pageBlockTable>
        
        </apex:pageBlock>
        </apex:form>
</apex:page>

 

=========================================================================================================================================================================================================================================================================================================================Vfpage two:-

<apex:page controller="WrapperAccountextension">
<apex:form >
 <apex:pageblock mode="InlineEdit">
        <apex:pageBlockButtons >
        <apex:commandButton value="Save" action="{!rasavez}"/>
        </apex:pageBlockButtons>
      
               <apex:pageBlockTable value="{!selectedAccountsz}" var="Rec" id="out" title="Selected Accounts" columnsWidth="400px,400px">
                    <apex:column headerValue="Account Name">
                        <apex:outputField value="{!Rec.name}"/>
                    </apex:column>   
                    <apex:column headerValue="Phone">
                        <apex:outputField value="{!Rec.Phone}"/>
                    </apex:column>             
                    <apex:column headerValue="Fax">
                    <apex:outputField value="{!Rec.Fax}"/>
                    </apex:column>
                    <apex:column headerValue="Annual Revenue">
                    <apex:outputField value="{!Rec.AnnualRevenue}"/>
                    </apex:column>
                    <apex:column headerValue="Account Number">
                    <apex:outputfield value="{!Rec.AccountNumber}"/>
                    </apex:column>
                </apex:pageBlockTable>   
               
          </apex:pageblock>
</apex:form>
</apex:page>

=========================================================================================================================================================================================================================================================================================================================Controller:-

public class WrapperAccountextension {


Public pagereference rasavez(){

Update selectedAccountsz;
return null;
}

Public Pagereference editmoderz(){

return null;
}

public PageReference geteditormoz(){
Pagereference ldkedit = New PageReference('/apex/WrapperAccountlsteditera');
processSelectedz();

ldkedit.setRedirect(true);

return ldkedit;
}
    
 public List<cAccountz> accListz {get; set;}
  public List<Account> selectedAccountsz{get; set;}
//Adding the Records to inner class and to get the values for page block table.
  public List<cAccountz> getAccountsz(){
        if(accListz == null){
            accListz = new List<cAccountz>();
            for(Account acc : [select Id, Name, Phone,Fax,AnnualRevenue,AccountNumber from Account limit 25]){
                  accListz.add(new cAccountz(acc));
            }
         }
       return accListz;
   }  
//on button click it will show the list of records what we have selected.
  public PageReference processSelectedz(){     
  
  
        selectedAccountsz= new List<Account>();
        for(cAccountz cCon : getAccountsz()) {
            if(cCon.selected == true){
                selectedAccountsz.add(cCon.con);
                
            }
        }            
        return null;
   }
  //  Inner class for capture the records
  public class cAccountz {
        public Account con {get; set;}
        public Boolean selected {get; set;}
        public cAccountz(Account c) {
            con = c;
            selected = false;
        }
   }
     
}

 

Thanks and Regards,

Razzzaq.

In my project we have custom pop up section which will render during "onmouseover" event and it will go off if "onmouseout" happens. Its implemented in Javascript. (No action functions). The issue that we are facing here is we do want to scroll down/up in the pop up section, on which i need help in doing ? As soon as i moved out from the element, pop up goes off. Please help me to get any ideas ?

User-added image

Target element code:
<apex:outputPanel rendered="{!c.isSecondaryControlsPresent}" id="controls"  onmouseover="showMultFunction(this);" onmouseout="showMultFunction1(this);" onclick="javascript:void(0);">

In js fucntion it will make some other panel to render in Vf page.

Hi,

I created a trigger and wrote a test class on my DEV-environment.
Then I started the unit test. This test was not starting and not running. The system means, that I should wait, what I did, but nothing was happeing.
So, is there a bug or something else?

Regards
Robert

Hi All ,
I have two RTF fields, 1 is Description , 2nd is Temporarly Description
I have a workflow which is updating Values of Temporarly Description with Description.
Problem: If Description contains Special characters like (‘ ,”,&,<,>,^) , after updating  field Temporarly Description. Special characters are getting replaced with different characters (for eg: ‘ - &quot, &-&amp).
Can anyone suggest how to get rid of this extra characters.

Thanks,
Sagarika
Hi,

I have 4 number fields which shouold be visible or to be edited only if


The value of a picklist field "Type__c" is set to "Exception" , apart from that those number fields should not be visible or non editbale


Let me know how to achieve this

Thanks in Advance
Hi,
I'm having trouble with the following code in the live system ... in the sandbox everthing works fine:

...
Map<String, Schema.SObjectField> M2;		
String queryLead = 'SELECT '; 
M2 = Schema.SObjectType.Lead.fields.getMap();

for(string fName : M2.keySet()){
   queryLead += fName+',';
}       

queryLead = queryLead.removeEnd(','); 
queryLead += ' FROM Lead WHERE Email IN :emails AND Email != null AND Id NOT IN :contactOrLeadIds';

List<Lead> leads = Database.query(queryLead);
The Database.query line produces an error saying that the field "address" could not be accessed and all the __c thing ... but its just in the live system ...
Any ideas?

Thanks!

Hi,
I have created trigger on the sObject ContentDocument (before delete) and contentVersion (before insert, after insert). We want to create test class for these triggers. While inserting ContentVersion we are getting 'FIELD_CUSTOM_VALIDATION_EXCEPTION' error. For contentDocument we have tried to fetch exising ContentDocument using SOQL and tried to delete it, but it does't work. Please help me to write correct test method for contentVersion and ContentDocument.
Thanks
Hi Newbie here,

In my Opportunities Tab, I have a lookup field called "relationship manager".  It looks up Contact for the relationship manager.

My goal is to write a trigger that when create or update an Opportunity and input the Relationship manager fields, it automatically create a Contact Role for the same person.

This is what i have so far, I dont know how to extract Opp ID and Contact ID as I think I will need it.  Please help.

Trigger CreateContactRole on Opportunity (after insert, after update)
{
For (Opportunity N:Trigger.now)

Opportunitycontactrole A = New Opportunitycontactrole ();
A.oppid = n.oppid;
a.RMID = n.rmid;
a.Role = ‘Relationship Manager’;
a.Isprimary = ‘True’;
}