• lrw7572
  • NEWBIE
  • 85 Points
  • Member since 2012

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

I'm trying to create a set of picklists. The first list displays a list of record names (duplicate names are not listed), and the second picklist is supposed to display all the records related to the record selected in the first list (duplicate names are not listed). However, I cannot get the second picklist to populate correctly. I've looked into the examples provided by Salesforce, and I cannot see what I'm doing wrong. Any help would be greatly appreciated, thanks!

 

VisualForce Page:

<apex:page controller="FieldUpdaterController">
<apex:form >
    <apex:pageBlock title="Field Update Module">
        <apex:pageBlockSection columns="1">
        {!selectedDDP}
            <apex:pageBlockSectionItem >
                <apex:outputLabel value="Invoice Statement"/>
                <apex:selectList value="{!selectedInvoice}" size="1">
                    <apex:selectOptions value="{!availableInvoices}" />
                    <apex:actionSupport event="onchange" rerender="itemPicklist" />
                </apex:selectList>              
            </apex:pageBlockSectionItem>
            <apex:pageBlockSectionItem >
                <apex:outputLabel value="Line Item" />
                    <apex:selectList id="itemPicklist" value="{!selectedItem}" size="1">
                        <apex:selectOptions value="{!availableItems}" />
                    </apex:selectList>
            </apex:pageBlockSectionItem>
        </apex:pageBlockSection>
    </apex:pageBlock>
</apex:form>
</apex:page>

 

 

 

APEX:

public class FieldUpdaterController {

    public String selectedItem {get; set;}
    
    public string selectedInvoice {get; set;}
    
    public List<selectOption> getAvailableInvoices() {
    
        List<selectOption> optionalInvoices = new List<selectOption>();
        
        List<Invoice_Statement__c> allInvoices = [SELECT Name, Id FROM Invoice_Statement__c ORDER BY Name];
            
        string prevInvoice;
        
        for (Invoice_Statement__c i : allInvoices) {
            if(i.Name != prevInvoice) {
                optionalInvoices.add(new selectOption('',i.Name));
            }
            prevInvoice = i.Name;
        }
        
        if (optionalInvoices.size() == 0) {
        optionalInvoices.add(new selectOption('', 'No Invoices Available'));
        return optionalInvoices;
        }
        else{
        return optionalInvoices;
        }
        
    }
    
    public List<selectOption> getAvailableItems() {
        
        List<selectOption> availableItems = new list<selectOption>();
        
        string prevItem;              
 
        for(Line_Item__c li : [SELECT Name, Id FROM Line_Item__c WHERE Invoice_Statement__r.Name = :selectedInvoice]) {
            if(li.Name != prevItem) {
                availableFields.add(new selectOption('', li.Name));
            }
            prevItem = li.Name;
        }
               
        return availableItems;
    }
    
}

 

MuliSelect Picklist Image

 

Hi SFDC Gems,

I am using two multiselect Picklists(leftSiteAppItems and rightSiteAppItems) and moving data from 'selectSiteApplication' and 'unselectSiteApplication' but data is not moving properly

from left selectList to right selectList.Please suggest If i am missing some logic in selectSiteApplication() and unselectSiteApplication()

functions.Please find screenshot of Multiselect Picklists in Link at the Top.

 

=======VF Page==========

<apex:outputLabel >Select Service/Model:</apex:outputLabel>

    <apex:selectList value="{!selectedServiceModel2}" label="Select Service/Model:" size="1" onchange="getSiteApplications()">

        <apex:selectOptions value="{!addServiceModel}"></apex:selectOptions>

        <apex:actionFunction action="{!getSiteApplications}" name="getSiteApplications" reRender="leftSelectedSiteApp,rightSelectedSiteApp"/>

    </apex:selectList> <br/><br/><br/>

    <apex:outputLabel value="Available:"  />

        <apex:outputLabel value="Selected:" /><br/>

        <div>Site Application</div>

        <div>Site Application</div>

        <apex:panelGrid columns="6" id="siteApp">

            <apex:selectList id="leftSelectedSiteApp" value="{!leftSelectedSiteApp}" multiselect="true"   size="6">

                <apex:selectOptions value="{!leftSiteAppItems}"></apex:selectOptions>

            </apex:selectList>

            <apex:panelGroup >

                <apex:commandButton value="     >      " action="{!selectSiteApplication}" >

                    <apex:actionSupport event="onClick" reRender="leftSelectedSiteApp,rightSelectedSiteApp"/>

                </apex:commandButton><br/><br/>

                <apex:commandButton value="     <      " action="{!unselectSiteApplication}" >

                    <apex:actionSupport reRender="leftSelectedSiteApp,rightSelectedSiteApp" event="onClick"/>

                </apex:commandButton>

            </apex:panelGroup>

            <apex:selectList id="rightSelectedSiteApp" value="{!rightSelectedSiteApp}" multiselect="true" size="6">

                <apex:selectOptions value="{!rightSiteAppItems}"></apex:selectOptions>

            </apex:selectList>

    </apex:panelGrid><br/>

