• SFDC Tech
  • NEWBIE
  • 30 Points
  • Member since 2014

  • Chatter
    Feed
  • 0
    Best Answers
  • 1
    Likes Received
  • 0
    Likes Given
  • 29
    Questions
  • 15
    Replies
Hi,

I am new to visual force. and i am looking for help with the following task.

I have the following code for a visual force page which has two picklists.

<apex:page standardController="Quote" extensions="SelectionExtension" showHeader="true" sidebar="true">
    <apex:form >
    <apex:pageMessages />
    <apex:pageBlock title="Select Billing Type and Price Group">
        <apex:pageBlockButtons >
            <apex:commandButton value="Save" rendered="{!quo!=null}" action="{!save}"/>
            <apex:commandButton value="Cancel" action="{!cancel}"/>
        </apex:pageBlockButtons>
        <apex:pageBlockSection >
            <apex:selectList value="{!billingCode}" label="Billing Type" size="1">
                <apex:selectOptions value="{!availableBillingTypes}"/> 
                <apex:actionsupport event="onchange" rerender="priceBookList" />
            </apex:selectList>
            <apex:selectList value="{!priceGroup}" label="Price Group" Id="priceBookList" size="1" disabled="{!availablePriceGroups.size=0}">
                <apex:selectOptions value="{!availablePriceGroups}"/> 
            </apex:selectList>
        </apex:pageBlockSection>        
    </apex:pageBlock>
    </apex:form>
</apex:page>


The picklist values Billing Type and Price Group(dependent picklist) is retrieved from the following class through dyanamic soql

