• krishna gupta
  • NEWBIE
  • 40 Points
  • Member since 2014

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 15
    Questions
  • 8
    Replies
I have a one defect where apex:inputcheckbox is used inside the <apex:pageblokbuttons> and located for both location. If I am selecting at top checkbox, then it is working, if i am selecting the bottom checkbox, it is not working.

Is there any way that if I do check in one place, it should checked at both places.
 
<apex:pageBlockButtons location="both">               
	<apex:outputText value="Testing" />
	<apex:inputCheckbox id="test" value="{!test}"   />
</apex:pageBlockButtons>

 
I have a requirement where i have to display the Sum of List Price of all QuoteLineItems present under a primary quote, at a opportunity level in one field.
How we can achieve this?
 
Hi,

I have a requirement where i have to select the contact, once we save the opportunity record, it should throw error message if phone and email field are blank at contact record.

I am putting the below validtion rule, but it is not working.
AND(ISNULL( Key_Contact__r.Email ) , OR( ISNULL(  Key_Contact__r.Phone  ) , ISNULL( Key_Contact__r.OtherPhone ) ) )
GIVEN that I am a Sales Rep
WHEN I am log on Salesforce
THEN I will have option to update an Opportunity clicking on "Edit" Button 
ONLY if I am the owner of the record or if I am add on Opportunity team.
AND THEN I can edit fields open fields
AND Save record.

How to solve this?
Currently I am using the below  code, but my account  record counts is more and it is not taking more than 200 records at a time, and if i am not providing the limit, then it is throwing error.
Select AccountId, count(id) from Contact group by AccountId having count(id)  > 100 limit 200

 
in one drop down, i want to display all object, once i will select the object from dropdown, in second dropdown it will show all the fields for selected objects.
Apex Class:
-----------------
public class OppsController {

    public ApexPages.StandardSetController setCon {
        get {
            if(setCon == null){
                setCon = new ApexPages.StandardSetController(Database.getQueryLocator(
                    [SELECT name, type, amount, closedate FROM Opportunity]));
                setCon.setPageSize(5);
            }
            return setCon;
        }
        set;
    }
    
    public List<Opportunity> getOpportunities(){
        return (List<Opportunity>) setCon.getRecords();
    }
}

Visualforce Page:
-------------------------
<apex:page controller="OppsController" >
    <apex:chart data="{!Opportunities}" height="400" width="600">
        <apex:axis type="Category" position="left" fields="name" title="Opportunities" />
        <apex:axis type="Numeric" position="bottom" fields="amount" title="Amount" />
        <apex:barSeries orientation="horizontal" axis="bottom" xField="name" yField="amount" />
    </apex:chart>
    <apex:dataTable value="{!Opportunities}" var="opp" >
        <apex:column headerValue="Opportunity" value="{!opp.name}" />
        <apex:column headerValue="Amount" value="{!opp.amount}" />
    </apex:dataTable>
</apex:page>
Hi,

I have two visualforce page and one custom controller, but i am getting the error "Unknown property 'AccountStandardController.selectedOptions'".
My controller name : DynamicCustomizableListHandler
visualforce page1 : DynamicCustomizableList
visualforce page 2 : CustomizeDynamicList
public class DynamicCustomizableListHandler {

    private ApexPages.StandardSetController controller;
    private PageReference savePage;
    
    private Set<String> unSelectedNames = new Set<String>();
    private Set<String> selectedNames = new Set<String>();
    private Set<String> inaccessibleNames = new Set<String>();
    
    public 	DynamicCustomizableListHandler(ApexPages.StandardSetController controller){
        this.controller = controller;
        loadFieldsWithVisibility();
    }
    
    private void loadFieldsWithVisibility(){
        Map<String, Schema.SObjectField> fields = Schema.SObjectType.Account.fields.getMap();
        for(String s : fields.keySet()){
            if(s != 'Name'){
                unSelectedNames.add(s);
            }
            if(!fields.get(s).getDescribe().isAccessible()){
                inaccessibleNames.add(s);
            }
        }
    }
    
    public List<String> getDisplayFields(){
        List<String> displayFields = new List<String>(selectedNames);
        displayFields.sort();
        return displayFields;
    }
    
    public PageReference customize(){
        savePage = ApexPages.currentPage();
        return Page.CustomizeDynamicList;
    }
    
    public PageReference show(){
        controller.reset();
        controller.addFields(getDisplayFields());
        return savePage;
    }
    
    public List<SelectOption> getSelectedOption(){
        return selectOptionsFromSet(selectedNames);
    }
    
    public List<SelectOption> getUnSelectedOptions(){
        return selectOptionsFromSet(unSelectedNames);
    }
    
    private List<SelectOption> selectOptionsFromSet(Set<String> opts){
        List<String> optionsList = new List<String>(opts);
        optionsList.sort();
        List<SelectOption> options = new List<SelectOption>();
        for(String s : optionsList){
            options.add(new SelectOption(s, decorateName(s), inaccessibleNames.contains(s)));
        }
        return options;
    }
    
