• Sure@Dream
  • SMARTIE
  • 540 Points
  • Member since 2012

  • Chatter
    Feed
  • 17
    Best Answers
  • 5
    Likes Received
  • 130
    Likes Given
  • 32
    Questions
  • 117
    Replies
I am auto filling a date/time field with Now() but it's 2 hours behind. What is up with that? Do I need to change a timezone setting or something?
Hello,

I want to add a text inside like below

User-added image

caseObj.Descripion= Label.Descrption;

Description label is like
"Date:\nTime:\nname:"

When i try to add this label, it always adds the "Date:\nTime:\nname:"
the new line is never added.

How can i achieve it ?
Hi Everyone,
      I need to conditionally render the highlighted apex out put texts but this is not wotking. Can someone please help me with the code below:
Rendered attribute is dependent on value of Variable ResultSize. The variable is showing the correct value hence I am not putting any apex code . The flow of code is gven below:

1. User key in the input values in input text boxes.
2. There is an onkeyup written on the input boxes. Than on key up function calles for a javascript that in turn calls for the apex action function . This apex action function rerenders the attribute. All other id's are being rerendered fine by action function except id's of out put texts size,size1.

<apex:page controller="ProposalSearchControllerModified" sidebar="false" readonly="True">

  <apex:form >
  <apex:pageMessages id="errors"/>

  <apex:pageBlock title="Search Proposal Records" mode="edit" id="OuterPageBlock">

  <table width="100%" border="0">
  <tr>  
    <td width="200" valign="top">

      <apex:pageBlock title="Search Parameters" mode="edit" id="criteria">

      <script type="text/javascript">

      function doSearch() {
        searchServer(
          document.getElementById("Name").value,
          document.getElementById("OpportunityID").value,
          document.getElementById("SolicitationNo").value,
          document.getElementById("ProposalNo").value

          );

      }
     
   

      </script> 

      <apex:actionFunction name="searchServer" action="{!runSearch}" rerender="results,debug,errors,size,size1">
          <apex:param name="Name" value="" />
          <apex:param name="OpportunityID" value="" />
          <apex:param name="SolicitationNo" value="" />
          <apex:param name="ProposalNo" value="" />

      </apex:actionFunction>

      <table cellpadding="2" cellspacing="2">
      <tr>
        <td style="font-weight:bold;">Opportunity ID<br/>
        <input type="text" id="OpportunityID" onkeyup="doSearch();"/>
        </td>
      </tr>
      <tr>
        <td style="font-weight:bold;">Solicitation #<br/>
        <input type="text" id="SolicitationNo" onkeyup="doSearch();"/>
        </td>
      </tr>
      <tr>
        <td style="font-weight:bold;">Proposal #<br/>
        <input type="text" id="ProposalNo" onkeyup="doSearch();"/>
        </td>
      </tr>
      


      <tr>
        <td>
          <b><apex:outputText id="size"  style="font-style:Bold;" value="Total Records Returned  :  {!ResultSize}" rendered="{!ResultSize<1000}"/></b>
          <b><apex:outputText id="size1"  style="font-style:Bold;" value="Total Records Returned  :  {!ResultSize} ++" rendered="{!ResultSize==1000}"/></b>

     
         
        </td>  
      </tr>
      

       
   </table>
  </apex:pageBlock>
       

    </td>

    <td valign="top">
    <table style="width: 100%;">
    <td>
    
    <apex:pageBlock mode="edit" id="results">    

        <div style="overflow: auto; height: 300px;">
          
        <apex:pageBlockTable value="{!Opportunities}" var="opp">

            <apex:column >
                <apex:facet name="header">
                    <apex:commandLink value="Opportunity Name" action="{!toggleSort}" rerender="results,debug">
                        <apex:param name="sortField" value="Name" assignTo="{!sortField}"/>
                    </apex:commandLink>
                </apex:facet>
                <!--<apex:outputLink value="/apex/SiteDetailPage?id={!opp.id}" target="_blank" rendered="{!IF(URLL=$Label.SalesforceURL,false,true)}">{!opp.Name}</apex:outputLink>
                <apex:outputLink value="/{!opp.id}" target="_blank" rendered="{!IF(URLL=$Label.SalesforceURL,true,false)}">{!opp.Name}</apex:outputLink>-->
                <apex:commandlink value="{!opp.Name}" rerender="RecordDetailSection" action="{!ClearOrder}">                
                 <apex:param name="DetailRecordId"  value="{!opp.Id}" assignTo="{!DetailRecordId}"/>   
                </apex:commandlink>               

            </apex:column>
            


            
            <apex:column >
                <apex:facet name="header">
                    <apex:commandLink value="Opportunity ID" action="{!toggleSort}" rerender="results,debug">
                        <apex:param name="sortField" value="OpportunityID" assignTo="{!sortField}"/>
                    </apex:commandLink>
                </apex:facet>
                <apex:outputField value="{!opp.Opportunity_ID__c}"/>
            </apex:column>
            
            <apex:column >
                <apex:facet name="header">
                    <apex:commandLink value="Proposal #" action="{!toggleSort}" rerender="results,debug">
                        <apex:param name="sortField" value="ProposalNo" assignTo="{!sortField}"/>
                    </apex:commandLink>
                </apex:facet>
                <apex:outputField value="{!opp.Proposal__c}"/>
            </apex:column>          


        </apex:pageBlockTable>
       </div>
       
    </apex:pageBlock>
    
    </td>

    </tr>
    </table>
    
    
    </td>

  </tr>

  </table>

   

  </apex:pageBlock>

  </apex:form>
   

</apex:page>
Hi Everyone,
           Due to some SOQL sub query limitations I have to query list of opportunity records into 2 seperate lists. for our e.g lets call them List A and List B.

So List A gets its values from soql query

List<Opportunity> ListA=[select Id, Name from Opportunity where StageName='Claosed Won'];

List<Opportunity> ListB=[select Id,Name from Oppoortunity where Sub_Stage__c='Aawarded'];

Set<Opportunity> SetC=ListA+ListB.

Now I want to combine List A and List B , take out the duplaicate data out of the combination and make a set out of it  Set c= List A+ List B ( but it should not have any duplaicate records)

Can anyone please help me with the syntax to join 2 lists into a set?

Please note that due to some limits I cannot get all my data into 1 list . The where clause e/g used above are just for theory . It's bit more complicated than that.
This works fine
IF(CONTAINS("VS:BJ", Owner.Alias), "Legacy", 
IF(ISBLANK(BillingState), "International", 
IF(CONTAINS("WA:OR:CA:AZ:NV:IDMT:WY:UT:CO:NM:TX:OK:KS:NE:WY:NE:SD:ND:MN:IA:MO:AR:LA:WI:IL", BillingState), "USA - West", 
IF(CONTAINS("AB:BC:MB:NT:NU:SK:YT", BillingState), "CAN - West", 
IF(CONTAINS("DC:OH:MI:IN:KY:TN:MS:AL:GA:FL:SC:NC:VA:WV:PA:PA:NY:ME:ME:VT:NH:MA:RI:CT:NJ:DE:DE:MD", BillingState), "USA - East", 
IF(CONTAINS("NB:NL:NS:ON:PE:QC", BillingState), "CAN - East", 
"International"))))))
But i need to first evaluate a Checkboxf field.If its TRUE, then should be done, otherwise, continues.  So when I add (first line)
IF(Global_Key_Account__c="TRUE"), "Global",
IF(CONTAINS("VS:BJ", Owner.Alias), "Legacy", 
IF(ISBLANK(BillingState), "International", 
IF(CONTAINS("WA:OR:CA:AZ:NV:IDMT:WY:UT:CO:NM:TX:OK:KS:NE:WY:NE:SD:ND:MN:IA:MO:AR:LA:WI:IL", BillingState), "USA - West", 
IF(CONTAINS("AB:BC:MB:NT:NU:SK:YT", BillingState), "CAN - West", 
IF(CONTAINS("DC:OH:MI:IN:KY:TN:MS:AL:GA:FL:SC:NC:VA:WV:PA:PA:NY:ME:ME:VT:NH:MA:RI:CT:NJ:DE:DE:MD", BillingState), "USA - East", 
IF(CONTAINS("NB:NL:NS:ON:PE:QC", BillingState), "CAN - East", 
"International"))))))
I get Error: Syntax error. Extra ','
Reading up on different formatting but cant get it! thanks-
  • December 20, 2016
  • Like
  • 0
Can we use formulas in email templates such as TODAY()? I tried but it did not work.Any workarounds other than creating a formula fields and merging them?
I have a custom picklist field on a Person Account named "how did they hear about us" and then a dependent picklist named Sub Category.  Only some "How did they hear about us" selections require a "Sub Category".  An example would be Social Media.  If that is selected the Sub Category must be selected.  The Validation works on New Person Account records but when I test updating a record to a picklist item that should require a Sub Category the validation isn't enforced.  Here is my Validation Rule:

AND( ISPICKVAL ( PersonContact.How_did_they_hear_about_us__c , "Social Media"),ISPICKVAL ( PersonContact.Sub_Category__c , "" ))

Any suggestions?  Thank you in advance.
 
Hi Everyone ,
         I have an apex class whose constructor is calling a method . The call out is done after setting 1 parameter . The code is given below:

