• Gaurav-Guleria
  • NEWBIE
  • 4 Points
  • Member since 2010

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 9
    Questions
  • 19
    Replies
I am getting System.VisualforceException: Getting content from within triggers is currently not supported.: Class.SendEmailToBillingContact.generateAndSendPDF: line 10, column 1

Trigger Code:
trigger TriggerSendEmailToBillingContact on invoiceit_s__Invoice__c (after insert,after update) {
    List<Messaging.SingleEmailMessage> emails = new List<Messaging.SingleEmailMessage>();                   
    Map<ID,invoiceit_s__Invoice__c> Map_InvoiceitRec = new Map<ID,invoiceit_s__Invoice__c>([SELECT id,invoiceit_s__Account__r.invoiceit_s__Invoice_Delivery_Type__c,invoiceit_s__Invoice_Status__c,
                                 invoiceit_s__Billing_Contact__r.Email FROM invoiceit_s__Invoice__c WHERE Id IN :Trigger.New]);
    if(Trigger.IsInsert||Trigger.IsUpdate){
        for(invoiceit_s__Invoice__c invoiceRec:Map_InvoiceitRec.Values()){
            if((invoiceRec.invoiceit_s__Account__r.invoiceit_s__Invoice_Delivery_Type__c =='Email'||invoiceRec.invoiceit_s__Account__r.invoiceit_s__Invoice_Delivery_Type__c =='Email & Print') && invoiceRec.invoiceit_s__Invoice_Status__c=='Posted'){
                SendEmailToBillingContact.generateAndSendPDF(invoiceRec.Id);
                catch(Exception e){
                    Trigger.New[0].AddError('Error : '+e);
                   
                }                 
            }
        }
    }
}
Class Code:
public with Sharing class SendEmailToBillingContact {

    public static void generateAndSendPDF(Id invoiceRecId){
        List<Messaging.SingleEmailMessage> emails = new List<Messaging.SingleEmailMessage>();  
        // Reference the attachment page and pass in the Invoiceit ID
        PageReference pdf =  Page.InvoiceSummaryPDF;
        pdf.getParameters().put('id',(String)invoiceRecId);
        pdf.setRedirect(true);
        // Take the PDF content
        system.debug('ContentPDF:'+pdf.getContent());
        Blob b = pdf.getContent();
       
        // Create the email attachment
        Messaging.EmailFileAttachment efa = new Messaging.EmailFileAttachment();
        efa.setContentType('application/pdf');
        efa.setFileName('attachment.pdf');                 
        efa.Body = b;   ----------->Error at this Line
                           
        // Sets the paramaters of the email
        String[] toAddress = new String[]{'invoiceRec.invoiceit_s__Billing_Contact__r.Email'};
        Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage();
        mail.setToAddresses(toAddress);
        mail.setSubject( ' Your Martindale-Nolo Invoice' );
        mail.setHtmlBody('PFA');
        mail.setTemplateId('00Xc0000000DnyH');
        mail.setFileAttachments(new Messaging.EmailFileAttachment[] { efa });  
        emails.add(mail);
    }
}
Thanks in advance.

Hi Guys,

 

Scenario:

1.Sites and Applications are parents of SiteApplications.

2.I want to fetch those Sites(Parent of SiteApplications) and Applications(Parent of SiteApplications) records which don't have SiteID(Lookup) and ApplicationID (Lookup) in SiteApplications(child).

 

Possible query in SQL:

Select ApplicationID, SiteID From Applications, Sites

 

Where ApplicationID, SiteID  NOT EXISTS

 

                                (Select ApplicationID, SiteID From SitesApplications)

 

How can I write this in SOQL.Please suggest.

PFA DB_SiteApp image for details.

 

Hi Guys,

 

---------------Code Snippet---------------------

String mystring= String.ValueOF('sa.Site_CX__r.name=:solutionSite1 OR sa.Site_CX__r.name=:solutionSite2 OR sa.Site_CX__r.name=:solutionSite3');

 

   