    private String decorateName(String s){
        return inaccessibleNames.contains(s) ? '*' + s : s;
    }
    
    public transient List<String> selected {get; set;}
    public transient List<String> unselected {get; set;}
    
    public void doAdd(){
        moveFields(selected, selectedNames, unSelectedNames);
    }
    
    public void doRemove(){
        moveFields(unselected, unSelectedNames, selectedNames);
    }
    
    private void moveFields(List<String> items, Set<String> moveTo, Set<String> removeFrom){
        for(String s : items){
            if(! inaccessibleNames.contains(s)) {
                moveTo.add(s);
                removeFrom.remove(s);
            }
        }
    }
}
 
<apex:page standardController="Account" recordSetVar="accountList" extensions="DynamicCustomizableListHandler" >
    <br/>
    <apex:form>
    	<apex:pageBlock>
            <apex:outputLabel value="Select Accounts View: " for="viewsList" />
            <apex:selectList id="viewsList" size="1" value="{!filterId}">
                <apex:actionSupport event="onchange" reRender="theTable" />
                <apex:selectOptions value="{!listViewOptions}" />
            </apex:selectList>
        </apex:pageBlock>
        <apex:pageBlock title="Accounts" mode="edit">
            <apex:pageMessages />
            <apex:panelGroup id="theTable">
                <apex:pageBlockTable value="{!accountList}" var="acct">
                    <apex:column value="{!acct.Name}" />
                    <apex:repeat value="{!displayFields}" var="f">
                        <apex:column value="{!acct[f]}" />
                    </apex:repeat>
                </apex:pageBlockTable>
            </apex:panelGroup>
        </apex:pageBlock>
        <br/>
        <apex:commandButton value="Customize List" action="{!customize}" />
    </apex:form>
</apex:page>
 
<apex:page standardController="Account" recordSetVar="ignored" extensions="DynamicCustomizableListHandler">
    <br/>
    <apex:form>
    	<apex:pageBlock title="Select Fields to Display" id="selectionBlock">
            <apex:pageMessages />
            <apex:panelGrid columns="3">
            	<apex:selectList id="unselected_list" required="false" value="{!selected}" multiselect="true" size="20" style="width:250px" >
                    <apex:selectOptions value="{!unSelectedOptions}" />
                </apex:selectList>
                <apex:panelGroup>
                	<apex:commandButton value=">>" action="{!doAdd}" reRender="selectionBlock" />
                    <br/>
                    <apex:commandButton value="<<" action="{!doRemove}" reRender="selectionBlock" />
                </apex:panelGroup>
                <apex:selectList id="selected_list" required="false" value="{!unselected}" multiselect="true" size="20" style="width:250px">
                    <apex:selectOptions value="{!selectedOptions}" />
                </apex:selectList>
            </apex:panelGrid>
            <em> Note: Fields marked <strong>*</strong> are inaccessible to your account</em>
        </apex:pageBlock>
        <br/>
        <apex:commandButton value="Show These Fields" action="{!show}" />
    </apex:form>
</apex:page>
Hi Guys,

I have a requirement for approval Process.
The record is assigned to the user,  i want to approve the record without clicking on Approve/Reject.
It means the status has to be changed from Pending to Approved.
Please let me know if anyone having idea.

Sales Price: field integrity exception: UnitPrice (only one of unit price or total price may be specified)
Insert failed. First exception on row 0; first error: FIELD_INTEGRITY_EXCEPTION, field integrity exception: UnitPrice (only one of unit price or total price may be specified): [UnitPrice]
Hi All,

I have a requirement where i have to clone parent, their child and for each child their subchild.
Can onyone let me know how to process this requirement?
I have a requirement where i have to display the Sum of List Price of all QuoteLineItems present under a primary quote, at a opportunity level in one field.
How we can achieve this?
 
Hi,

I have a requirement where i have to select the contact, once we save the opportunity record, it should throw error message if phone and email field are blank at contact record.

I am putting the below validtion rule, but it is not working.
AND(ISNULL( Key_Contact__r.Email ) , OR( ISNULL(  Key_Contact__r.Phone  ) , ISNULL( Key_Contact__r.OtherPhone ) ) )
in one drop down, i want to display all object, once i will select the object from dropdown, in second dropdown it will show all the fields for selected objects.
Hi,

I have two visualforce page and one custom controller, but i am getting the error "Unknown property 'AccountStandardController.selectedOptions'".
My controller name : DynamicCustomizableListHandler
visualforce page1 : DynamicCustomizableList
visualforce page 2 : CustomizeDynamicList
public class DynamicCustomizableListHandler {

    private ApexPages.StandardSetController controller;
    private PageReference savePage;
    
    private Set<String> unSelectedNames = new Set<String>();
    private Set<String> selectedNames = new Set<String>();
    private Set<String> inaccessibleNames = new Set<String>();
    