Constructor:

  public ProposalSearchControllerModified() {
     //String variable for soql
      soql = 'Select Id,Name from Opportunity where name != null';
     //executing SOQL AND PAASING VALUES TO THE LIST.
     Opportunities = Database.query(soql + ' order by ' + sortField + ' ' + sortDir+ ' Limit 50');
     //USING 1ST RECORD OF LIST TO EXECUTE ANOTHE METHOD - CLEAR Order
     DetailRecordId=Opportunities[0].Id;    
    ClearOrder();
  }


Test Class Code:

@istest
public class ProposalSearchControllerModifiedTest{
    public static testmethod void ProposalSearchMethod(){
         
         
         PageReference pageRef = Page.ProposalSearchModified;
         pageRef.getParameters().put('Name', 'Te');
         pageRef.getParameters().put('OpportunityID', '0');
         pageRef.getParameters().put('SolicitationNo', '0');
         pageRef.getParameters().put('ProposalNo', '0');
         
         Test.setCurrentPage(pageRef);
         ProposalSearchControllerModified cs=new ProposalSearchControllerModified();
         String sd=cs.sortDir;
         String sf=cs.sortField;
         String ds=cs.debugSoql;
         list<String> ls=cs.Stages;
         list<String> ls1=cs.SubStages;
         list<String> ls2=cs.FiscalYearValues;
         
         cs.toggleSort();
         cs.runQuery();
         cs.runSearch();
         cs.reset();
         
         
    
    }
}​



Error Message:

System.ListException: List index out of bounds: 0

Error is thrown when highlighted line in code above is covered through test class.
Hi,

I have a trigger on Account which just update one field in all the related contacts. If the account is of type "Member" then the trigger updates a field in contact called "Relationship_Category_r__c" to "Member-staff" and if the Account type changes to "Member-past" then the contact field updates to "Member-past"

The trigger below is working fine if the number of contacts in any account is in between 50 - 80. However, it stops working when it exceed more than that. I can't give the exact number but its not working with our account which has around 116 contacts.

I am copying the code below for reference and any advise would be highly appreciated


trigger Update_related_Contacts_On_Account_fieldchange on Account (after update) {
set<id> ids=new set<id>();
 
    for(Account acc:trigger.new){
        ids.add(acc.id);
    }
    map<id,List<contact>> acc_con_maps=new map<id,List<contact>>();
    List<Account> accts=new List<Account>([select id,(select id,Relationship_Category_r__c from contacts) from Account where id=:ids]);
    For(Account accts1:accts){
        acc_con_maps.put(accts1.id,accts1.contacts);
    }
 
    list<contact> constoupdate=new list<contact>();
    for(Account acc1:trigger.new){
        if(acc_con_maps.containsKey(acc1.Id)&&acc_con_maps.get(acc1.id)!=null){
            if(acc1.Type=='Member'){
            
                for(contact con:acc_con_maps.get(acc1.Id)){
                    if(con.Relationship_Category_r__c !='Member'){
                        con.Relationship_Category_r__c ='Member - Staff';
                    constoupdate.add(con);
                }
                }
            }
            else if(acc1.type=='Member - Past'){
            
               for(contact con1:acc_con_maps.get(acc1.Id)){
                   if(con1.Relationship_Category_r__c !='Member - Past'){
                    con1.Relationship_Category_r__c ='Member - Past';
                    constoupdate.add(con1);
                   }
                }
            }
         
        }
    }
    update constoupdate;
}
I built a VF page for the Case object and I pulled the Attachments with this line:
<apex:relatedList id="Attachments" list="Attachments" />

I replaced the Case object with a custom object called lda_Request__c. I tried to build a simlar VF page with the attachment related list using the same line as above. I got the following error:
“'Attachments' is not a valid child relationship name for entity New Request.”

So, I confirmed the relationship exists. I can query it using SOQL:
SELECT Id, ownerId, (Select Name From Attachments) FROM lda_Request__c limit 100

I can see the relationship in Eclipse:
Attachment Relationship

I can also get the attachment related list with this line:
<apex:relatedList id="Attachments" list="CombinedAttachments"/>
But this also shows the notes.

Why can I not get the attachment related list by just using "Attachments"?
Hi,
I have a master detail relation between Opportunity and object__c(custom object)
I have same stage fields as in opportunity in object__c. 
I want to update the stage value from opportunity to object__c only when the object__c record is created. After that the object__c record can have its own stage values different from Opportunity.

I have written the below trigger, but it updates the object__c record everytime there is some update on opportunity, where as i want it to fire only once when the object record is created.

trigger updateLineItemValues on Opportunity (before update){
    
    Set<ID> oppids = new Set<ID>();
   
    for(Opportunity opp : Trigger.new){
       
        if(opp.Line_Item__c > 0){
            oppids.add(opp.Id);
        }
    }
    List<Opportunity> updatedOpps = [SELECT Id, StageName, Status__c,Partner_Intermediary_PE_Firm_Involved__c, (Select Id, Stage__c,Partner_Intermediary_Involvement__c,Status__c from Opportunity_Service_Line_Items__r)  FROM Opportunity WHERE Id in :oppids];

    List<Opportunity_Service_Line_Item__c> relatedDealsToUpdate = new List<Opportunity_Service_Line_Item__c>();
   
    for (Opportunity opp : updatedOpps){
       
        for(Opportunity_Service_Line_Item__c rd : opp.Opportunity_Service_Line_Items__r){
            rd.Stage__c = opp.StageName;
            rd.Status__c = opp.Status__c;
            rd.Partner_Intermediary_Involvement__c = opp.Partner_Intermediary_PE_Firm_Involved__c;
            relatedDealsToUpdate.add(rd);
        }
    }
    update relatedDealsToUpdate;
}


Please let me know how can i get this trigger fire only once when the object__c record is inserted.

Thanks

Can someone help me figure out how to reduce this formula with CASE? I just don't know how to finish the rest....


IF( Bank_Lender__r.Name  =  "Mytestlender" &&  Total_Amount__c > 25000 && Total_Amount__c < 49999 &&  AND (ISPICKVAL( Months__c, "24-Months")) , 0.04524,
IF( Bank_Lender__r.Name  =  "Mytestlender" &&  Total_Amount__c > 25000 && Total_Amount__c < 49999  &&  AND (ISPICKVAL( Months__c, "36-Months")) , 0.03135,
IF( Bank_Lender__r.Name  =  "Mytestlender" &&  Total_Amount__c > 25000 && Total_Amount__c < 49999  &&  AND (ISPICKVAL( Months__c, "48-Months")) , 0.02436,
IF( Bank_Lender__r.Name  =  "Mytestlender" &&  Total_Amount__c > 25000 && Total_Amount__c < 49999  &&  AND (ISPICKVAL( Months__c, "60-Months")) , 0.02014,
IF( Bank_Lender__r.Name  =  "Mytestlender" &&  Total_Amount__c > 50000 && Total_Amount__c < 99999 &&  AND (ISPICKVAL( Months__c, "24-Months")) , 0.04472,
IF( Bank_Lender__r.Name  =  "Mytestlender" &&  Total_Amount__c > 50000 && Total_Amount__c < 99999  &&  AND (ISPICKVAL( Months__c, "36-Months")) , 0.03069,
IF( Bank_Lender__r.Name  =  "Mytestlender" &&  Total_Amount__c > 50000 && Total_Amount__c < 99999  &&  AND (ISPICKVAL( Months__c, "48-Months")) , 0.02358,
IF( Bank_Lender__r.Name  =  "Mytestlender" &&  Total_Amount__c > 50000 && Total_Amount__c < 99999  &&  AND (ISPICKVAL( Months__c, "60-Months")) , 0.01923, NULL))))))))


REDUCED FORMULA...(giving me a ....Error: Syntax error)