lstSiteApp = Database.query('select id,Site_Application_List__c,Application_Id__c,Site_CX__r.name from Site_Application__c sa where \n'+

    'sa.Application_Id__c IN(select sma.Application_ID__c from Service_Model_Application__c sma where Service_Model_ID__c=:selectedServiceModel2)\n'+

    'AND (mystring) AND sa.id NOT IN(select sd.Site_Application_ID__c from Solution_Detail__c sd where sd.Solution_ID__r.id=:recordid2)\n'+

    'ORDER BY Site_Application_List__c');

---------------------------------------------------------------------------

When i am using sa.Site_CX__r.name=:solutionSite1 OR sa.Site_CX__r.name=:solutionSite2 OR sa.Site_CX__r.name=:solutionSite3 directly in place of mystring,code is working fine(using this will not solve the purpose of Dynamic SOQL).

 

If I use mystring,Error:System.QueryException: unexpected token: ')' is coming.

 

Please help.

 

Hi guys,

 

I don't want to use nested for loops in the Trigger.Is there any workaound for this?

 

Here is the code:

 

Trigger updatesteApplcn1 on Implementation_Rate__c (After insert,After Update) {

                List<ID> ImplementationTeamIDs = new List<ID>();

                List<ID> RegionIDs = new List<ID>();

                List<ID> ImplementationRateIDs = new List<ID>();

                for(Implementation_Rate__c imr :trigger.new){

                                if(Trigger.IsInsert || (imr.Implementation_Team_ID__c!= trigger.oldMap.get(imr.id).Implementation_Team_ID__c ||

                                                                                                                                imr.Region_ID__c!=trigger.oldMap.get(imr.id).Region_ID__c)){

                                                ImplementationTeamIDs.add(imr.Implementation_Team_ID__c);

                                                RegionIDs.add(imr.Region_ID__c);

                                                ImplementationRateIDs.add(imr.id);

                                }             

                }

                if(ImplementationTeamIDs.size()>0||RegionIDs.size()>0){

                                Map<Id,Site_Application__c> Map_Site_Application= new Map<Id,Site_Application__c>([SELECT id,Application_Id__c FROM Site_Application__c WHERE Application_Id__r.Implementation_ID__c IN:ImplementationTeamIDs AND Site_CX__r.Region_ID__c IN:RegionIDs]);

                                Map<ID,Implementation_Rate__c> Map_ImplementationRate = new Map<Id,Implementation_Rate__c>([SELECT id,Rate__c,Travel_Expence_Rate__c, Hours_Per_Week__c from Implementation_Rate__c where ID IN:ImplementationRateIDs]);

                                for(Site_Application__c siteapp: Map_Site_Application.values()){

                                                for(Implementation_Rate__c imprate:Map_ImplementationRate.values()){

                                                                Site_Application__c s = Map_Site_Application.get(siteapp.id);

                                                                s.Rate__c = imprate.Rate__c;

                                                                s.Travel_Expence_Rate__c = imprate.Travel_Expence_Rate__c;

                                                                s.Hours_Per_Week__c  = imprate.Hours_Per_Week__c;

                                                }

                                }

                                update MapSite_Application.values();

                }

}

 

 

 

Thanks for your help in advance.

 

Regards,

Gaurav

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++;

            }

                                               

        }

       

    }

}

 

Is there any way to get  Application_Id__c(in red )???Please help me out.

Code:

 **********************************************

Public string serviceOffering{get;set;}

public Map<id,id> seviceModApp_Map {get;set;}