    public 	DynamicCustomizableListHandler(ApexPages.StandardSetController controller){
        this.controller = controller;
        loadFieldsWithVisibility();
    }
    
    private void loadFieldsWithVisibility(){
        Map<String, Schema.SObjectField> fields = Schema.SObjectType.Account.fields.getMap();
        for(String s : fields.keySet()){
            if(s != 'Name'){
                unSelectedNames.add(s);
            }
            if(!fields.get(s).getDescribe().isAccessible()){
                inaccessibleNames.add(s);
            }
        }
    }
    
    public List<String> getDisplayFields(){
        List<String> displayFields = new List<String>(selectedNames);
        displayFields.sort();
        return displayFields;
    }
    
    public PageReference customize(){
        savePage = ApexPages.currentPage();
        return Page.CustomizeDynamicList;
    }
    
    public PageReference show(){
        controller.reset();
        controller.addFields(getDisplayFields());
        return savePage;
    }
    
    public List<SelectOption> getSelectedOption(){
        return selectOptionsFromSet(selectedNames);
    }
    
    public List<SelectOption> getUnSelectedOptions(){
        return selectOptionsFromSet(unSelectedNames);
    }
    
    private List<SelectOption> selectOptionsFromSet(Set<String> opts){
        List<String> optionsList = new List<String>(opts);
        optionsList.sort();
        List<SelectOption> options = new List<SelectOption>();
        for(String s : optionsList){
            options.add(new SelectOption(s, decorateName(s), inaccessibleNames.contains(s)));
        }
        return options;
    }
    
    private String decorateName(String s){
        return inaccessibleNames.contains(s) ? '*' + s : s;
    }
    
    public transient List<String> selected {get; set;}
    public transient List<String> unselected {get; set;}
    
    public void doAdd(){
        moveFields(selected, selectedNames, unSelectedNames);
    }
    
    public void doRemove(){
        moveFields(unselected, unSelectedNames, selectedNames);
    }
    
    private void moveFields(List<String> items, Set<String> moveTo, Set<String> removeFrom){
        for(String s : items){
            if(! inaccessibleNames.contains(s)) {
                moveTo.add(s);
                removeFrom.remove(s);
            }
        }
    }
}
 
<apex:page standardController="Account" recordSetVar="accountList" extensions="DynamicCustomizableListHandler" >
    <br/>
    <apex:form>
    	<apex:pageBlock>
            <apex:outputLabel value="Select Accounts View: " for="viewsList" />
            <apex:selectList id="viewsList" size="1" value="{!filterId}">
                <apex:actionSupport event="onchange" reRender="theTable" />
                <apex:selectOptions value="{!listViewOptions}" />
            </apex:selectList>
        </apex:pageBlock>
        <apex:pageBlock title="Accounts" mode="edit">
            <apex:pageMessages />
            <apex:panelGroup id="theTable">
                <apex:pageBlockTable value="{!accountList}" var="acct">
                    <apex:column value="{!acct.Name}" />
                    <apex:repeat value="{!displayFields}" var="f">
                        <apex:column value="{!acct[f]}" />
                    </apex:repeat>
                </apex:pageBlockTable>
            </apex:panelGroup>
        </apex:pageBlock>
        <br/>
        <apex:commandButton value="Customize List" action="{!customize}" />
    </apex:form>
</apex:page>
 
<apex:page standardController="Account" recordSetVar="ignored" extensions="DynamicCustomizableListHandler">
    <br/>
    <apex:form>
    	<apex:pageBlock title="Select Fields to Display" id="selectionBlock">
            <apex:pageMessages />
            <apex:panelGrid columns="3">
            	<apex:selectList id="unselected_list" required="false" value="{!selected}" multiselect="true" size="20" style="width:250px" >
                    <apex:selectOptions value="{!unSelectedOptions}" />
                </apex:selectList>
                <apex:panelGroup>
                	<apex:commandButton value=">>" action="{!doAdd}" reRender="selectionBlock" />
                    <br/>
                    <apex:commandButton value="<<" action="{!doRemove}" reRender="selectionBlock" />
                </apex:panelGroup>
                <apex:selectList id="selected_list" required="false" value="{!unselected}" multiselect="true" size="20" style="width:250px">
                    <apex:selectOptions value="{!selectedOptions}" />
                </apex:selectList>
            </apex:panelGrid>
            <em> Note: Fields marked <strong>*</strong> are inaccessible to your account</em>
        </apex:pageBlock>
        <br/>
        <apex:commandButton value="Show These Fields" action="{!show}" />
    </apex:form>
</apex:page>

Sales Price: field integrity exception: UnitPrice (only one of unit price or total price may be specified)
Insert failed. First exception on row 0; first error: FIELD_INTEGRITY_EXCEPTION, field integrity exception: UnitPrice (only one of unit price or total price may be specified): [UnitPrice]