IF( Bank_Lender__r.Name  =  "Mytestlender" &&  Total_Amount__c > 50000 && Total_Amount__c < 99999  &&(CASE(1,IF(ISPICKVAL(Months__c,"24-Months")),0.04524,​​
IF(ISPICKVAL(Months__c, "36-Months")),​​0.03135, NULL))
  • April 07, 2014
  • Like
  • 0
Hi, I have a requirement to write an extension that will create multiple records by cloning the records and inserting different contacts with one click of a button. 

So I wrote my controller going through for loop that will look for more records in a list, insert the contact and parent ID and then clone the record. But maybe this is not the way to do it? I'm getting Visualfoce error. I have no idea what it means. My page reference looks correct.

Please help! It is kind of urgent so any help is appreciated. 

Here's my controller: 

public class ContactInsert
{
    public List<Expense_Line_Item__c> expense {get; set;}
    private final Expense_Line_Item__c LI;
   
    public ContactInsert(ApexPages.StandardController myController) {
        this.LI = (Expense_Line_Item__c)myController.getRecord();
        expense = new List<Expense_Line_Item__c>();
        //addrow();
         }

    public void addrow(){
   
        Expense_Line_Item__c exp = new Expense_Line_Item__c();
      
        expense.add(exp);
     
    }
           
    public void removerow(){
        Integer i = expense.size();
        expense.remove(i-1);}
           
    public PageReference save() {
   
     /*   List<Expense_Line_Item__c> listexpense = new List<Expense_Line_Item__c>();
       */
      
        Account acct = [Select id, name from Account where id=:LI.expense__c];
        //Contact con =[Select id, name from Contact where id=:LI.contact__c];
        //Expense_Line_Item__c exp = new Expense_Line_Item__c();
       
        for(Expense_Line_Item__c exp :expense)
         {
            
             Contact con =[Select id, name from Contact where id=:LI.contact__c];
             LI.expense__c = acct.ID;
             LI.contact__c = con.ID;
             expense.clone();
         }
            
       
          Integer count = 0;
          count = expense.size();
          system.debug('count:::::::::::::::::::'+count);
          //expense[0].test_c = LI.expense_c;
          insert expense;
        
        PageReference parrec = new PageReference('​/apex/expense');
        parrec.setRedirect(true);
        return parrec; }
}

Here's my Visualforce Page:
<apex:page StandardController="Expense_Line_Item__c"  extensions="ContactInsert" standardStylesheets="true" >
<apex:form >
<apex:pageBlock >


    <apex:pageBlockButtons >
                <apex:commandButton value="Save" action="{!Save}"/>
                <apex:commandButton value="Cancel" action="{!cancel}"/>
    </apex:pageBlockButtons>

    <apex:pageblockSection >
                <apex:inputField value="{!Expense_Line_Item__c.Expense__c}" />
                <apex:inputField value="{!Expense_Line_Item__c.Name}"/>
                <apex:inputField value="{!Expense_Line_Item__c.Date_of_Expense__c}" />
                <apex:inputField value="{!Expense_Line_Item__c.Contact__c}" />                  
                <apex:inputField value="{!Expense_Line_Item__c.Amount__c}"/>
   
    </apex:pageblockSection>
  
    <apex:actionRegion immediate="true">
            <apex:pageBlockSection title="Additional Contacts" >
         
            <apex:commandButton value="Add Contact" action="{!addrow}" reRender="table"/>
           <br/>
           <br/>
             <apex:pageBlockTable value="{!expense}" var="a" id="table">              
                <apex:column headerValue="Contact">
                    <apex:inputField value="{!a.Contact__c}" required="false"/>
                </apex:column>                                      
            </apex:pageBlockTable>
            </apex:pageBlockSection>
            </apex:actionRegion>             
   
</apex:pageBlock>
</apex:form>
</apex:page>


What am I doing wrong???
how can i get the Date value of a DateTime field in query?
public Date myDate1 {get;set;}
public Date myDate2 {get;set;}

public List<Obj__c> getObj() {
          return[SELECT id, Name, Date_Time__c FROM Obj__c WHERE DATEVALUE(Date_Time__c) <=: myDate1 and DATEVALUE(Date_Time__c) >=: myDate2];
}

unfortunately, DATEVALUE(field) didn't work. is there anyway i can get the date value of Date_Time__c?
  • February 28, 2014
  • Like
  • 0
I have a VisualForce page displaying some fields. When these fields have any value other than "none" selected, the users would like to see the field highlighted in some manner. 

Here's what the screen currently looks like:
User-added image

Here's an example of what I'd like (exactly where the highlighting takes place, whether it's shading or changing font color of whatever is flexible) it to look like:
User-added image

My VF page code is as follows (note: the page has more elements displayed below the screen shot, but those aren't relevant to the question, so I cut them off to save space on the screen shot):

<apex:page standardController="ACA_Member__c" extensions="reloadACAMember,risk_ControllerExtension">

<style>
   .col1 {width:200px; text-align:right; font-size:.875em; font-weight:bold; color:rgb(74,74,86);}
   .col2 {width:200px; text-align:left;}
   .colp1 {width:100px; text-align:right; font-size:.875em; font-weight:bold; color:rgb(74,74,86);}
   .colp2 {width:100px; text-align:left;}
   .colp3 {width:100px; text-align:left;}
   .colh1 {width:400px; height:25px; text-align:center; background-color:#A9D0F5;}
</style>
   
   
<apex:form >
    <apex:pageBlock mode="edit">
       
        <apex:pageblockButtons >
            <apex:commandButton value="Save" action="{!save}" reRender="updateable, relatedList"/>
        </apex:pageblockButtons>

        <apex:panelGrid columns="2" columnClasses="col1,col2" border="0">
           
            <apex:outputText >Lifestyle Segment</apex:outputText>
            <apex:inputField value="{!ACA_Member__c.Lifestyle_Segment__c}"/>
          
           
            <apex:outputText >Favorable to ?</apex:outputText>
            <apex:inputField value="{!ACA_Member__c.Favorability__c}"/>
           
            <apex:outputText >Engaged in Health Decisions?</apex:outputText>
            <apex:inputField value="{!ACA_Member__c.Health_Decisions__c}"/>
           
            <apex:outputText >Prefers Details or Highlights?</apex:outputText>
            <apex:inputField value="{!ACA_Member__c.Details_Highlights__c}"/>
           
        </apex:panelGrid>
       
        <apex:panelGrid columns="1" columnClasses="colh1" border="0">
            <apex:outputLabel ><b>Provider Information</b></apex:outputLabel> 
        </apex:panelGrid>
       
        <apex:panelGrid columns="3" columnClasses="colp1,colp2,colp3" border="0">
     
            <apex:outputLabel ></apex:outputLabel>  
            <apex:outputLabel ><b>Confirmed</b></apex:outputLabel>
            <apex:outputLabel ><b>Attributed</b></apex:outputLabel>
           
            <apex:outputLabel >Name</apex:outputLabel>
            <apex:inputField value="{!ACA_Member__c.Confirmed_Provider__c}"/>
            <apex:outputField value="{!riskProfile.Attributed_Provider__c}"/>

            <apex:outputLabel >NPI</apex:outputLabel>
            <apex:inputField value="{!ACA_Member__c.Confirmed_NPI__c}"/>
            <apex:outputField value="{!riskProfile.Attributed_NPI__c}"/>
           
        </apex:panelGrid>
         
    <apex:panelGrid columns="2" columnClasses="col1,col2" border="0">
        <apex:outputLabel ></apex:outputLabel>
        <apex:outputLabel ></apex:outputLabel> 
   
            <apex:outputText ><b>Rep Determined Do Not Engage</b></apex:outputText>
            <apex:inputField value="{!ACA_Member__c.DNE__c}"/>
       
    </apex:panelGrid>

       
    </apex:pageBlock>

</apex:form>

</apex:page>

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

One thought I had is that I could use the rendered attribute to display it one way if the value is not null, but another way if it is null. However, when I test this, I cannot the ISBLANK function to return either TRUE or FALSE. Even if this works, it seems like a really clunky, less than ideal solution. But I'm new to this (certified admin, but no developer training), so I'm just trying to figure something out. 

<apex:outputText rendered="ISBLANK({!ACA_Member__c.Lifestyle_Segment__c})>Lifestyle Segment</apex:outputText>
<apex:inputField value="{!ACA_Member__c.Lifestyle_Segment__c}"/>


Anyone have ideas as to how I can accomplish what I need to? Thanks in advance. 

I'm trying to create a different case page layout for different record types in the service console.

For example:

I have one record type that has multiple job types. I'd like to see a picklist for job types on the page layout but not for the other record types.

This doesn't work.

<apex:inputfield value="{!IF(Case.RecordType=='IT Services','Case.Job_Type__c','null')}"/>


Can anyone help? or let me know if this is possible?

  • September 18, 2013
  • Like
  • 0
Hello,

I would like to delete chatter files , which are not being referred in any chatter posts.

I want to write an apex batch for doing the same.

I couldnt find enough pointers on the same. Can some one help me with this ?

Thanks,
Suresh
Hi All,

I want to update the chatter profile pictures for 30K employees.
Can some one help me with this.

Currently, I am loading the images into a document folder. Document Names matches with a field on the user object.
Have written a batch which will set the profile pictures, using the following method:
ConnectApi.chatterUsers.setPhoto().

I thought Apex Batch will ananymously and I wont hit any limits. But its giving me an Rate Limit error, if there are 30K images in the document folder.

How can I overcome the Chatter Rate Limits.

This is for one time update. Is there a better option?.

Thanks
Hi All,

I am having a visualforce page, with a tabpanel component.
<apex:tabpanel switchType="client">
    <apex:tab name="tab1" onTabEnter="parent.setHeight(window);">
     ----------some content------
    </apex:tab>
     <apex:tab name="tab2" onTabEnter="parent.setHeight(window);">
     ----------some other content------
   </apex:tab>
</apex:tabpanel>
First tab will be having content of 1600 px height and second tab content will be having 400px height.

I am displaying this visualforce page in another vf page using an iframe.
I am setting the height of the iframe dynamically onload of the iframe, using the following javascript function.
   function setHeight(obj)
   {
        obj.style.height=obj.contentWindow.document.body.scrollHeight+'px';
    }
   ................
  <apex:iframe html-oncomplete="setHeight(this)" scrolling="false"/>


But when I click on any tab, in the iframe the parent method are not getting called.
Even I am not able to switch the tabs.

In the debug console, its showing an error like following:
"XMLHttpRequest cannot load ..... No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin '.....' is therefore not allowed access"


Can someone help me with this please?
I want to reduce the height of iframe, when the tab switching is happening, so that for the second tab more space wont be shown.

Thanks
Hi All,

I am having a visualforce page, with a tabpanel component.
<apex:tabpanel switchType="client">
    <apex:tab name="tab1" onTabEnter="parent.setHeight(window);">
     ----------some content------
    </apex:tab>
     <apex:tab name="tab2" onTabEnter="parent.setHeight(window);">
     ----------some other content------
   </apex:tab>
</apex:tabpanel>
First tab will be having content of 1600 px height and second tab content will be having 400px height.

I am displaying this visualforce page in another vf page using an iframe.
I am setting the height of the iframe dynamically onload of the iframe, using the following javascript function.
   function setHeight(obj)
   {
        obj.style.height=obj.contentWindow.document.body.scrollHeight+'px';
    }
   ................
  <apex:iframe html-oncomplete="setHeight(this)" scrolling="false"/>


But when I click on any tab, in the iframe the parent method are not getting called.
Even I am not able to switch the tabs.

In the debug console, its showing an error like following:
"XMLHttpRequest cannot load ..... No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin '.....' is therefore not allowed access"


Can someone help me with this please?

Thanks
Hi All,

I have used title attribute in <apex:page> tag, but the title is not getting set.

I read here to use <title> tag.
https://developer.salesforce.com/forums/ForumsMain?id=906F000000095cLIAQ

And its working in Chrome, but not in IE(IE9).

How to solve this??

Thanks
Hi All,

I am trying to upload a file to box.com(an external service).

In Page1, I am having an iframe. In this iframe i am displaying another vf page-Page2.

From Page2, I am trying to connect to box.com API through OAuth. On click of a button, authorization page will be happened and I will proceed. 
The functionality is working in Page2.

But when I access Page2 from Page1(i.e. in iframe), its displaying "This Content Cannot Be Displayed in a Frame" error.

How can I prevent this?

Thanks
Hi All,

I have used required="true" for apex:inputFile.
On click of a custom button, I am trying to upload that file.

But even if its required="true", the controller method is getting called and null pointer exception is being thrown.

We cannot keep rerender in conjuction with rerender attribute. So I am not keeping rerender for this button.

How can check whether a file is selected or not?
Hi All,

I am using the following style to update the background color of <apex:pageMessages>
.message
{
     background-color:AliceBlue;
}

Here message is the Salesforce style class for pageMessages. This is getting applied when i access the page from my Sandbox environment.
But when i access the page from community site, the background color is not getting changed.

This is happening only in IE. In Chrome its working fine.

Please help me with this.

If i add it to a static resource and access it, its not working in Chrome also.

Thanks.
Hi All,

I want to get the site guest user's original timezone.

If we use userinfo.getTimzone(), it will give us the timezone thats being stored in the site guest user record.

What are the possible ways to accomplish this??

Thanks.
Hi All,

I am creating a vf page for displaying posts from a chatter group using ConnectApi.In that page, I want to display the community nickname of the user who posted/commented. How to do that?

Thanks
Hi

I am using the code in below link to add CAPTCHA to my site page.
https://developer.salesforce.com/page/Adding_CAPTCHA_to_Force.com_Sites

In test class how can I create a scenario for success and failure for entering CAPTCHA.

Thanks alot.
Hi All,

I am having a widget to upload file to box.com inside a <apex:tab>.
That widget is being displayed uing a <script> tag

My Page structure is as follows:
<apex:tabpanel switchType="ajax" selectedTab="tab1">
    <apex:tab name="tab1">
         <script to show the box.com upload widget/>
     </apex:tab>
<apex:tab name="tab2">
         ---some other content--
     </apex:tab>
</apex:tabpanel>

First time when the page is loaded the widget is appearing.
When i switch to second tab and come back to first tab, the widget is not appearing.

Could you please help me with this?
Hi All,

I am having a object-Registrant .
On inserting a registrant record with Status__c='Approved', I am creating a contact and an authenticated user with the details provided.
I am using a future method to create a user.

If the registrant status__c is made as 'Deactivated', I need to make the corresponding user as inactive.
I am using a future method to deactivate the corresponding user.

How can I replicate deactivating, in test methods??

Thanks

Hi all,

How to get the createduser's id for a feedItem using ConnectApi?
Using getfeedItemsFromFeed(), I am getting feed from a chatterGroup.

Thanks,
Hi All,

Has anyone tried with Box for Salesforce app?

I want to know the following things:
1. whether we can prevent the user from seeing the files that are not uploaded him.
2. Whether we can check(programmetically) whether a file is already uploaded by a user, for a particular record.

Thanks.
Hi All,

Has anyone tried with Box for Salesforce app?

I want to know the following things:
1. whether we can prevent the user from seeing the files that are not uploaded him.
2. Whether we can check(programmetically) whether a file is already uploaded by a user, for a particular record.

Thanks.
Hi All,

I am displaying the createdDate field in visualforce page, using apex:outputtext.
<apex:outputText value="{!comment.CreatedDate}"/>

It is getting displayed in GMT timezone. Can I display it in current user's timezone, using apex:outputtext, without using any coding?

I cannot use outputField, it will give 'Not a valid binding' error

Thanks
Hi All,

We are having out of the box feature to upload chatter profile picture.
I am having a requirement, where the user will be allowed to upload the profile pic using visualforce page.

But dont know how to proceed.
Could you guys help me with this?

Thanks,
Hi All,

I am having visualforce code like following:
I want to provide a dynamic id to the outputpanel and want to rerender particular outputpanel alone onclick of a commandLink as shown.
<apex:repeat value="{!listOfRecords}" var="rec">
         <apex:outputpanel id="{!rec.Id}">
                   <apex:commandLink rerender="{!rec.Id}" ......../>
          </apex:outputpanel>
</apex:repeat>

Its giving me following error, if i try to keep {!rec.Id} as the id for outputpanel:
  "Literal Value is Required for attribute id in <apex:outputpanel>"

And If I give {!rec.Id} as rerender attribute for CommandLink, its giving following error:
Unknown property rec

Could you guys please help me to solve this or by providing any work arounds?


Thanks in advance:)
Hi All,

How to get the id of the user who posted the feeditem/ comment using  Chatter In Apex/Connect API

Thanks in advance :)
Hi All,

Has anyone tried with Box for Salesforce app?

I want to know the following things:
1. whether we can prevent the user from seeing the files that are not uploaded him.
2. Whether we can check(programmetically) whether a file is already uploaded by a user, for a particular record.

Thanks.
Hi All,

Has anyone tried with Box for Salesforce app?

I want to know the following things:
1. whether we can prevent the user from seeing the files that are not uploaded him.
2. Whether we can check(programmetically) whether a file is already uploaded by a user, for a particular record.

Thanks.
Hi All,

How to get the id of the user who posted the feeditem/ comment using  Chatter In Apex/Connect API

Thanks in advance :)
Hi all,

I am having a visualforce page, with an iframe. I am displaying another page(page2) in this. On click of a link in page2, we wil be redirected to page 3, within the iframe. 

I am displaying a rich text area, in page3, inside a tabpanel. I have set the width for the containing form as 880px.Its working fine in the individual page. But, when displayed in page1, (by redirecting from page2), the content in the tabpanel is cutting off in the right side of the iframe.
<apex:form> in the page 3 is having width as 880px only, but tabpanel's width is exceeding.

Everything is fine in firefox. But this issue is seen in IE and Chrome.

Can some one help me with this please?

The layouts are as follows(rough);

page1:
<pre>
..
<div style="width:880px;">
<apex:iframe src="page2" width="100%"/>
</div>
..
</pre>

page2:
<pre>
..
<apex:form style"width:880px">
<apex:datatable value="records" var="rec">
<apex:column>
<apex:commandLink value="{!rec.name}" action="{!redirect}>
<!--used param to pass the value-->
</apex:commandLink>
<apex:column>
</apex:datatable>
</apex:form>
..
</pre>


Page3:
<pre>
..
<apex:form style="width:880px">
<apex:tabpanel>
<apex:tab>
<apex:outputfield value="a_richTextAreaField"/>
</apex:tab>
<apex:tab>
some other content
<apex:tab>
</apex:tabpanel>
</apex:form>
..
</pre>


Thanks
Hi,

I am having a visualforce page(page 1), in which I am rendering another visualforce page(Page2), in iframe. Page 2 will have some links in tables, on click of which, we will be redirected to another visualforce page(page3).

Page 3 is having markup similar to below:
page 3:
<apex:pageblock>
  <apex:tabpanel>
    <apex:tab>
             <apex:outputfield value="a rich text area field">
      </apex:tab>
      <apex:tab>
           //some content.
      </apex:tab>
   </apex:tabpanel>

But the rich text area content is overflowing and some part of the content is being cut off in IE(on right side i.e. width wise ). It looks normal in Mozilla.

Could some one help me with this?

I want the content to be fit into the iframe width.
I am auto filling a date/time field with Now() but it's 2 hours behind. What is up with that? Do I need to change a timezone setting or something?
Please help me with solving this error.
My trigger fires each time is record is inserted.It works fine with small data.Every night i get lot of inserts I am getting this error:: System.DmlException: Insert failed. first error: INVALID_FIELD_FOR_INSERT_UPDATE, cannot specify Id in an insert call: [Id]

below is my code
 
trigger Linktorecord on project__c (before insert,before update,after insert) {

    Map<String,product2> pMap=new Map<String,product2>();
    List<product2> p2List=new List<Product2>();
    List<Opportunity> oppList=New List<Opportunity>();
    List<Opportunity> oppList2=New List<Opportunity>();    
    oppList=[select id,name,accountid,serialnumber__c from opportunity where SerialNumber__c !=null];

    for(product2 pro  : [select id,productcode from product2]){
        pMap.put(pro.productcode,pro);
    }
   
  if(trigger.isinsert&&trigger.isbefore)
    for(Project__c I:trigger.new){

        if(i.Number__c != null && Pmap.Containskey(i.Number__c))
        {
            i.product__c=pMap.get(i.Number__c ).Id;
            break;
        } 
            
        else{
               
        Product2 newp =new Product2();
        if(i.number__c  !=null){        
        newp.Name=i.Number__c;
        }
        if(i.Number__c !=null){
        newp.ProductCode=i.Number__c;
        }
        p2List.add(newp);
        }
       
        insert p2List;
        if(p2List.size() >0){
        i.product__c=p2List[0].id; 
        }
       }
       
       if(trigger.isinsert && trigger.isafter){
       List<project__c> newproj =new List<project__c>();
       set<id> opids=new set<id>();
       newproj=trigger.new;
       Opplist2=[select id,SerialNumber__c,project__c from opportunity where Serialnumber__c =:newproj[0].Serialnumber__c];
       for(project__c I2:newproj){
         opids.add(i2.id);
       }
      if(!opids.isempty()){
      List<opportunity> oList =[select id,project__c from opportunity where Serialnumber__c =:newproj[0].Serialnumber__c];
       for(Opportunity ol:olist){
             
             ol.project__c =trigger.new[0].id;
       }      
      update olist;
      }       
    }
}

 
With good reason, How do I show white space (blank) instead of --none-- in a visualforce case picklist? 

​I have about 10 picklist fields. None are required and I want the ones that have no value to be blank white space instead of "--none--". 

The reason for this is to keep my UI looking clean and readable.
Having 10 fields with a label and "--none--" beside each of them is very cumbersome. I'd much rather they just show blank.

I'm looking to create a custom Pick list field on the "Account" object that is automatically populated based on the options of another field within the Account Object.  For example  the new field name is "Type" and the available options are: Strategic and Emerging. I would like the value of this field to be automatically populated based on the value selected under existing picklst field  field "Vertical" within standard account object.  

Vertical field has the follwoing options: Automotive,  CPG, Entertainment, Financial, Oil Gas and Power, Other, Pharmaceuticals, Restaurants, Retail, Tech, Telecommunications, Travel, Insurance

The mapping will be as follow: 
Automotive - Strategic
CPG - Strategic
Entertainment - Emerging
Financial - Strategic
Oil Gas and Power - Emerging
Other - Emerging
Pharmaceuticals - Strategic
Restaurants - Strategic
Retail - Strategic
Telecommunications - Emerging
Travel  - Emerging
Insurance - Strategic

Greatly appreciate any guidance you can provide. 

Best, 
JP
Hi everyone,

I have to test this class:

List<Account> oldAccounts   = Trigger.old;
        for(Account check : oldAccounts){
            if(check.Account_ID__c!=null){
                check.addError('Accounts that have SAP Account ID can not be deleted');
            }
        }

I know that in theese cases one has to use try/catch methods to solve the test.
But I've been trying for hours and I don't know how to solve it.

I post what I did so far, it covers everything except last line ('addError'):

@isTest
public class TriggerAccountDeleteTest {
      public class MyException extends Exception {}
       static testMethod void metodoDeletAccount(){
        
             //Create an Account with his required fields
             Account accountPrueba = new Account();
                accountPrueba.Name = 'Siemens2';
                accountPrueba.Account_Country__c = 'a014E000005XNKh';
                accountPrueba.Language__c = 'a064E0000060Wnr'; 
                accountPrueba.Department__c = 'Services';
            
            //Insert it
            insert accountPrueba ;
           
            //Test.startTest();  
                try{
                    delete accountPrueba;
                    Account deletedAccount = [SELECT Id, IsDeleted FROM Account WHERE Id = :accountPrueba.Id ALL ROWS];
                    System.assertEquals(deletedAccount.IsDeleted, true);
        
                    }
                 catch(Exception e){
                    Boolean b = null;
                    accountPrueba2.Account_ID__c = String.valueOf(b);
                    System.assert(e.getMessage().contains('Accounts that have SAP Account ID can not be deleted'));
                 }
               Test.stopTest();   
        
    }
}
Thank you for your time
Cheers,
Alberto
Hello,

I want to add a text inside like below

User-added image

caseObj.Descripion= Label.Descrption;

Description label is like
"Date:\nTime:\nname:"

When i try to add this label, it always adds the "Date:\nTime:\nname:"
the new line is never added.

How can i achieve it ?
Hi Everyone,
      I need to conditionally render the highlighted apex out put texts but this is not wotking. Can someone please help me with the code below:
Rendered attribute is dependent on value of Variable ResultSize. The variable is showing the correct value hence I am not putting any apex code . The flow of code is gven below:

1. User key in the input values in input text boxes.
2. There is an onkeyup written on the input boxes. Than on key up function calles for a javascript that in turn calls for the apex action function . This apex action function rerenders the attribute. All other id's are being rerendered fine by action function except id's of out put texts size,size1.

<apex:page controller="ProposalSearchControllerModified" sidebar="false" readonly="True">

  <apex:form >
  <apex:pageMessages id="errors"/>

  <apex:pageBlock title="Search Proposal Records" mode="edit" id="OuterPageBlock">

  <table width="100%" border="0">
  <tr>  
    <td width="200" valign="top">

      <apex:pageBlock title="Search Parameters" mode="edit" id="criteria">

      <script type="text/javascript">

      function doSearch() {
        searchServer(
          document.getElementById("Name").value,
          document.getElementById("OpportunityID").value,
          document.getElementById("SolicitationNo").value,
          document.getElementById("ProposalNo").value

          );

      }
     
   

      </script> 

      <apex:actionFunction name="searchServer" action="{!runSearch}" rerender="results,debug,errors,size,size1">
          <apex:param name="Name" value="" />
          <apex:param name="OpportunityID" value="" />
          <apex:param name="SolicitationNo" value="" />
          <apex:param name="ProposalNo" value="" />

      </apex:actionFunction>

      <table cellpadding="2" cellspacing="2">
      <tr>
        <td style="font-weight:bold;">Opportunity ID<br/>
        <input type="text" id="OpportunityID" onkeyup="doSearch();"/>
        </td>
      </tr>
      <tr>
        <td style="font-weight:bold;">Solicitation #<br/>
        <input type="text" id="SolicitationNo" onkeyup="doSearch();"/>
        </td>
      </tr>
      <tr>
        <td style="font-weight:bold;">Proposal #<br/>
        <input type="text" id="ProposalNo" onkeyup="doSearch();"/>
        </td>
      </tr>
      


      <tr>
        <td>
          <b><apex:outputText id="size"  style="font-style:Bold;" value="Total Records Returned  :  {!ResultSize}" rendered="{!ResultSize<1000}"/></b>
          <b><apex:outputText id="size1"  style="font-style:Bold;" value="Total Records Returned  :  {!ResultSize} ++" rendered="{!ResultSize==1000}"/></b>

     
         
        </td>  
      </tr>
      

       
   </table>
  </apex:pageBlock>
       

    </td>

    <td valign="top">
    <table style="width: 100%;">
    <td>
    
    <apex:pageBlock mode="edit" id="results">    

        <div style="overflow: auto; height: 300px;">
          
        <apex:pageBlockTable value="{!Opportunities}" var="opp">

            <apex:column >
                <apex:facet name="header">
                    <apex:commandLink value="Opportunity Name" action="{!toggleSort}" rerender="results,debug">
                        <apex:param name="sortField" value="Name" assignTo="{!sortField}"/>
                    </apex:commandLink>
                </apex:facet>
                <!--<apex:outputLink value="/apex/SiteDetailPage?id={!opp.id}" target="_blank" rendered="{!IF(URLL=$Label.SalesforceURL,false,true)}">{!opp.Name}</apex:outputLink>
                <apex:outputLink value="/{!opp.id}" target="_blank" rendered="{!IF(URLL=$Label.SalesforceURL,true,false)}">{!opp.Name}</apex:outputLink>-->
                <apex:commandlink value="{!opp.Name}" rerender="RecordDetailSection" action="{!ClearOrder}">                
                 <apex:param name="DetailRecordId"  value="{!opp.Id}" assignTo="{!DetailRecordId}"/>   
                </apex:commandlink>               

            </apex:column>
            


            
            <apex:column >
                <apex:facet name="header">
                    <apex:commandLink value="Opportunity ID" action="{!toggleSort}" rerender="results,debug">
                        <apex:param name="sortField" value="OpportunityID" assignTo="{!sortField}"/>
                    </apex:commandLink>
                </apex:facet>
                <apex:outputField value="{!opp.Opportunity_ID__c}"/>
            </apex:column>
            
            <apex:column >
                <apex:facet name="header">
                    <apex:commandLink value="Proposal #" action="{!toggleSort}" rerender="results,debug">
                        <apex:param name="sortField" value="ProposalNo" assignTo="{!sortField}"/>
                    </apex:commandLink>
                </apex:facet>
                <apex:outputField value="{!opp.Proposal__c}"/>
            </apex:column>          


        </apex:pageBlockTable>
       </div>
       
    </apex:pageBlock>
    
    </td>

    </tr>
    </table>
    
    
    </td>

  </tr>

  </table>

   

  </apex:pageBlock>

  </apex:form>
   

</apex:page>
Hi Everyone,
           Due to some SOQL sub query limitations I have to query list of opportunity records into 2 seperate lists. for our e.g lets call them List A and List B.

So List A gets its values from soql query

List<Opportunity> ListA=[select Id, Name from Opportunity where StageName='Claosed Won'];

List<Opportunity> ListB=[select Id,Name from Oppoortunity where Sub_Stage__c='Aawarded'];

Set<Opportunity> SetC=ListA+ListB.

Now I want to combine List A and List B , take out the duplaicate data out of the combination and make a set out of it  Set c= List A+ List B ( but it should not have any duplaicate records)

Can anyone please help me with the syntax to join 2 lists into a set?

Please note that due to some limits I cannot get all my data into 1 list . The where clause e/g used above are just for theory . It's bit more complicated than that.
email not sent to user .

Trigger : 

trigger checkDuplicateValue on Account (after insert)
{
    if(Trigger.isAfter)
    {   
        //Get list of Users
        Map<Id,User> userMap = new Map<Id,User>([SELECT Name, Email FROM User]);
        
        //Get all Ids in order to do a query
        //and bulkify the trigger
        Set<Id> accIdSet = new Set<Id>();
        for(Account a : Trigger.new)
        {
            accIdSet.add(a.Id);
        }
        
        List<Account> accList = [Select ID, owner.Id, Name, fax, phone 
                                 From Account 
                                 Where Id in :accIdSet];
        
        if(!accList.isEmpty())
        {
            //Create a map with the Name and the Owner Id
            //With the Owner Id I can look for the User in the first Map
            Map<String, Id> accMap = new Map<String, Id>();
            for(Account acc : accList)
            {
                accMap.put(acc.Name, acc.owner.Id);
            }
            
            for(Account acc : Trigger.new)
            {
                String accName = acc.Name;
                if(accMap.containsKey(accName))
                {
                    //Double check the name for the new account
                    Id userId = accMap.get(accName);
                    acc.adderror('Account already exists in your Organization with name ' + acc.Name);
                    
                    //Retrieve the owner's email
                    String theEmail = userMap.get(userId).Email;
                    EmailHelper.sendEmail(theEmail);
                }
            }
        }
    }
}



Class :

public with sharing class EmailHelper
{
    public static void sendEmail(String theEmail)
    {
        Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage();
        mail.setToAddresses(new String[] {theEmail});
        mail.setSenderDisplayName('My Email');
        mail.setSubject('My email subject');
        mail.setPlainTextBody('Process fails duplicate value');
        Messaging.sendEmail(new Messaging.SingleEmailMessage[] { mail });
    }
}

 
Hi Folks,

Foe the testMethod: I need to use and access contact data based on the RecordType. I need to acess it Dynamically, i.e., using developerName. Please help if I need to make any chages.With current code I am getting Exception: System.ListException: List index out of bounds. Please help me fixing this. How exactly I should create:  recordtypeid=rlist[3].id

Thanks in advance

list<RecordType> rList = [Select id 
                                            From RecordType 
                                            Where sObjectType = 'Contact'and RecordType.Name = 'developerName'];
                                         
      
            Contact c1, c2, c3, c4, c5;
            c1 = TestUtils.createContact(new Contact(title = 'CEO', Salutation = 'Mr.', Lastname='Contact 1', AccountId=ac1.id, Email='test1@test.com', recordtypeid=rlist[3].id));
            c2 = TestUtils.createContact(new Contact(title = 'CEO', Salutation = 'Mr.', Lastname='Contact 1', AccountId=ac1.id, Email='test2@test.com', recordtypeid=rlist[3].id));
Hello,

I'm new to working on Visualforce pages.

We have an object that if a checkbox field is marked as true by the user, there is a formula field that returns a line of text if true, null if false. An example of one of these formulas is:

IF( Household_Budget_does_not_Show_a_Need__c , "Household budget does not show a need for the level of assistance requested", null)

I have it set to treat blank fields as blank.

There are about 21 of these fields. The problem I'm having with the Visualforce page is that when the field is null, it's still leaving a line of space on the pdf. What I would like is if the value is null, there will be no line of space.

Currently on the Visualforce page, I have it set up like:<apex:outputfield value="{!Application_Update__c.Household_Budget_Text__c}"/> 

How can I display this field that if it's null it will not take up a line of space on the Visualforce page?
This works fine
IF(CONTAINS("VS:BJ", Owner.Alias), "Legacy", 
IF(ISBLANK(BillingState), "International", 
IF(CONTAINS("WA:OR:CA:AZ:NV:IDMT:WY:UT:CO:NM:TX:OK:KS:NE:WY:NE:SD:ND:MN:IA:MO:AR:LA:WI:IL", BillingState), "USA - West", 
IF(CONTAINS("AB:BC:MB:NT:NU:SK:YT", BillingState), "CAN - West", 
IF(CONTAINS("DC:OH:MI:IN:KY:TN:MS:AL:GA:FL:SC:NC:VA:WV:PA:PA:NY:ME:ME:VT:NH:MA:RI:CT:NJ:DE:DE:MD", BillingState), "USA - East", 
IF(CONTAINS("NB:NL:NS:ON:PE:QC", BillingState), "CAN - East", 
"International"))))))
But i need to first evaluate a Checkboxf field.If its TRUE, then should be done, otherwise, continues.  So when I add (first line)
IF(Global_Key_Account__c="TRUE"), "Global",
IF(CONTAINS("VS:BJ", Owner.Alias), "Legacy", 
IF(ISBLANK(BillingState), "International", 
IF(CONTAINS("WA:OR:CA:AZ:NV:IDMT:WY:UT:CO:NM:TX:OK:KS:NE:WY:NE:SD:ND:MN:IA:MO:AR:LA:WI:IL", BillingState), "USA - West", 
IF(CONTAINS("AB:BC:MB:NT:NU:SK:YT", BillingState), "CAN - West", 
IF(CONTAINS("DC:OH:MI:IN:KY:TN:MS:AL:GA:FL:SC:NC:VA:WV:PA:PA:NY:ME:ME:VT:NH:MA:RI:CT:NJ:DE:DE:MD", BillingState), "USA - East", 
IF(CONTAINS("NB:NL:NS:ON:PE:QC", BillingState), "CAN - East", 
"International"))))))
I get Error: Syntax error. Extra ','
Reading up on different formatting but cant get it! thanks-
  • December 20, 2016
  • Like
  • 0
I have a checkbox in my vf page which is using custom controller. I need to get check box value true in apex class controller when it is checked, so that I can perform my logic based on that checkbox value. How to do that?
Are there any samples or docs for this. I've attempted to create an Apex Trigger on FeedComment, but it's just doesn't seem to work. I would also have to get the user ID of the original post etc.

Essentially all I want to do is send push to a user who's post was commented on. Seems like a pretty standard thing to do. Is there no easy way to do this with the Chatter API?
I have a requirment where selected records in wrapper class shold be displayed seperately.Upon selecting a particualr record and displayed in seperatly,that record should not be allowed to select again in wrapper class.i.e that records check box should be disabled.

How to disable selected records checkboxes only
I have created an email alert and I need to add disc bullet points to HTML Version of email template. I have added the below tags:
<ul type = "disc">
<li> item 1 </li>
</ul>

This is not working, please help me achieve disc bullets!
Hi,
I would like to figure out how to create a formula field that would evaluate stages and set a "phase" based on the stage.
Alternatively, I'd be OK with the Phase being a picklist, but updated from a workflow rule.

So if stages are Planning, Kick-off, Discovery, Software, Data, Training, & Closing, I would want the "phase" field to be set appropriately.

So if stage is in Planning OR Kick-off, then Phase is "Project Planning";
if stage is Discovery OR Software OR Data, then Phase is "Tech"; 
if Stage is Training OR Closing, then Phase is "Closing".

Does anyone have any suggestions?
Thanks!

Hi ,
I am trying to open the VF page and getting following error that The dependent picklist 'Survey' requires its controlling field 'Status' to be present on the page.

Since I have added the both field on the VF page. not sure why?

<apex:page standardController="Case" extensions="CSQuickCloseController" standardstylesheets="false" title="Quick Close" >
    <apex:pageMessages />
    <apex:Form >
       <apex:pageBlock rendered="{!IF( CurrentCase.Quick_Close__c == false, true, false)}">
           <apex:commandButton action="{!backToCasePage}" value="Back To Case" />
       </apex:pageBlock>
       <apex:pageblock title="Case Edit" rendered="{!IF( CurrentCase.Quick_Close__c == true, true, false)}">
           <apex:pageBlockButtons >
               <apex:commandButton value="Save" action="{!CustomSave}"/>
               <apex:commandButton action="{!Cancel}" value="Cancel" />
           </apex:pageBlockButtons>
           <apex:pageBlockSection title="User Efforts" rendered="{!IF(CurrentCase.RecordType.name != 'Training',true,false)}" columns="1">
               <apex:inputField value="{!CurrentCase.Less_than_15_minutes__c}"/>
               <apex:inputField value="{!CurrentCase.Hours_spent__c}"/>
               <apex:inputField value="{!CurrentCase.Minutes_spent__c}"/>
               <apex:outputField value="{!CurrentCase.Total_Time_Spent__c}"/>
           </apex:pageBlockSection>
           <apex:pageBlockSection title="Case Information" columns="1">
              <!--<apex:outputField value="{!CurrentCase.Account.Name}"/>-->
              <apex:inputField value="{!CurrentCase.AccountId}"/>
                <apex:inputField value="{!CurrentCase.ContactId}" required="true"/>
              <apex:outputField value="{!CurrentCase.Status}"/>
              <!--<apex:inputField value="{!CurrentCase.Reason}"/>-->
               <apex:outputField value="{!CurrentCase.Reason}"/>
               <apex:inputField value="{!CurrentCase.Internal_Comments__c}"/>
           </apex:pageBlockSection>
           <apex:pageBlockSection title="Categorisation" rendered="{!IF(CurrentCase.RecordType.name != 'FY16',true,false)}" columns="2">
               <apex:inputField value="{!CurrentCase.Type}" required="true"/>
               <apex:inputField value="{!CurrentCase.Member_Letter__c}"/>
               <apex:inputField value="{!CurrentCase.Category_level_2__c}"/>
               <apex:inputField value="{!CurrentCase.Member_Letter_Ref__c}"/>
               <apex:inputField value="{!CurrentCase.Category_level_3__c}" required="True"/>
               <apex:inputField value="{!CurrentCase.Business_Enhancements__c}"/>
               <apex:inputField value="{!CurrentCase.Category_level_4__c}" required="True"/>
               <apex:inputField value="{!CurrentCase.Business_Enhancement_Date__c}"/>
               <apex:inputField value="{!CurrentCase.Detail__c}" required="True"/>
           </apex:pageBlockSection>
           <!--<apex:pageBlockSection title="Billing Details" columns="2">
               <apex:outputField value="{!CurrentCase.Billing_category__c}"/>
               <apex:inputField value="{!CurrentCase.Quantity__c}"/>
               <apex:outputField value="{!CurrentCase.Rate__c}"/>
               <apex:inputField value="{!CurrentCase.Actual_Fee__c}"/>
               <apex:inputField value="{!CurrentCase.Approved__c}"/>
               <apex:inputField value="{!CurrentCase.Reason_for_Discount__c}"/>
               <apex:inputField value="{!CurrentCase.Reason_for_Cancellation__c}"/>
               <apex:inputField value="{!CurrentCase.Billing_BIN__c}"/>
           </apex:pageBlockSection>-->
          <apex:pageBlockSection title="Survey" rendered="{!IF(CurrentCase.RecordType.name != 'Finance' && CurrentCase.RecordType.name != 'Treasury' && CurrentCase.RecordType.name != 'FY16' && CurrentCase.RecordType.name != 'CBDIP' && CurrentCase.RecordType.name != 'Fraud'  && CurrentCase.RecordType.name != 'Training',true,false)}" columns="2">
              
               <apex:InputField value="{!CurrentCase.Do_Not_Survey_picklist__c}" required="True"/>
               <apex:inputField value="{!CurrentCase.Survey_Type__c}" required="True"/>
               <apex:InputField value="{!CurrentCase.DNS_Reason__c }" required="True"/>
               <apex:inputField value="{!CurrentCase.Multiple_Case_workers__c}"/>
               <apex:inputField value="{!CurrentCase.DNS_Reason_Other__c}"/>
           </apex:pageBlockSection>
       </apex:pageblock>  
    </apex:Form>
</apex:page>
 
Can we use formulas in email templates such as TODAY()? I tried but it did not work.Any workarounds other than creating a formula fields and merging them?

Would it be possibile to filter null long text area fields in SOQL?

I need to run process where if a number of text area fields in contact are null then do something.

Thanks in advance!

 

I was tasked today with finding out how to create a Mobile App(for phones etc) in salesforce that our Members can log into and Submit a Volunteer time sheet logging the hours they volunteered while they are on Site. I want to be able to link the form to Salesforce and update a Volunteer Campaign and also record the hours on the Contact's record as well. 
I'm thinking I wil need to build the form using Visual force then use Process builder to handle the actions of Updating the Campaign and contact record.

Any pointers? Suggestions?
Hi,

I have a issue with comma seperator in csv file download.
<apex:page controller="AnalysisController"   contentType="application/vnd.ms-excel#Analysis.csv">
<apex:outputText value="{!price}" >
this is what i am using in the vf page to print the price value. Here price is a string 6,44,567.00  as this string is having comma the out put is splitting in to different cells, like 6 in one cell 44 in other and 567.00 in other cell.
How can I over come this issue?
1) As the source of my report is from multiple Maps i am not able to download in xls
2) Tried to use format for outputtext component but here in my case the value is string
3) Tried to remove the comma using substitue but as my app supports multiple locale, people in some locale uses comma as decimal seperator hence can't remove comma.