======Contoller===============

Public with sharing class test{    

                public Set<SelectOption> lftSiteAppId{get;set;}

                public Set<SelectOption> rghtSiteAppId{get;set;}

                public List<String> leftSelectedSiteApp{get;set;}

                public List<String> rightSelectedSiteApp{get;set;}

                public List<SelectOption> leftSiteAppItems{get;set;}

                public List<SelectOption> rightSiteAppItems{get;set;}

               

                test(){

               

                }

               

                public void getSiteApplications(){

                                lftSiteAppId = new Set<SelectOption>();

                                leftSiteAppItems = new List<SelectOption>();

                               

                                rghtSiteAppId = new Set<SelectOption>();

                                rightSiteAppItems = new List<SelectOption>();

                               

                                lftSiteAppId.add(new SelectOption('Banchiao Taiwan/ BaaN IV','Banchiao Taiwan/ BaaN IV'));

                               

                               

                                leftSiteAppItems.add(new SelectOption('Banchiao Taiwan/ BaaN IV','Banchiao Taiwan/ BaaN IV'));

                               

                               

                                rghtSiteAppId.add(new SelectOption('Lodz-Poland (FGS)/ BaaN IV','Lodz-Poland (FGS)/ BaaN IV'));

        rghtSiteAppId.add(new SelectOption('Manchester-UK (FGS)/ BaaN IV','Manchester-UK (FGS)/ BaaN IV'));

                                rghtSiteAppId.add(new SelectOption('Venray-Netherlands FGS/ BaaN IV','Venray-Netherlands FGS/ BaaN IV'));

                               

        rightSiteAppItems.add(new SelectOption('Lodz-Poland (FGS)/ BaaN IV','Lodz-Poland (FGS)/ BaaN IV'));

                                rightSiteAppItems.add(new SelectOption('Manchester-UK (FGS)/ BaaN IV','Manchester-UK (FGS)/ BaaN IV'));

        rightSiteAppItems.add(new SelectOption('Venray-Netherlands FGS/ BaaN IV','Venray-Netherlands FGS/ BaaN IV'));

                               

    }

                public void selectSiteApplication(){

                                Integer i=0;

                                for(SelectOption option : lftSiteAppId){

           

            if(option.getValue()==leftSelectedSiteApp.get(i)){

                                                                leftSiteAppItems.remove(i);

                                                                rightSiteAppItems.add(new SelectOption(option.getValue(),option.getValue()));

                                                                i++;

            }

        }

    }

    public void unselectSiteApplication(){

                                Integer i=0;

                                for(SelectOption option : rghtSiteAppId){

           

            if(option.getValue()==rightSelectedSiteApp.get(i)){

                rightSiteAppItems.remove(i);

                leftSiteAppItems.add(new SelectOption(option.getValue(),option.getValue()));

                                                                i++;

            }

                                               

        }

       

    }

}

 

Hi,

 

I can generate some PDF files from different records one by one but I want to generate them all from one button for example.
I was planning to create a Visual force page and add several include page like this:

 

<apex:include pageName="apex_PDF_generator?id=xxxxxxxxxxx1" rendered="true"  />

<apex:include pageName="apex_PDF_generator?id=xxxxxxxxxxx2" rendered="true"  />

<apex:include pageName="apex_PDF_generator?id=xxxxxxxxxxx3" rendered="true"  />

<apex:include pageName="apex_PDF_generator?id=xxxxxxxxxxx4" rendered="true"  />

 

But it is not working. It is really not possible to pass parameters to an include Page like ? Is there some workarounds or something ?


Thanks

 

I am trying to add a simple action status to my page and call it from a button, but the stop text is always visable as soon as the page loads.Even when the id attribute is not specified, the stop text renders. I don't know what is calling it or how it is being called.

 

I've tried nesting it in an action region, nesting it and the button in the same action region, using the "for" attribute to reference the action region around the button, and removing action regions altogether. I tried nesting it in pageblocks, pageBlocksections, and i've removed it from any pageblock at all. I've tried using a facet instead of "stopText" attribute and still that text shows up. Has anybody experienced this? How do I fix it???

How do I go about getting all groups and it's members via a soql query?

 

SELECT Id, DeveloperName, GroupMember
FROM Group

 

I tried this and it gave me an error.

I am trying to add a simple action status to my page and call it from a button, but the stop text is always visable as soon as the page loads.Even when the id attribute is not specified, the stop text renders. I don't know what is calling it or how it is being called.

 