Quote__c q=[select id,Opportunity__r.Services_Offering__c,Solution_Site_1__c,Solution_Site_2__c,Solution_Site_3__c

                    from Quote__c where id=:id];

        serviceOffering=q.Opportunity__r.Services_Offering__c;        

        List<String> qte = new List<String>();

        qte.add(q.Solution_Site_1__c);

        qte.add(q.Solution_Site_2__c);

        qte.add(q.Solution_Site_3__c);       

        seviceModApp_Map = new Map<id,id>();

        for(Service_Model__c servMod:[select id,name,(select id,Application_ID__c from Service_Model_Applications__r where

            Application_ID__c IN(select Application_Id__c from Site_Application__c where Site_CX__r.Name__c IN:qte))

            from Service_Model__c where Service_ID__r.Name__c=:serviceOffering and Is_Default__c=:True]){

            for(Service_Model_Application__c sma:servMod.Service_Model_Applications__r){

 

                    seviceModApp_Map.put(servMod.id,sma.Application_ID__c);

                    

               

            }

        }

Scenario:

On click of button-'Add New B' in the TAB-'AChild' I want to move focus to tab-'BChild'.I have tried value attribute in tab panel but its not working.How can I achieve this?Please suggest.Thanks for your help in advance. 

 

Page:

<apex:page controller="EditBCls">

                <apex:form>

                                <apex:tabPanel switchType="client" tabClass="activeTab" inactiveTabClass="inactiveTab" >

                                                <apex:tab label="A" style="font-size:15;font-weight:bold" >

                                                                <apex:tabPanel switchType="client" tabClass="activeTab"     inactiveTabClass="inactiveTab" >

                                                                                <apex:tab label="AChild" >

                                                                                               <apex:pageBlock >                    

                                                                                                                <apex:pageblockButtons location="bottom" >                                                                                                                  

                                                                                                                                <apex:commandButton value="Add New B" action="{!addB}" />

                                                                                                                </apex:pageblockButtons>

                                                                                                </apex:pageBlock >

                                                                                </apex:tab>

                                                                </apex:tabPanel>

                                                </apex:tab>

                                                <apex:tab label="B">

                                                                <apex:tabPanel switchType="client" tabClass="activeTab" inactiveTabClass="inactiveTab">

                                                                                <apex:tab label="BChild">

                                                                                </apex:tab>

                                                                </apex:tabPanel>

                                                </apex:tab>

                                </apex:tabPanel>          

                </apex:form>

</apex:page>

Scenario:

I have two objects viz:'Application' and 'Application Efforts'.'Application' is parent and 'Application Efforts' is child.Both have the lookup relationship.I want  to show 'Application Efforts' records in a table on the basis of 'Application' selected in picklist.

 

I am using the following code and its not working.

 

VF Page:

=============================

<apex:page standardController="Quote__c" extensions="mycheck">
    <apex:form >
        <apex:pageBlock >
            <apex:pageBlockSection title="Application Efforts:">
                <apex:selectList value="{!selectedApplication3}" label="Select Application:" size="1" onchange="chngtxt()">
                    <apex:selectOptions value="{!ApplicationOptions2}">   
                    </apex:selectOptions>
                </apex:selectList>  
                <apex:actionFunction  name="chngtxt" action="{!change6}" reRender="intxt5" id="chngtxt"/>
                <apex:repeat value="{!lstAppEffort}" var="al" id="intxt5">
                {!al.Application_ID__r.Name__c}
                
                </apex:repeat>
            </apex:pageBlockSection>
        </apex:pageBlock>
    </apex:form>
</apex:page>

 

Controller:

=============================

public with sharing class mycheck {

    public string selectedApplication3 {get;set;}
    public List<SelectOption> ApplicationOptions2 { get;set;}
    public List<Application__c> LstApplication{get;set;}
    public List<Application_Efforts__c> lstAppEffort{get;set;}
    public mycheck(ApexPages.StandardController controller) {
        ApplicationOptions2 = new List<SelectOption>();
        LstApplication=[select Name__c from Application__c];
        ApplicationOptions2.add(new SelectOption('Please Select','Please Select'));
        for(Application__c appobj:LstApplication){
            ApplicationOptions2.add(new SelectOption(appobj.Name__c,appobj.Name__c));
        }
    }
    public void change6(){  
        lstAppEffort = [select id,Application_ID__r.Name__c,Effort_Level_ID__c,Effort_Duration_ID__c,Effort_Hours__c from Application_Efforts__c where
                            Application_ID__r.id = :selectedApplication3];
    }

}

 


