• 33
  • NEWBIE
  • 0 Points
  • Member since 2011

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 10
    Questions
  • 6
    Replies

Hi, I would like to check the function of the attribute onTabEnter in <apex:tab> tag with you. As currently we are using tabbed visualforce page to display contents. I would like to load/refresh content within the selected tab only, thus I choose to use "OnTabEnter" to invoke javascript to set flags for my current tab. However, I noticed for the first time I clicked on the tab, all of my tab contents are loaded. I wonder if it is because "OnTabEnter" is a general action which applies to all when I click on only one tab.

 

Below is my code:

public class threesixtyviewController{
  private contact cnt;
  public boolean membershipTabRenderFlag = false;
  public boolean cardsTabRenderFlag = false;
  public boolean paymentTabRenderFlag = false;
  public boolean signUpGiftTabRenderFlag = false;
  //public String tabInFocus = System.currentPageReference().getParameters().get('tab');

  public threesixtyviewController(ApexPages.StandardController stdController){}
 
    public Boolean getmembershipTabRenderFlag(){
        return membershipTabRenderFlag;
    }    
    public void setmembershipTabRenderFlag(){
           membershipTabRenderFlag = true;
           }

    public Boolean getcardsTabRenderFlag(){
        return cardsTabRenderFlag;
    }    
    
    public void setcardsTabRenderFlag(){
        cardsTabRenderFlag = True;
    }
    public Boolean getpaymentTabRenderFlag(){
        return paymentTabRenderFlag;
    }    
    
    public void setpaymentTabRenderFlag(){
        paymentTabRenderFlag = True;
    }
    public Boolean getsignUpGiftTabRenderFlag(){
        return signUpGiftTabRenderFlag;
    }    
    
    public void setsignUpGiftTabRenderFlag(){
        signUpGiftTabRenderFlag = True;
    }
}
<apex:page standardController="Contact" extensions="threesixtyviewController">
<br/>
  <!-- Begin Default Content REMOVE THIS --> 
  <apex:include pageName="threeSixtyStyle" />
  <apex:tabPanel tabClass="activeTab" inactiveTabClass="inactiveTab" switchtype="client">
      <!-- Begin Default Content REMOVE THIS -->
      <apex:tab label="Biodata" name="Biodata" style="background:white;">
      <apex:include pageName="BioData_v2" />
      </apex:tab>
      <!-- Membership Tab -->
      <apex:tab label="Membership" name="Membership" style="background:white;" onTabEnter="loadMembershipTab()">
      <apex:outputpanel id="membershipTab">
      <apex:include pageName="MembershipTab" rendered="{!membershipTabRenderFlag}"/>
      </apex:outputpanel>
      <apex:form >
                <apex:actionFunction name="loadMembershipTab" action="{!setmembershipTabRenderFlag}" immediate="true" status="LoadingStatus1" rerender="membershipTab"/>
      </apex:form>  
      <apex:actionStatus startText="Loading..." id="LoadingStatus1"/>           
      </apex:tab>    
      <!-- Cards Tab -->
      <apex:tab label="Cards" name="Cards" style="background:white;" ontabenter="loadCardsTab()">
      <apex:outputpanel id="cardsTab">
      <apex:include pageName="CardsTab" rendered="{!cardsTabRenderFlag}"/>
      </apex:outputpanel>
      <apex:form >
                <apex:actionFunction name="loadCardsTab" action="{!setcardsTabRenderFlag}" immediate="true" status="LoadingStatus2" rerender="cardsTab"/>
      </apex:form>  
      <apex:actionStatus startText="Loading..." id="LoadingStatus2"/> 
      </apex:tab>
                    
      <apex:tab label="Payment" name="Payment" style="background:white;" ontabenter="loadPaymentTab()">
      <apex:outputpanel id="paymentTab">
      <apex:include pageName="PaymentTab" rendered="{!paymentTabRenderFlag}"/>
      </apex:outputpanel>
      <apex:form >
                <apex:actionFunction name="loadPaymentTab" action="{!setpaymentTabRenderFlag}" immediate="true" status="LoadingStatus3" rerender="paymentTab"/>
      </apex:form>
      <apex:actionStatus startText="Loading..." id="LoadingStatus3"/>
      </apex:tab>

      <apex:tab label="Signup Gift" name="Signup Gift" style="background:white;" ontabenter="loadSignUpGiftTab()">
      <apex:outputpanel id="signUpGiftTab">
      <apex:include pageName="SignUpGiftTab"  rendered="{!signUpGiftTabRenderFlag}" />
      </apex:outputpanel>
      <apex:form >
                <apex:actionFunction name="loadSignUpGiftTab" action="{!setsignUpGiftTabRenderFlag}" immediate="true" status="LoadingStatus4" rerender="signUpGiftTab"/>
      </apex:form>
      <apex:actionStatus startText="Loading..." id="LoadingStatus4"/>
      </apex:tab>
  </apex:tabPanel>

  <!-- End Default Content REMOVE THIS -->