Thanks in advance.

Hemanth

I have a visualforce page to be used by customer service consultants. 

Currently, the visualforce page pseudo-dynamically renders inputfield choices through a series of if/then statements that change each field's "renderVariable" to true or false.

So, user picks 'A' from picklist one. Fields A1,A2,A3 appear for input.

Then, user picks 'B' from picklist two. Fields B1,B2 appear for input.

Is there a better way to do this?

The main problem I have is that multiple selections cause multiple fields to render in the order they were entered rather than added to the bottom of the list. Is there a way to make the inputfields append what's already rendered?

<apex:inputField value="{!case.Status}">
  <apex:actionSupport event="onchange" action="{!Evaluate}" rerender="RequiredFields"/>
</apex:inputField>

<apex:pageBlockSection title="Required Fields" id="RequiredFields">
  <apex:inputField value="{!Case.Transaction_Number__c}" label="Transaction Number" rendered="{!if(TransactionNumber==true,true,false)}"/>

----------------------------------------------
public class FieldManager{  
  public case myCase {get;set;}
  public boolean TransactionNumber {get;set;}

  public ShowFieldManager(){
        string PageId=ApexPages.currentPage().getParameters().get('id');
        myCase=[SELECT id FROM case WHERE id=:PageId];        
        
        Evaluate();            
    }

public pagereference Falsify(){TransactionNumber=false;return null;}

public pagereference Evaluate(){
    Falsify();
     if(myCase.status=='Waiting for Transaction Number') TransactionNumber=true;
    return null.
    }
}
We have e-commerce community in our org. Here customer community users will submits their orders after shopping online and these orders will be reviewed and approved by salesforce platform users from CRM. Actual problem comes here, we couldn't share community user records with CRM users. we wrote apex trigger to share records using apex sharing but it is not working.