A quick help in this regard is highly appretiated.

I am trying to write a test method for account custom sharing with Partner Portal user. But I am facing error while setting up u.IsActive = true; and u.IsPortalEnabled = true;  fields in test methods. Error as follows.

 

System.DmlException: Update failed. First exception on row 0 with id 005O0000000R2NTIA0; first error: MIXED_DML_OPERATION, DML operation on setup object is not permitted after you have updated a non-setup object (or vice versa): User, original object: Account: []

 

I understanding we can’t run DML on user and sharing object together(Set up and non setup objects). Wondered if there is any solution so that we can create partner portal user in a test method beside sele4cting this from the User object.    

 

 

@isTest

private class TestUpdateAccountShare_Trigger{

    public static testMethod void myTest()

    {

        Test.startTest();

    //Account created.

    Account acc = new Account(name='test');

    insert acc;

    //Contact created.   

    Contact cont = new Contact();

    cont.lastname = 'test';

    cont.phone = '555-555-5555';

    cont.Accountid =acc.id;

    insert cont;

    //Selects name and id partner user profile.

    Profile pp = [Select p.Name, p.Id From Profile p where Name LIKE '%Partner%'limit 1];

    //Partner user inserted.

    User u = new User(alias = 'port',

                email='portaluser@testorg.com',

                emailencodingkey='UTF-8',

                lastname='Testing',

                languagelocalekey='en_US',

                localesidkey='en_US',

                profileid = pp.Id,

                contactid = cont.Id,

                timezonesidkey='America/Los_Angeles',

                username='portaluser@testorg.com'

                );

    insert u;

 

    u.IsActive = true;

    u.IsPortalEnabled = true;

    update u;

        Test.stopTest();

 

    //Select partner portal user's id and account id from contacts.

    List<Contact> con = [Select id, Accountid from Contact where id =: u.ContactId];

    System.debug('User record' + con);

    //Account's record created.

    account accobj = new account(name='test');

    System.debug('User record' + accobj);

    insert accobj;

 

    }

}

I am getting System.VisualforceException: Getting content from within triggers is currently not supported.: Class.SendEmailToBillingContact.generateAndSendPDF: line 10, column 1

Trigger Code:
trigger TriggerSendEmailToBillingContact on invoiceit_s__Invoice__c (after insert,after update) {
    List<Messaging.SingleEmailMessage> emails = new List<Messaging.SingleEmailMessage>();                   
    Map<ID,invoiceit_s__Invoice__c> Map_InvoiceitRec = new Map<ID,invoiceit_s__Invoice__c>([SELECT id,invoiceit_s__Account__r.invoiceit_s__Invoice_Delivery_Type__c,invoiceit_s__Invoice_Status__c,
                                 invoiceit_s__Billing_Contact__r.Email FROM invoiceit_s__Invoice__c WHERE Id IN :Trigger.New]);
    if(Trigger.IsInsert||Trigger.IsUpdate){
        for(invoiceit_s__Invoice__c invoiceRec:Map_InvoiceitRec.Values()){
            if((invoiceRec.invoiceit_s__Account__r.invoiceit_s__Invoice_Delivery_Type__c =='Email'||invoiceRec.invoiceit_s__Account__r.invoiceit_s__Invoice_Delivery_Type__c =='Email & Print') && invoiceRec.invoiceit_s__Invoice_Status__c=='Posted'){
                SendEmailToBillingContact.generateAndSendPDF(invoiceRec.Id);
                catch(Exception e){
                    Trigger.New[0].AddError('Error : '+e);
                   
                }                 
            }
        }
    }
}
Class Code:
public with Sharing class SendEmailToBillingContact {

    public static void generateAndSendPDF(Id invoiceRecId){
        List<Messaging.SingleEmailMessage> emails = new List<Messaging.SingleEmailMessage>();  
        // Reference the attachment page and pass in the Invoiceit ID
        PageReference pdf =  Page.InvoiceSummaryPDF;
        pdf.getParameters().put('id',(String)invoiceRecId);
        pdf.setRedirect(true);
        // Take the PDF content
        system.debug('ContentPDF:'+pdf.getContent());
        Blob b = pdf.getContent();
       
        // Create the email attachment
        Messaging.EmailFileAttachment efa = new Messaging.EmailFileAttachment();
        efa.setContentType('application/pdf');
        efa.setFileName('attachment.pdf');                 
        efa.Body = b;   ----------->Error at this Line
                           
        // Sets the paramaters of the email
        String[] toAddress = new String[]{'invoiceRec.invoiceit_s__Billing_Contact__r.Email'};
        Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage();
        mail.setToAddresses(toAddress);
        mail.setSubject( ' Your Martindale-Nolo Invoice' );
        mail.setHtmlBody('PFA');
        mail.setTemplateId('00Xc0000000DnyH');
        mail.setFileAttachments(new Messaging.EmailFileAttachment[] { efa });  
        emails.add(mail);
    }
}
Thanks in advance.