</apex:page>

 

 

  • May 17, 2012
  • Like
  • 0

Hi Guys, I need urgent help!!

 

I use <apex:tabpanel ..> and <apex:tab>to add several sub tabs. for each tab, i use <apex:include> to include the page, and each embeded page has its own controller to perform apex callout. I noticed when I load/refresh the VF page, all tabs are loaded. This is a big performance issue which will cause the limit exception error(maximum 10 callouts per time).. Can anyone give some suggestion to avoid this? I tried the switchtype = 'server'/'client' it doesn't help.

  • May 15, 2012
  • Like
  • 0

Hi all, is there any difference in function and behavior between "Matching Criteria" and "Formula equal to True" when creating escalation rule? 

 

Besides, which rule criteria does salesforce use for "matching criteria" in escalation rule? As you know for workflow rule, salesforce allow user to choose among three:

 

  • When a record is created, or when a record is edited and did not previously meet the rule criteria
  • Only when a record is created
  • Every time a record is created or edited

How about escalation rule?

  • April 10, 2012
  • Like
  • 0

Hi All,

 

We defined one case escalation rule for our application to send out email alerts regarding the case open status and age. The escalation criteria includes two fields of information, i.e current case owner role and case age. Thus, we created a list of escalation entries and actions to realize sending email alerts to current case owner and his/her manager depending on case age.

 

Case Owner Role A

Case Age > 3 ---> Manager of A

Case Age > 7 ---> Head Manager of A

 

Case Owner Role B

Case Age > 3 ---> Manager of B

Case Age > 7 ---> Head Manager of B

 

Besides, we have our own Apex scheduler class to calculate case age in business hours to update the case age field twice every hour. I would like to know if i define my rule entry in the following way, will salesforce re-evaluate the rule everytime my scheduler update the case age since the first time it match the criteria?  As a result, i am afraid our users will receive email alert twice each hour after the first time the criteria match.

 

Rule Entry:

 

AND( OR(Case_Owner_Role__c = "Email Agent",
Case_Owner_Role__c = "Email Agent Queue",
Case_Owner_Role__c = "Escalation Agent",
Case_Owner_Role__c = "Escalation Queue"),
NOT(IsClosed),
NOT( IsCancelled__c ),
NOT( Is_Re_open__c ),
ISPICKVAL(Priority, "Low"),
VALUE( Case_Age_in_salesforce_Business_Hours__c )> 3,
VALUE( Case_Age_in_salesforce_Business_Hours__c) <= 7
)

  • April 10, 2012
  • Like
  • 0

Hi all,

 

As it is, "When you change case ownership, any associated open activities that are owned by the current case owner are transferred to the new owner." I want to prevent the open activities reassignment by an apex trigger. however, it seems to not work at all. Here is my code:

 

trigger StopEventOwnerChange on Event (before update) {
List<Event> updateEvent = new List<Event>();
for(Event e:trigger.new){
if(e.ownerId != e.CreatedById)
updateEvent.add(e);
}
for(Event e:updateEvent){
e.ownerId = e.CreatedById;
}
}

 

  • December 22, 2011
  • Like
  • 0

Hi Guys, i have a after insert trigger on the Case object to auto-update some fields.


Besides that, i have one validation rule to make sure a Date/Time field value not earlier than the record created Date/Time.

 

According to salesforce rule of "Triggers and Order of Execution", the user-defined validation rules run before the 'after  insert' trigger. However, they seems conflict with each other now for my trigger and validation rule.

 

My after insert trigger Code:

 

 