I've tried nesting it in an action region, nesting it and the button in the same action region, using the "for" attribute to reference the action region around the button, and removing action regions altogether. I tried nesting it in pageblocks, pageBlocksections, and i've removed it from any pageblock at all. I've tried using a facet instead of "stopText" attribute and still that text shows up. Has anybody experienced this? How do I fix it???

Hi there,

 

I'm trying to create a validation rule for quote line items where the constraints is that if a particular item is present the list, one of several others must also be present.  I've tried a bunch of things and am completely stymied by this so far.  Anyone have an idea for me?


Thanks,

Rob

I'm trying to create a set of picklists. The first list displays a list of record names (duplicate names are not listed), and the second picklist is supposed to display all the records related to the record selected in the first list (duplicate names are not listed). However, I cannot get the second picklist to populate correctly. I've looked into the examples provided by Salesforce, and I cannot see what I'm doing wrong. Any help would be greatly appreciated, thanks!

 

VisualForce Page:

<apex:page controller="FieldUpdaterController">
<apex:form >
    <apex:pageBlock title="Field Update Module">
        <apex:pageBlockSection columns="1">
        {!selectedDDP}
            <apex:pageBlockSectionItem >
                <apex:outputLabel value="Invoice Statement"/>
                <apex:selectList value="{!selectedInvoice}" size="1">
                    <apex:selectOptions value="{!availableInvoices}" />
                    <apex:actionSupport event="onchange" rerender="itemPicklist" />
                </apex:selectList>              
            </apex:pageBlockSectionItem>
            <apex:pageBlockSectionItem >
                <apex:outputLabel value="Line Item" />
                    <apex:selectList id="itemPicklist" value="{!selectedItem}" size="1">
                        <apex:selectOptions value="{!availableItems}" />
                    </apex:selectList>
            </apex:pageBlockSectionItem>
        </apex:pageBlockSection>
    </apex:pageBlock>
</apex:form>
</apex:page>

 

 

 

APEX:

public class FieldUpdaterController {

    public String selectedItem {get; set;}
    
    public string selectedInvoice {get; set;}
    
    public List<selectOption> getAvailableInvoices() {
    
        List<selectOption> optionalInvoices = new List<selectOption>();
        
        List<Invoice_Statement__c> allInvoices = [SELECT Name, Id FROM Invoice_Statement__c ORDER BY Name];
            
        string prevInvoice;
        
        for (Invoice_Statement__c i : allInvoices) {
            if(i.Name != prevInvoice) {
                optionalInvoices.add(new selectOption('',i.Name));
            }
            prevInvoice = i.Name;
        }
        
        if (optionalInvoices.size() == 0) {
        optionalInvoices.add(new selectOption('', 'No Invoices Available'));
        return optionalInvoices;
        }
        else{
        return optionalInvoices;
        }
        
    }
    
    public List<selectOption> getAvailableItems() {
        
        List<selectOption> availableItems = new list<selectOption>();
        
        string prevItem;              
 
        for(Line_Item__c li : [SELECT Name, Id FROM Line_Item__c WHERE Invoice_Statement__r.Name = :selectedInvoice]) {
            if(li.Name != prevItem) {
                availableFields.add(new selectOption('', li.Name));
            }
            prevItem = li.Name;
        }
               
        return availableItems;
    }
    
}

 

Hi, Im using the following code to override the Delete Button in a client's professional edition for accounts.  It works but I'm trying to add another user (extend this deleting privelege to the other System Admin).  Do you know how I can do this?? Thanks!

 

<apex:page action="{!if($User.Alias !='MPeck',
null,
urlFor($Action.Account.Delete, $CurrentPage.Parameters.id, [retURL='/001'], true)
)
}"
standardController="Account">
<apex:pageBlock >
<apex:PageMessage summary="You are not allowed to delete Accounts"
severity="Warning"
strength="3"/>
<apex:pageMessages />
</apex:pageBlock>
</apex:page>

  • February 13, 2013
  • Like
  • 0

MuliSelect Picklist Image

 

Hi SFDC Gems,

I am using two multiselect Picklists(leftSiteAppItems and rightSiteAppItems) and moving data from 'selectSiteApplication' and 'unselectSiteApplication' but data is not moving properly

from left selectList to right selectList.Please suggest If i am missing some logic in selectSiteApplication() and unselectSiteApplication()

functions.Please find screenshot of Multiselect Picklists in Link at the Top.

 

=======VF Page==========