public with sharing class PriceGroupSelectionExtension {
    public Quote quo{get;set;}
    Map<String, List<Billing_Client_Type_Price_Group__c>> billingTypeToPriceGroupsMap {
        get{
            if(billingTypeToPriceGroupsMap==null){
                List<Billing_Client_Type_Price_Group__c> billingTypes= [SELECT Billing_Client_Type_Code__c, Billing_Price_Group_Code__c, Billing_Price_Group_Code__r.Name from Billing_Client_Type_Price_Group__c
                                                                        where Billing_Client_Type_Code__c!=null and Billing_Price_Group_Code__r.Hide_In_ICE__c=false];
                billingTypeToPriceGroupsMap= GroupBy.strings('Billing_Client_Type_Code__c', billingTypes);
            }
            return billingTypeToPriceGroupsMap;
        }
        set;
    }

    public SelectionExtension(ApexPages.StandardController controller) {
        Id quoteId = (Id) ApexPages.currentPage().getParameters().get('Id');
        if( quoteId==null){
            ApexPages.addMessage(new ApexPages.Message(ApexPages.Severity.ERROR, 'You must access this page from a quote'));
        } else {
            this.quo=(Quote) controller.getRecord();
        }

        if(illegalURLs()){
            ApexPages.addMessage(new ApexPages.Message(ApexPages.Severity.ERROR, 'The website link provided leads to an unexpected page, please close this page'));
        }
        billingCode=availableBillingTypes.isEmpty()?null:availableBillingTypes[0].getValue();
    }

    private Boolean illegalURLs(){
        if((ApexPages.currentPage().getParameters().get('retURL')!= null && 
                !ApexPages.currentPage().getParameters().get('retURL').startsWith('/'))
            ||(ApexPages.currentPage().getParameters().get('cancelURL')!= null && 
                !ApexPages.currentPage().getParameters().get('cancelURL').startsWith('/'))
            ||(ApexPages.currentPage().getParameters().get('saveURL')!= null && 
                !ApexPages.currentPage().getParameters().get('saveURL').startsWith('/'))){
            return true;
        }
        return false;
    }

    public String billingCode{
        get;
        set{
            billingCode=value;
            refreshAvailablePriceGroups();
        }
    }

    public String priceGroup{
        get;
        set{
            priceGroup=value;
            if(billingTypeToPriceGroupsMap.containsKey(billingCode)){
            quo.Price_Group__c = value;
            quo.Solution__c = GroupBy.ids('Billing_Price_Group_Code__c', billingTypeToPriceGroupsMap.get(billingCode)).get(value)[0].Id;    
        }
        }
    }

    public List<SelectOption> availablePriceGroups{get;private set;}

    public List<SelectOption> availableBillingTypes{
        get{
            if(availableBillingTypes==null){
                availableBillingTypes= new List<SelectOption>();
                for(String billingTypeCode: billingTypeToPriceGroupsMap.keySet()){
                    availableBillingTypes.add(new SelectOption(billingTypeCode, billingTypeCode));          
                }
            }
            return availableBillingTypes;
        }
        private set;
    }

    private void refreshAvailablePriceGroups(){
        List<SelectOption> priceGroups= new List<SelectOption>();
        if(billingTypeToPriceGroupsMap.containsKey(billingCode)){
            for(Billing_Client_Type_Price_Group__c billingTypePriceGroup: billingTypeToPriceGroupsMap.get(billingCode)){
                if(billingTypePriceGroup.Billing_Price_Group_Code__c!=null && billingTypePriceGroup.Billing_Price_Group_Code__r.Name!=null){
                    priceGroups.add(new SelectOption(billingTypePriceGroup.Billing_Price_Group_Code__c, billingTypePriceGroup.Billing_Price_Group_Code__r.Name));
                }           
            }
        }
        availablePriceGroups=priceGroups;
    }
    
    public PageReference cancel(){
        if(ApexPages.currentPage().getParameters().get('cancelURL') !=null){
            return new PageReference(ApexPages.currentPage().getParameters().get('cancelURL'));
        } else{
            return new PageReference(ApexPages.currentPage().getParameters().get('retURL'));
        }
    }
    
    I would like to know how to set up a particular picklist value as default in both the picklists.
and also would like to know how to sort these values based on ranking.

Please advise!!
Hi,

Iam looking for Salesforce Consulting companies in India for help with the projects that we have.
Please advise!

Thanks.
Hi , 
i am looking to write a trigger for the following scenario.
I am trying to update a field Lineitem_Status__c in the parent record(Contact object). based on the value of a field (Status__C) in the child record(which is a custom object).If the parent record(Contact) has more than one child record then the last updated value should be updated to the parent field.
Any assistance with code or any other work around for this is much appreciated!!

Thanks!!
 
Hi 

We have an external application that is pulling data from our Salesforce.com Instance on a scheduled basis.
It was working fine and suddenly when pulling data from salesforce.com there is an error message that is coming up on the application side like

"Object reference not set to an instance of an object"

Can anyone advise on this please!!
Is there a formula in to find if an Inactive user owns any records ?or is there a way to find the number of records owned by inactive users?

Please advise!!


Thanks!
Hi,

We are trying to migrate custom object from one salesforce instance to another.
However this custom object has more than 500 fields and we just don't want to recreate.
When we tried to put this in a package and migrate this but since this custom object as an Autonumber field it threw an error when migrating this.
is there any other way to handle this?

Thanks!
What is ' All internal users'  that is available in default when sharing?
Is there a way to run a report to filter the records if onlythe field values(Account Site field) contains numbers and not to include the values that contains text.
Hi, 
I have inserted Account records using data loader. and i am trying to Child records (Contact records) for this Account records using upsert in data loader.
But when i insert the child records i am getting the following error message.
"Foreign key external ID: 00100000006bpCE not found for field Production_Account_ID__c in entity Account"

Any advise on this issue?

Thank you!
Hi, 
I have inserted Account records using data loader. and i am trying to Child records (Contact records) for this Account records using upsert in data loader.
But when i insert the child records i am getting the following error message.
"Foreign key external ID: 00100000006bpCE not found for field Production_Account_ID__c in entity Account"

Any advise on this issue?

Thank you!
Hi,

Is there a tool to clean up misspelled  Billing city?


Thanks!
Hi,

When i try to deploy something from Sandbox to production I get this following error message.
  
Code Coverage Failure
Your organization's code coverage is 0%. You need at least 75% coverage to complete this deployment. Also, the following triggers have 0% code coverage. Each trigger must have at least 1% code coverage.
   UpdateCaseDetails
 It also lists Component errors amd Apex Test failures.

What is the cause for this issue? 
 
In our Salesforce org , in opportunity page we have a Custom link that directs to an internal application which is basically a login page.
Since that internal application uses the same salesforce login credentials we don't want the users to enter the username and password again and we want them to be able to use the same salesforce credentials and login to the applciation from salesforce directly without entering username ,password.

Can this be acheived through a Federated authentication in single sign on? 

In our Salesforce org , in opportunity page we have a Custom link that directs to an internal application which is basically a login page.
Since that internal application uses the same salesforce login credentials we don't want the users to enter the username and password again and we want them to be able to use the same salesforce credentials and login to the applciation from salesforce directly without entering username ,password.

Can this be acheived through a Federated authentication in single sign on? 
Is there any appexchange that is equal to single sign on?
What are the impacts of enabling single sign on in an org?
What is single sign on in salesforce and how is it used? what are the benefits of single sign on?
Hi,

How to pull a report that shows list of all accounts that does not have any  Opportunities, Contacts , activities?

Thanks!
Hi,

We are consolidating(merging) 2 salesforce.com instances.
What are the key things to consider during this process?
Please advise!!

Thank you!!
Hi ,

I am setting up email to case for an outlook email alias.
I am trying to configure the outlook email system to forward messages to the email alias to the email services address provided by salesforce.
(Through Manage Rules & Alerts in outlook).
but then the case is not getting created. 

Please advise!!

Thank you!
Hi,

I am new to visual force. and i am looking for help with the following task.

I have the following code for a visual force page which has two picklists.

<apex:page standardController="Quote" extensions="SelectionExtension" showHeader="true" sidebar="true">
    <apex:form >
    <apex:pageMessages />
    <apex:pageBlock title="Select Billing Type and Price Group">
        <apex:pageBlockButtons >
            <apex:commandButton value="Save" rendered="{!quo!=null}" action="{!save}"/>
            <apex:commandButton value="Cancel" action="{!cancel}"/>
        </apex:pageBlockButtons>
        <apex:pageBlockSection >
            <apex:selectList value="{!billingCode}" label="Billing Type" size="1">
                <apex:selectOptions value="{!availableBillingTypes}"/> 
                <apex:actionsupport event="onchange" rerender="priceBookList" />
            </apex:selectList>
            <apex:selectList value="{!priceGroup}" label="Price Group" Id="priceBookList" size="1" disabled="{!availablePriceGroups.size=0}">
                <apex:selectOptions value="{!availablePriceGroups}"/> 
            </apex:selectList>
        </apex:pageBlockSection>        
    </apex:pageBlock>
    </apex:form>
</apex:page>


The picklist values Billing Type and Price Group(dependent picklist) is retrieved from the following class through dyanamic soql

public with sharing class PriceGroupSelectionExtension {
    public Quote quo{get;set;}
    Map<String, List<Billing_Client_Type_Price_Group__c>> billingTypeToPriceGroupsMap {
        get{
            if(billingTypeToPriceGroupsMap==null){
                List<Billing_Client_Type_Price_Group__c> billingTypes= [SELECT Billing_Client_Type_Code__c, Billing_Price_Group_Code__c, Billing_Price_Group_Code__r.Name from Billing_Client_Type_Price_Group__c
                                                                        where Billing_Client_Type_Code__c!=null and Billing_Price_Group_Code__r.Hide_In_ICE__c=false];
                billingTypeToPriceGroupsMap= GroupBy.strings('Billing_Client_Type_Code__c', billingTypes);
            }
            return billingTypeToPriceGroupsMap;
        }
        set;
    }

    public SelectionExtension(ApexPages.StandardController controller) {
        Id quoteId = (Id) ApexPages.currentPage().getParameters().get('Id');
        if( quoteId==null){
            ApexPages.addMessage(new ApexPages.Message(ApexPages.Severity.ERROR, 'You must access this page from a quote'));
        } else {
            this.quo=(Quote) controller.getRecord();
        }

        if(illegalURLs()){
            ApexPages.addMessage(new ApexPages.Message(ApexPages.Severity.ERROR, 'The website link provided leads to an unexpected page, please close this page'));
        }
        billingCode=availableBillingTypes.isEmpty()?null:availableBillingTypes[0].getValue();
    }

    private Boolean illegalURLs(){
        if((ApexPages.currentPage().getParameters().get('retURL')!= null && 
                !ApexPages.currentPage().getParameters().get('retURL').startsWith('/'))
            ||(ApexPages.currentPage().getParameters().get('cancelURL')!= null && 
                !ApexPages.currentPage().getParameters().get('cancelURL').startsWith('/'))
            ||(ApexPages.currentPage().getParameters().get('saveURL')!= null && 
                !ApexPages.currentPage().getParameters().get('saveURL').startsWith('/'))){
            return true;
        }
        return false;
    }

    public String billingCode{
        get;
        set{
            billingCode=value;
            refreshAvailablePriceGroups();
        }
    }

    public String priceGroup{
        get;
        set{
            priceGroup=value;
            if(billingTypeToPriceGroupsMap.containsKey(billingCode)){
            quo.Price_Group__c = value;
            quo.Solution__c = GroupBy.ids('Billing_Price_Group_Code__c', billingTypeToPriceGroupsMap.get(billingCode)).get(value)[0].Id;    
        }
        }
    }

    public List<SelectOption> availablePriceGroups{get;private set;}

    public List<SelectOption> availableBillingTypes{
        get{
            if(availableBillingTypes==null){
                availableBillingTypes= new List<SelectOption>();
                for(String billingTypeCode: billingTypeToPriceGroupsMap.keySet()){
                    availableBillingTypes.add(new SelectOption(billingTypeCode, billingTypeCode));          
                }
            }
            return availableBillingTypes;
        }
        private set;
    }

    private void refreshAvailablePriceGroups(){
        List<SelectOption> priceGroups= new List<SelectOption>();
        if(billingTypeToPriceGroupsMap.containsKey(billingCode)){
            for(Billing_Client_Type_Price_Group__c billingTypePriceGroup: billingTypeToPriceGroupsMap.get(billingCode)){
                if(billingTypePriceGroup.Billing_Price_Group_Code__c!=null && billingTypePriceGroup.Billing_Price_Group_Code__r.Name!=null){
                    priceGroups.add(new SelectOption(billingTypePriceGroup.Billing_Price_Group_Code__c, billingTypePriceGroup.Billing_Price_Group_Code__r.Name));
                }           
            }
        }
        availablePriceGroups=priceGroups;
    }
    
    public PageReference cancel(){
        if(ApexPages.currentPage().getParameters().get('cancelURL') !=null){
            return new PageReference(ApexPages.currentPage().getParameters().get('cancelURL'));
        } else{
            return new PageReference(ApexPages.currentPage().getParameters().get('retURL'));
        }
    }
    
    I would like to know how to set up a particular picklist value as default in both the picklists.
and also would like to know how to sort these values based on ranking.

Please advise!!
Hi , 
i am looking to write a trigger for the following scenario.
I am trying to update a field Lineitem_Status__c in the parent record(Contact object). based on the value of a field (Status__C) in the child record(which is a custom object).If the parent record(Contact) has more than one child record then the last updated value should be updated to the parent field.
Any assistance with code or any other work around for this is much appreciated!!

Thanks!!
 
Is there a way to run a report to filter the records if onlythe field values(Account Site field) contains numbers and not to include the values that contains text.
Hi, 
I have inserted Account records using data loader. and i am trying to Child records (Contact records) for this Account records using upsert in data loader.
But when i insert the child records i am getting the following error message.
"Foreign key external ID: 00100000006bpCE not found for field Production_Account_ID__c in entity Account"

Any advise on this issue?

Thank you!
What are the impacts of enabling single sign on in an org?
What is single sign on in salesforce and how is it used? what are the benefits of single sign on?
Hi,

We are consolidating(merging) 2 salesforce.com instances.
What are the key things to consider during this process?
Please advise!!

Thank you!!
Looks like salesforce is introducing Map feature with its spring'15 release. 
Is salesforce partnering with any third party company for this feature?

Please advise!!
Hi,

I am actually trying to deploy few custom fields from sandbox to production using an existing deployment connection.
But when i deploy i am getting the following error message.

" " Your organization's code coverage is 0%. You need at least 75% coverage to complete this deployment. Also, the following triggers have 0% code coverage.       Each trigger must have atleast 1% code coverage"
      Update Account Details"    "


What causes this issue?
Should we rewrite/update the test class for the existing triggers?
Hi ,

I am setting up email to case for an outlook email alias.
I am trying to configure the outlook email system to forward messages to the email alias to the email services address provided by salesforce.
(Through Manage Rules & Alerts in outlook).
but then the case is not getting created. 

Please advise!!

Thank you!