trigger triggerOnCase on Case(after insert){
//Declarations
set<id> caseIds = new set<id>();
set<id> userIds = new set<id>();
Long BHPerDay = 24;
BusinessHours stdBH = [select id from businesshours where isDefault = true];

 

if(trigger.isAfter&&trigger.isInsert){   

 
for(integer x=0; x<trigger.newMap.size();x++){
       caseIds.add(trigger.new[x].id);
       userIds.add(trigger.new[x].ownerId);       
    }
    
map<id, Case> caseMap = new map<id, Case>([select  id,
                                                   ownerId,//Case Owner Role
                                                   owner.type,
                                                   Case_Owner_Role__c,
                                                   Priority, //Expected Closed Date
                                                   CreatedDate,
                                                   Expected_Closed_Date__c

from case where id in: caseIds]);
map<id, User> userMap = new map<id, User>([select u.id, u.UserRole.Name from User u where u.Id in :userIds]);
for(id i:caseIds){

Case newCase = caseMap.get(i);


//store case owner role
newCase.Case_Owner_Role__c = userMap.get(newCase.ownerId).UserRole.Name;


//Assign Expected Closed Date


if(newCase.Priority == 'Low'){
newCase.Expected_Closed_Date__c = BusinessHours.add(stdBH.id, newCase.CreatedDate, 3*BHPerDay*3600*1000L);}
if(newCase.Priority == 'High'){
newCase.Expected_Closed_Date__c = BusinessHours.add(stdBH.id, newCase.CreatedDate, 7*BHPerDay*3600*1000L);}
if(newCase.Priority == 'Special'){
newCase.Expected_Closed_Date__c = BusinessHours.add(stdBH.id, newCase.CreatedDate, 7*BHPerDay*3600*1000L);}
    }
    update caseMap.values();

}

}

 

My validation rule is as follows:

 

OR(( Call_Back_Date_Time__c < CreatedDate )&&NOT(ISCHANGED( Call_Back_Date_Time__c )), (Call_Back_Date_Time__c < NOW())&&ISCHANGED(Call_Back_Date_Time__c))

 

when I inserted a new record, i key in a date/time earlier than current time, it should display the error message like "Please ensure that Call Back Date/Time is later than the current Date ."

 

Instead, I get the follow one:

Error: Invalid Data.
Review all error messages below to correct your data.
Apex trigger triggerOnCase caused an unexpected exception, contact your administrator: triggerOnCase: execution of AfterInsert caused by: System.DmlException: Update failed. First exception on row 0 with id 50090000002ure0AAA; first error: FIELD_CUSTOM_VALIDATION_EXCEPTION, Please ensure that Call Back Date/Time is later than the current Date & Time: [Call_Back_Date_Time__c]: Trigger.triggerOnCase: line 144, column 5

 

I don't know how to add try catch operation on the map. I tried the following to replace the " update caseMap.values();"


try{update caseMap.values();}
   catch(System.DmlException e){for (Integer i = 0; i < e.getNumDml(); i++) {
    eMessage = e.getDmlMessage(i);
   
    Case errorCase = [select id from Case where id =:e.getDmlId(i)];
   errorCase.addError(eMessage);

}}

 

while it threw me with another error message " System.FinalException: SObject row does not allow errors".

Anyone can help?

  • December 07, 2011
  • Like
  • 0

Hi guys, is there any way to set rules to disallow the queue members editting the case in queue? We want the queue member accept the case first, then allow them to do edit. I came up with idea to create a new record type for the case in queue and assign them a read-only page layout. However, currently we have other record types in use for some other purpose. Are there any other idears? Thanks in advance!:):)

  • December 01, 2011
  • Like
  • 0

Hi everyone, I would like to find a way to evaluate a picklist field against NULL value ("--None--"shown in edit page) in the workflow rule. In workflow rule, the only available function for the picklist field is "ISPICKVAL", while I wouldn't like to exclude all the non-Null values one by one.( It really has a lot of values in our field).  I tried the following ways:

 

ISPICKVAL( Category__c , "--None--")

ISPICKVAL( Category__c , "")

ISPICKVAL( Category__c , " ")

ISPICKVAL( Category__c , "(NULL)")

 

No one can really work.....Any one can help with it? thanks in advance~:smileyhappy:

  • November 24, 2011
  • Like
  • 0