NOTE that we don't want to use view All or modify All permissions in profile because this will provide complete access to the users.

your suggestions or ides will be most appreciated.

Thank you guys...
Hi,

I'm moving my production data to sql server, working on data migration. In my org, there is a Text(Encrypted) field, I want to see that field values. As i used that field in apex class, I'm unable to change the field type. Please suggest me how to Decrypt the data. 

I have facing an error when I use an aggregateresult inside the execute method of a Batch Class.

I have being reviewing old post and I have read the solution provided here https://help.salesforce.com/apex/HTViewSolution?urlname=Aggregate-queries-and-Batch-Apex&language=en_US
but in that solution, the problem is in the start , not in the execute.

My batch class is like this :
global class BatchClass implements Database.Batchable<Sobject> {

global Database.QueryLocator start(Database.BatchableContext ctx) {
        String query = 'select a lot of records based in Ids and Dates';
        return Database.getQueryLocator(query);
    }
    global void execute(Database.BatchableContext ctx, List<Sobject> sObjects) {
    for(AggregateResult result : [select field1__c,field2__c, sum(Net_Revenue__c) r from Revenue__c where Type__c = 'C' where :condition group by Corporate_Account__c, Year_Month__c]){
            revenues.get((Id)result.get('c')).addRevenue((String)result.get('m'), (Decimal)result.get('r'));
        }

When I execute the class, I get this.

First error: Aggregate query does not support queryMore(), use LIMIT to restrict the results to a single batch

Any idea on how to resolve this?

Thanks
      
    }


}