Hi All

 

The following SOQL query shows the "List has more than 1 row for assignment Sobject".

 

PLS help me

 

list<contact> ct=[select lastname,firstname,account.name,account.industry from contact where Title='salesforce'];
system.debug(ct.lastname);
system.debug(ct.account.name);
system.debug(ct.account.industry);

 

 

thanks

santhos

Hi,

 

How i validate formula field using eclipse ?

 

 

 

 

 

 

regards,

Sagar Pawar.

Hi Guys,

 

Scenario:

1.Sites and Applications are parents of SiteApplications.

2.I want to fetch those Sites(Parent of SiteApplications) and Applications(Parent of SiteApplications) records which don't have SiteID(Lookup) and ApplicationID (Lookup) in SiteApplications(child).

 

Possible query in SQL:

Select ApplicationID, SiteID From Applications, Sites

 

Where ApplicationID, SiteID  NOT EXISTS

 

                                (Select ApplicationID, SiteID From SitesApplications)

 

How can I write this in SOQL.Please suggest.

PFA DB_SiteApp image for details.

 

Hi Guys,

 

---------------Code Snippet---------------------

String mystring= String.ValueOF('sa.Site_CX__r.name=:solutionSite1 OR sa.Site_CX__r.name=:solutionSite2 OR sa.Site_CX__r.name=:solutionSite3');

 

   

lstSiteApp = Database.query('select id,Site_Application_List__c,Application_Id__c,Site_CX__r.name from Site_Application__c sa where \n'+

    'sa.Application_Id__c IN(select sma.Application_ID__c from Service_Model_Application__c sma where Service_Model_ID__c=:selectedServiceModel2)\n'+

    'AND (mystring) AND sa.id NOT IN(select sd.Site_Application_ID__c from Solution_Detail__c sd where sd.Solution_ID__r.id=:recordid2)\n'+

    'ORDER BY Site_Application_List__c');

---------------------------------------------------------------------------

When i am using sa.Site_CX__r.name=:solutionSite1 OR sa.Site_CX__r.name=:solutionSite2 OR sa.Site_CX__r.name=:solutionSite3 directly in place of mystring,code is working fine(using this will not solve the purpose of Dynamic SOQL).

 

If I use mystring,Error:System.QueryException: unexpected token: ')' is coming.

 

Please help.

 

There are two custom formula field in Case object "Response Time" and "Job Time".When values are fetched form case in reports it displays error but both the fields have values for respective records. 

 

 

 

05641384 Mazeed Syed Free Installation West MAHARASHTRA - - 5/31/2013 5:23 PM #Error!5/14/2013 5:18 PM 5/31/2013 5:23 PM

 

Hi guys,

 

I don't want to use nested for loops in the Trigger.Is there any workaound for this?

 

Here is the code:

 