Hi Guys, does anyone have idea to disallow the usage of Solutions in Case Object which have not been approved yet? Is it possible to realize it with some validation rules? Thanks very much!!

  • November 24, 2011
  • Like
  • 0

Hi Guys, i  have succeeded in hiding the "save&new" and "check spelling" buttons in the case edit page by adding a home page component(HTML). However, now we switch to use service cloud console. As there is no home tab available by default in cloud console, we created the Home Web tab by following the steps given in http://success.salesforce.com/ideaView?c=09a30000000D9xoAAC&id=08730000000Xp3uAAC.  As a result, our custom home page component would not function at all as there is no sidebars any more in the web tab of Home page. Does anyone have ideas on this issue or have any other ways to hide the standard buttons?  Thanks in advance~

  • November 24, 2011
  • Like
  • 0

Hi All,

 

We defined one case escalation rule for our application to send out email alerts regarding the case open status and age. The escalation criteria includes two fields of information, i.e current case owner role and case age. Thus, we created a list of escalation entries and actions to realize sending email alerts to current case owner and his/her manager depending on case age.

 

Case Owner Role A

Case Age > 3 ---> Manager of A

Case Age > 7 ---> Head Manager of A

 

Case Owner Role B

Case Age > 3 ---> Manager of B

Case Age > 7 ---> Head Manager of B

 

Besides, we have our own Apex scheduler class to calculate case age in business hours to update the case age field twice every hour. I would like to know if i define my rule entry in the following way, will salesforce re-evaluate the rule everytime my scheduler update the case age since the first time it match the criteria?  As a result, i am afraid our users will receive email alert twice each hour after the first time the criteria match.

 

Rule Entry:

 

AND( OR(Case_Owner_Role__c = "Email Agent",
Case_Owner_Role__c = "Email Agent Queue",
Case_Owner_Role__c = "Escalation Agent",
Case_Owner_Role__c = "Escalation Queue"),
NOT(IsClosed),
NOT( IsCancelled__c ),
NOT( Is_Re_open__c ),
ISPICKVAL(Priority, "Low"),
VALUE( Case_Age_in_salesforce_Business_Hours__c )> 3,
VALUE( Case_Age_in_salesforce_Business_Hours__c) <= 7
)

  • April 10, 2012
  • Like
  • 0

Hi everyone, I would like to find a way to evaluate a picklist field against NULL value ("--None--"shown in edit page) in the workflow rule. In workflow rule, the only available function for the picklist field is "ISPICKVAL", while I wouldn't like to exclude all the non-Null values one by one.( It really has a lot of values in our field).  I tried the following ways:

 

ISPICKVAL( Category__c , "--None--")

ISPICKVAL( Category__c , "")

ISPICKVAL( Category__c , " ")

ISPICKVAL( Category__c , "(NULL)")

 

No one can really work.....Any one can help with it? thanks in advance~:smileyhappy:

  • November 24, 2011
  • Like
  • 0

Hi Guys, does anyone have idea to disallow the usage of Solutions in Case Object which have not been approved yet? Is it possible to realize it with some validation rules? Thanks very much!!

  • November 24, 2011
  • Like
  • 0

Hi Guys, i  have succeeded in hiding the "save&new" and "check spelling" buttons in the case edit page by adding a home page component(HTML). However, now we switch to use service cloud console. As there is no home tab available by default in cloud console, we created the Home Web tab by following the steps given in http://success.salesforce.com/ideaView?c=09a30000000D9xoAAC&id=08730000000Xp3uAAC.  As a result, our custom home page component would not function at all as there is no sidebars any more in the web tab of Home page. Does anyone have ideas on this issue or have any other ways to hide the standard buttons?  Thanks in advance~

  • November 24, 2011
  • Like
  • 0

Hi All,

 

We have a tabbed Visualforce page in our Force.com application that is loading quite a bit of data from a custom controller. This has the potential to slow down the page load quite dramatically as all of the data is loaded via methods in the controller, and all the tabs on the page (about 9 of them) render on page load.

 

I'm looking for a way to improve the performance.  Thoughts so far:

 

  • Move some of the queries into Ajax and have them execute onclick for each tab (never done Ajax so not sure about this)
  • Have some method of not rendering the contents of each tab on page load, only when the tab is selected

Can anyone provide some guidance here?

 

Cheers,

Andrew