HI All,
Our company needs to build public facing website using Salesforce Sites. It would be roughly 20 sites in total.
I read some posts mentioning there is a limit of 500,000 page view per month for Enterprise edition (which our company uses). without extra cost
I have some questions regarding this.
1.Can someone please provide me the office SFDC url regarding the page view limit?
2.How the page view is calculated? ie. On a VF page, checkbox A controls the visibility of an outputpanel B. Is it counted as a page view every time the user check or uncheck the checkbox A?
3.I would like to know 500,000 Page view is for all sites or only one site.

Thanks,
David
Hi Guys,

While developing visualforce pages for force.com public sites i want to store some values in session from apex controller.
I used Cache.Session / Cache.SessionPartition but this is only working internally, not working on public sites.

Code lines are below-
Cache.SessionPartition sessionPart = Cache.Session.getPartition('local.myPartitionSession');
 // Retrieve cache value from the partition
 if (!sessionPart.contains('BookTitle')) {
        sessionPart.put('BookTitle', 'test');
 }

Thanks.
Pradip Shukla
Hi All

I am having problem restoring sidebar styles. I created a homepage component of type 'Visualforce' and two tabs 'Accounts' and 'Contacts' which redirect user to 'All List ' view for corresponding objects (As I do not want to see recent item page for accounts and contacts for some profiles). 