Trigger updatesteApplcn1 on Implementation_Rate__c (After insert,After Update) {

                List<ID> ImplementationTeamIDs = new List<ID>();

                List<ID> RegionIDs = new List<ID>();

                List<ID> ImplementationRateIDs = new List<ID>();

                for(Implementation_Rate__c imr :trigger.new){

                                if(Trigger.IsInsert || (imr.Implementation_Team_ID__c!= trigger.oldMap.get(imr.id).Implementation_Team_ID__c ||

                                                                                                                                imr.Region_ID__c!=trigger.oldMap.get(imr.id).Region_ID__c)){

                                                ImplementationTeamIDs.add(imr.Implementation_Team_ID__c);

                                                RegionIDs.add(imr.Region_ID__c);

                                                ImplementationRateIDs.add(imr.id);

                                }             

                }

                if(ImplementationTeamIDs.size()>0||RegionIDs.size()>0){

                                Map<Id,Site_Application__c> Map_Site_Application= new Map<Id,Site_Application__c>([SELECT id,Application_Id__c FROM Site_Application__c WHERE Application_Id__r.Implementation_ID__c IN:ImplementationTeamIDs AND Site_CX__r.Region_ID__c IN:RegionIDs]);

                                Map<ID,Implementation_Rate__c> Map_ImplementationRate = new Map<Id,Implementation_Rate__c>([SELECT id,Rate__c,Travel_Expence_Rate__c, Hours_Per_Week__c from Implementation_Rate__c where ID IN:ImplementationRateIDs]);

                                for(Site_Application__c siteapp: Map_Site_Application.values()){

                                                for(Implementation_Rate__c imprate:Map_ImplementationRate.values()){

                                                                Site_Application__c s = Map_Site_Application.get(siteapp.id);

                                                                s.Rate__c = imprate.Rate__c;

                                                                s.Travel_Expence_Rate__c = imprate.Travel_Expence_Rate__c;

                                                                s.Hours_Per_Week__c  = imprate.Hours_Per_Week__c;

                                                }

                                }

                                update MapSite_Application.values();

                }

}

 

 

 

Thanks for your help in advance.

 

Regards,

Gaurav

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++;

            }

                                               

        }

       

    }

}

 

Scenario:

On click of button-'Add New B' in the TAB-'AChild' I want to move focus to tab-'BChild'.I have tried value attribute in tab panel but its not working.How can I achieve this?Please suggest.Thanks for your help in advance. 

 

Page:

<apex:page controller="EditBCls">

                <apex:form>

                                <apex:tabPanel switchType="client" tabClass="activeTab" inactiveTabClass="inactiveTab" >

                                                <apex:tab label="A" style="font-size:15;font-weight:bold" >

                                                                <apex:tabPanel switchType="client" tabClass="activeTab"     inactiveTabClass="inactiveTab" >

                                                                                <apex:tab label="AChild" >

                                                                                               <apex:pageBlock >                    

                                                                                                                <apex:pageblockButtons location="bottom" >                                                                                                                  

                                                                                                                                <apex:commandButton value="Add New B" action="{!addB}" />

                                                                                                                </apex:pageblockButtons>

                                                                                                </apex:pageBlock >

                                                                                </apex:tab>

                                                                </apex:tabPanel>

                                                </apex:tab>

                                                <apex:tab label="B">

                                                                <apex:tabPanel switchType="client" tabClass="activeTab" inactiveTabClass="inactiveTab">

                                                                                <apex:tab label="BChild">

                                                                                </apex:tab>

                                                                </apex:tabPanel>

                                                </apex:tab>

                                </apex:tabPanel>          

                </apex:form>

</apex:page>

Is there any Read only property for an input text box in VF page.

I want to make the Text Box value readonly.

Ex:

 <apex:inputtext style="border:0px;background-color:#F3F3EC;" size="30" disabled="false" value="{!inputText}"/> 

 

can we make a textbox readonly in apex...if possible please help me..  

 

Thanks