<apex:outputLabel >Select Service/Model:</apex:outputLabel>

    <apex:selectList value="{!selectedServiceModel2}" label="Select Service/Model:" size="1" onchange="getSiteApplications()">

        <apex:selectOptions value="{!addServiceModel}"></apex:selectOptions>

        <apex:actionFunction action="{!getSiteApplications}" name="getSiteApplications" reRender="leftSelectedSiteApp,rightSelectedSiteApp"/>

    </apex:selectList> <br/><br/><br/>

    <apex:outputLabel value="Available:"  />

        <apex:outputLabel value="Selected:" /><br/>

        <div>Site Application</div>

        <div>Site Application</div>

        <apex:panelGrid columns="6" id="siteApp">

            <apex:selectList id="leftSelectedSiteApp" value="{!leftSelectedSiteApp}" multiselect="true"   size="6">

                <apex:selectOptions value="{!leftSiteAppItems}"></apex:selectOptions>

            </apex:selectList>

            <apex:panelGroup >

                <apex:commandButton value="     >      " action="{!selectSiteApplication}" >

                    <apex:actionSupport event="onClick" reRender="leftSelectedSiteApp,rightSelectedSiteApp"/>

                </apex:commandButton><br/><br/>

                <apex:commandButton value="     <      " action="{!unselectSiteApplication}" >

                    <apex:actionSupport reRender="leftSelectedSiteApp,rightSelectedSiteApp" event="onClick"/>

                </apex:commandButton>

            </apex:panelGroup>

            <apex:selectList id="rightSelectedSiteApp" value="{!rightSelectedSiteApp}" multiselect="true" size="6">

                <apex:selectOptions value="{!rightSiteAppItems}"></apex:selectOptions>

            </apex:selectList>

    </apex:panelGrid><br/>

======Contoller===============

Public with sharing class test{    

                public Set<SelectOption> lftSiteAppId{get;set;}

                public Set<SelectOption> rghtSiteAppId{get;set;}

                public List<String> leftSelectedSiteApp{get;set;}

                public List<String> rightSelectedSiteApp{get;set;}

                public List<SelectOption> leftSiteAppItems{get;set;}

                public List<SelectOption> rightSiteAppItems{get;set;}

               

                test(){

               

                }

               

                public void getSiteApplications(){

                                lftSiteAppId = new Set<SelectOption>();

                                leftSiteAppItems = new List<SelectOption>();

                               

                                rghtSiteAppId = new Set<SelectOption>();

                                rightSiteAppItems = new List<SelectOption>();

                               

                                lftSiteAppId.add(new SelectOption('Banchiao Taiwan/ BaaN IV','Banchiao Taiwan/ BaaN IV'));

                               

                               

                                leftSiteAppItems.add(new SelectOption('Banchiao Taiwan/ BaaN IV','Banchiao Taiwan/ BaaN IV'));

                               

                               

                                rghtSiteAppId.add(new SelectOption('Lodz-Poland (FGS)/ BaaN IV','Lodz-Poland (FGS)/ BaaN IV'));

        rghtSiteAppId.add(new SelectOption('Manchester-UK (FGS)/ BaaN IV','Manchester-UK (FGS)/ BaaN IV'));

                                rghtSiteAppId.add(new SelectOption('Venray-Netherlands FGS/ BaaN IV','Venray-Netherlands FGS/ BaaN IV'));

                               

        rightSiteAppItems.add(new SelectOption('Lodz-Poland (FGS)/ BaaN IV','Lodz-Poland (FGS)/ BaaN IV'));

                                rightSiteAppItems.add(new SelectOption('Manchester-UK (FGS)/ BaaN IV','Manchester-UK (FGS)/ BaaN IV'));

        rightSiteAppItems.add(new SelectOption('Venray-Netherlands FGS/ BaaN IV','Venray-Netherlands FGS/ BaaN IV'));

                               

    }

                public void selectSiteApplication(){

                                Integer i=0;

                                for(SelectOption option : lftSiteAppId){

           

            if(option.getValue()==leftSelectedSiteApp.get(i)){

                                                                leftSiteAppItems.remove(i);

                                                                rightSiteAppItems.add(new SelectOption(option.getValue(),option.getValue()));

                                                                i++;

            }

        }

    }

    public void unselectSiteApplication(){

                                Integer i=0;

                                for(SelectOption option : rghtSiteAppId){

           

            if(option.getValue()==rightSelectedSiteApp.get(i)){

                rightSiteAppItems.remove(i);

                leftSiteAppItems.add(new SelectOption(option.getValue(),option.getValue()));

                                                                i++;

            }

                                               

        }

       

    }

}

 

Hi,

 

I can generate some PDF files from different records one by one but I want to generate them all from one button for example.
I was planning to create a Visual force page and add several include page like this:

 

<apex:include pageName="apex_PDF_generator?id=xxxxxxxxxxx1" rendered="true"  />

<apex:include pageName="apex_PDF_generator?id=xxxxxxxxxxx2" rendered="true"  />

<apex:include pageName="apex_PDF_generator?id=xxxxxxxxxxx3" rendered="true"  />

<apex:include pageName="apex_PDF_generator?id=xxxxxxxxxxx4" rendered="true"  />

 

But it is not working. It is really not possible to pass parameters to an include Page like ? Is there some workarounds or something ?


Thanks