When I click on these visualforce tabs, my homepage component loses style. When I checked through developer tool a new css is getting applied i.e. ext-all-no-theme.css 

I have not mentioned style anywhere. Not sure why this is happening. Please let me know if anybody has experienced this problem before.

TIA
Hi All,

I am trying to create a VF page to upload users's chatter profile picture. I know about the OOB way but we have a requirement to upload it using Visual force pages. 

Following is the code that I have developed. But I am recieving the following error. Please help me to troubleshoot this or if there is any workaround. I am okay to use any other fuction, but once the user uploads an image that has to be set as her profile. Even if that is cropped automatically and saved that is fine, or if we can even crop it that also will be great. 

I recieve following error: ConnectApi.ConnectApiException: Illegal value for parameter: 'fileId': 015L0000000ENip
Error is in expression '{!upload}' in component <apex:commandButton> in page profilephotoupload

An unexpected error has occurred. Your solution provider has been notified. (ConnectApi)

Following is the code. 

VF Page:

<apex:page controller="FileUploadController">
  <apex:sectionHeader title="Visualforce Example" subtitle="File Upload Example"/>

  <apex:form enctype="multipart/form-data">
    <apex:pageMessages />
    <apex:pageBlock title="Upload a File">

      <apex:pageBlockButtons >
        <apex:commandButton action="{!upload}" value="Save"/>
      </apex:pageBlockButtons>

      <apex:pageBlockSection showHeader="false" columns="2" id="block1">

        <apex:pageBlockSectionItem >
          <apex:outputLabel value="File Name" for="fileName"/>
          <apex:inputText value="{!document.name}" id="fileName"/>
        </apex:pageBlockSectionItem>

        <apex:pageBlockSectionItem >
          <apex:outputLabel value="File" for="file"/>
          <apex:inputFile value="{!document.body}" filename="{!document.name}" id="file"/>
        </apex:pageBlockSectionItem>

        <apex:pageBlockSectionItem >
          <apex:outputLabel value="Description" for="description"/>
          <apex:inputTextarea value="{!document.description}" id="description"/>
        </apex:pageBlockSectionItem>

        <apex:pageBlockSectionItem >
          <apex:outputLabel value="Keywords" for="keywords"/>
          <apex:inputText value="{!document.keywords}" id="keywords"/>
        </apex:pageBlockSectionItem>

      </apex:pageBlockSection>

    </apex:pageBlock>
  </apex:form>
</apex:page>

Controller:

public without sharing class FileUploadController {

  public Document document {
    get {
      if (document == null)
        document = new Document();
      return document;
    }
    set;
  }

  public PageReference upload() {
    Id ImageId;
    document.AuthorId = UserInfo.getUserId();
    document.FolderId = UserInfo.getUserId(); // put it in running user's folder

    try {
      document.type = 'jpg'; 
      document.IsPublic = true;
      insert document;
      ImageId = document.id;
      //ConnectApi.ChatterUsers newPhoto = new ConnectApi.ChatterUsers();
         
   
   
    } catch (DMLException e) {
      ApexPages.addMessage(new ApexPages.message(ApexPages.severity.ERROR,'Error uploading file'));
      return null;
    } finally {
      document.body = null; // clears the viewstate
      document = new Document();
    }

    ApexPages.addMessage(new ApexPages.message(ApexPages.severity.INFO,'File uploaded successfully : '+ImageId ));
    String communityId = null;
    String userId= UserInfo.getUserId();
    ID fileId = ImageId;

    // Set photo
    ConnectApi.Photo photo = ConnectApi.ChatterUsers.setPhoto(communityId, userId, fileId, null);
    return null;
  }

}

Thanks a lot,
Nidhi M
Hi,

I have a batch class which runs and attached like hundreds of text files to the Document object and i have a vf page and controller to get all the data in that documents into one big text file. The size of the file would be around 9MB. But iam getting the Apex heap sze too large error. Is it possible to generate a 9 MB text file from a vf page??

Here is my code

<apex:page standardController="Child__c" extensions="DocumentController" contentType="text/plain/#testfile" cache="false" >
<apex:repeat value="{!lstStringOutput}" var="str">
{!str}
</apex:repeat>
</apex:page>

Conrtoller:
public with sharing class DocumentController {
public List<String> lstStringOutput {get;set;}
Public Static String text;
    public DocumentController(ApexPages.StandardController controller) {

         lstStringOutput = new List<String>();
          Folder folder = [select id from Folder where name='Test file' LIMIT 1];
        
        for(Document doc : [Select id, Description , Body , folderId from Document where folderId = :folder.id ]){
          text= doc.Body.toString();
             lstStringOutput.add(text+'\r');
           } 
}
}
Thanks

Hi,

I converted my date field in string, so I can updated my other field in account.

    for (Account acc: [SELECT Id, Data_pedido_AR__c, Data_pedido_SA__c FROM Account WHERE id IN: ids]){

    for (Case c: trigger.new) {
   
    if(c.motivo__c == 'Formandos AR' && c.Data_pedido_AR__c != null && Trigger.oldMap.get(c.id).Data_pedido_AR__c != c.Data_pedido_AR__c){
    Datetime d = Date.Valueof(c.Data_pedido_AR__c);   
    String dateStr = d.format('dd/MM/yyyy');
    System.debug('::::::::::: ' + dateStr) ;

        acc.Data_pedido_AR__c = dateStr;
    }
update acc;


It works fine but in my account my field is one day less.
If I put c.Data_pedido_AR__c = 20/05/2014
I get acc.Data_pedido_AR__c = 19/05/2014

Why?
Hi All,

I have a Visualforce page and i am rerendering a output panel onchange event of inputfield usng action function.

it works fine within SF APP .(/apex/pagename).

But if i do the same operation in a Force.com Site, it is not working. The Action Status is displaying both the start and stop text. but i am not getting the desired output.

this looks very strange.

can some1 pl help me.. ? its v urgent .. 
is there any limit for Passing parameters from visualforce controller to apex method??
  • May 20, 2014
  • Like
  • 1
when i created Apex class and Triggers along with meta data also creted, why it is created, how it can be usefull ?

Thnaks
Siva
  • May 19, 2014
  • Like
  • 1

Hello, 

 

I have Custom_Object__c with:

  1. Org-Wide Default Settings as: Private
  2. Object Permissions in the user Profile: Create, Read, Edit, Delete.

I have a small development in Apex that is creating some apex managed sharing rules, to give certain users access to records they don't own. So far I only needed to give the users either "Read" or "Edit" permissions. So all worked ok.

However, now I need to grant users delete permissions for records they don't own. Without touching profile nor org-wide default settings. This would mean creating the apex managed sharing rules with accessLevel = 'All'.

I looked into the documentation, it seems to say that it's not possible to do that. (http://www.salesforce.com/us/developer/docs/apexcode/Content/apex_bulk_sharing_understanding.htm)

All: This access level can only be granted with Force.com managed sharing.

Does anybody know a workaround to give the user delete permissions for records they don't own using apex managed sharing?

 

Thanks in advance.

tell me apex component tag support  apex tabpanel in visualforce page

 

problem is 

my tabs are not working in visualforce page when click a tab(it is not opening)

<c:mycomponent/>

 

<apex:component access="global" allowDML="true">

<style>

.activeTab {background-color: #236FBD; color:white; background-image:none}
.inactiveTab { background-color: lightgrey; color:black; background-image:none}

</style>


<apex:tabPanel switchType="client" tabClass="activeTab" inactiveTabClass="inactiveTab" width="10%" >
<apex:tab label="Depts">
<br/>
<br/>
<div align="right">
<apex:outputLink >Add Department</apex:outputLink>
</div>
</apex:tab>
<apex:tab label="Posts"><apex:outputLink >Add Department</apex:outputLink></apex:tab>
<apex:tab label="Sections" ></apex:tab>
<apex:tab label="Leave Type"></apex:tab>
<apex:tab label="Stations"></apex:tab>
<apex:tab label="Contract Types"></apex:tab>
<apex:tab label="Qualification Types"></apex:tab>
<apex:tab label="TAB"></apex:tab>
</apex:tabPanel>

</apex:component>

 

 

+++++++++++++++++

 

 

<c:setup ></c:setup>

The limit in size for an attachment is 5MB, however when using an apex:inputFile controller the result of attempting to upload a file larger then that is a null object. Is there a way to detect when the file atempting to upload is larger then the limit?