• Ragava reddy
  • NEWBIE
  • 194 Points
  • Member since 2016
  • Salesforce Developer/Administrator
  • CTS


  • Chatter
    Feed
  • 6
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 31
    Replies
Hello,

I have a case tab, i want to display all the cases to the user which are created by him or team team.

How can i achieve it ?

Thansk for suggestions !
  • January 03, 2017
  • Like
  • 0
Hello,

I have a VF, conroller and the page display like below:
<apex:page standardController="Case" extensions="Controller_Extension_Class" >
    <script type="text/javascript" language="javascript">  
    function callJS(id1)
    {        
        var v1 ='';
        if(document.getElementById(id1) != null){
            v1 = document.getElementById(id1).value;
        }     
        callAF(v1); 
    }     
    </script>     
    <apex:sectionHeader title="Case Edit" subtitle="New Case"/>
    <apex:form >
        <apex:pageMessages id="IdOfErrorMessages" />
        <apex:actionFunction name="callAF" action="{!updateSubjectAndDescription}" reRender="IdOfAsset,IdOfType, IdOfSubject,IdOfDescription, IdOfErrorMessages">
            <apex:param name="AssetValue" value="" />
            <apex:param name="profileName" value="{!$Profile.Name}" />
        </apex:actionFunction>         
        <apex:pageBlock title="Case Edit" mode="detail">
            <apex:pageBlockButtons location="bottom">
                <apex:commandButton value="Save" action="{!save}"/>
                <apex:commandButton value="Cancel" action="{!cancel}"/>
            </apex:pageBlockButtons>
            
            <apex:pageBlockSection title="Case Information" columns="2" >
                <apex:inputField value="{!caseObj.CaseNumber}" />
                <apex:inputField value="{!caseObj.AccountId}" required="true"/>
                <apex:inputField value="{!caseObj.Status}" required="true"/>
                <apex:inputField id="IdOfAsset" value="{!caseObj.AssetId}" required="{!IsRequired}" rendered="{!IsRendered}" />
                <apex:pageBlockSectionItem />
            </apex:pageBlockSection>			
            <apex:pageBlockSection title="Description Information" columns="1">
                <apex:inputField id="IdOfType" value="{!caseObj.Type}" required="true"
                                 onchange="callJS('{!$Component.IdOfType}');" />
                <apex:inputField id="IdOfSubject" value="{!caseObj.Subject}"  />
                <apex:inputField id="IdOfDescription" value="{!caseObj.Description}"  />
            </apex:pageBlockSection>			
            
        </apex:pageBlock>
    </apex:form>

</apex:page>
 
public with sharing class Controller_Extension_Class {
    
    public Case caseObj {get;set;}
    public boolean IsRequired {get; set;}
    public boolean IsRendered {get; set;}
    

    public Controller_Extension_Class(ApexPages.StandardController controller){
        caseObj = (Case)controller.getRecord();
        IsRequired = false;
        IsRendered = true;  
    }
    

    public void updateSubjectAndDescription(){
        String selectedType = System.currentPageReference().getParameters().get('AssetValue');
        String profileOfUser = System.currentPageReference().getParameters().get('profileName');
        IsRequired = false;
        IsRendered = true;  
        if(profileOfUser == 'XYZ'){
            if(selectedType == 'Pick Val1'){
                IsRequired = true;
            }else if(selectedType == 'Pick Val2'){
                IsRendered = false;  
        }          
    }    
}

User-added image

Problem:
1) once if the error message is displyed on screen, then until the "accccount id " is filled, no "action" is executed.
For example, in my use case action "updateSubjectAndDescription" is never executed if a error message is added to screen.
2) similar case happens when Asset become mandatory
3) the issue occurs when "Type" is changed or "save" is clicked.

Questions:
1) I perfectly understad that, when "save" is cliked then erro message should be displyed, but i do not understad why error mesage is displyed when "Type" is changed.

thanks for suggestions
  • December 28, 2016
  • Like
  • 0
When i select the drop down the account object name filed values are display in this picklist field. will you Plz suggest how to write code & How to create VF Page ?
i have a requirement to display custom object attachments on a visualforce page with a search functioanlity(able to search by the document name) i can able to develope the visualforce page to display the attachments in a visualforce page. please help me in writing the search functionality.

below is the code 

VF page

<apex:page controller="KnowledgeBaseAttachment" showheader="false" >
<apex:form >
<apex:pageBlock >
<apex:pageBlockSection columns="2">
<apex:repeat value="{!listAttachment}" var="att">
<apex:pageBlockSectionItem >
<apex:outputLink value="{!URLFOR($Action.Attachment.Download, att.id)}" target="_blank">{!att.name}
</apex:outputLink>
</apex:pageBlockSectionItem>
</apex:repeat>
</apex:pageBlockSection>
</apex:pageBlock>
</apex:form>
</apex:page>

controller code 

public class KnowledgeBaseAttachment {
    public List<Attachment> listAttachment {get; set;}
    public KnowledgeBaseAttachment() {
        listAttachment = new List<Attachment>();
        List<aeturu__Knowlegde_Base__c> lstKnowledgeBase = [Select Id, (Select Id, Name from Attachments)
                                                            from aeturu__Knowlegde_Base__c];
        for (aeturu__Knowlegde_Base__c obj : lstKnowledgeBase) {
            listAttachment.addAll(obj.Attachments);
        }
    }
}

any help is appriciated

thanks 
sarvam
Hi,

is there a way to write a method in a controller extension which saves the new account i'm creating with the visualforce page below? The standard controller save action doesn't work so i need a method on the controller extension which saves the account

Here the visualforce page:
<apex:page standardController="Account" extensions="testcontroller123" recordSetVar="accounts">
   <apex:form >
       <apex:pageBlock >

       <apex:pageBlockSection >
       
            <apex:pageBlockSectionItem >
                <apex:outputLabel >Account Name</apex:outputLabel>
                <apex:inputField id="actName" value="{!account.name}"/>
            </apex:pageBlockSectionItem>     

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


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

Here the extension:
public class testcontroller123 {

    public Account acct;
    
    public testcontroller123(ApexPages.StandardController stdController) {
        this.acct = (Account)stdController.getRecord();
    }
    
public ApexPages.PageReference saveRecord() {
  // I can do custom logic here before I save the record.
  ApexPages.StandardController controller = new ApexPages.StandardController(acct);
  try {
    controller.save();
  }
  catch(Exception e) {
    return null;
  }
  return controller.view();
}

    

}

 
Hello,

I have a case tab, i want to display all the cases to the user which are created by him or team team.

How can i achieve it ?

Thansk for suggestions !
  • January 03, 2017
  • Like
  • 0
Hello,

I have a VF, conroller and the page display like below:
<apex:page standardController="Case" extensions="Controller_Extension_Class" >
    <script type="text/javascript" language="javascript">  
    function callJS(id1)
    {        
        var v1 ='';
        if(document.getElementById(id1) != null){
            v1 = document.getElementById(id1).value;
        }     
        callAF(v1); 
    }     
    </script>     
    <apex:sectionHeader title="Case Edit" subtitle="New Case"/>
    <apex:form >
        <apex:pageMessages id="IdOfErrorMessages" />
        <apex:actionFunction name="callAF" action="{!updateSubjectAndDescription}" reRender="IdOfAsset,IdOfType, IdOfSubject,IdOfDescription, IdOfErrorMessages">
            <apex:param name="AssetValue" value="" />
            <apex:param name="profileName" value="{!$Profile.Name}" />
        </apex:actionFunction>         
        <apex:pageBlock title="Case Edit" mode="detail">
            <apex:pageBlockButtons location="bottom">
                <apex:commandButton value="Save" action="{!save}"/>
                <apex:commandButton value="Cancel" action="{!cancel}"/>
            </apex:pageBlockButtons>
            
            <apex:pageBlockSection title="Case Information" columns="2" >
                <apex:inputField value="{!caseObj.CaseNumber}" />
                <apex:inputField value="{!caseObj.AccountId}" required="true"/>
                <apex:inputField value="{!caseObj.Status}" required="true"/>
                <apex:inputField id="IdOfAsset" value="{!caseObj.AssetId}" required="{!IsRequired}" rendered="{!IsRendered}" />
                <apex:pageBlockSectionItem />
            </apex:pageBlockSection>			
            <apex:pageBlockSection title="Description Information" columns="1">
                <apex:inputField id="IdOfType" value="{!caseObj.Type}" required="true"
                                 onchange="callJS('{!$Component.IdOfType}');" />
                <apex:inputField id="IdOfSubject" value="{!caseObj.Subject}"  />
                <apex:inputField id="IdOfDescription" value="{!caseObj.Description}"  />
            </apex:pageBlockSection>			
            
        </apex:pageBlock>
    </apex:form>

</apex:page>
 
public with sharing class Controller_Extension_Class {
    
    public Case caseObj {get;set;}
    public boolean IsRequired {get; set;}
    public boolean IsRendered {get; set;}
    

    public Controller_Extension_Class(ApexPages.StandardController controller){
        caseObj = (Case)controller.getRecord();
        IsRequired = false;
        IsRendered = true;  
    }
    

    public void updateSubjectAndDescription(){
        String selectedType = System.currentPageReference().getParameters().get('AssetValue');
        String profileOfUser = System.currentPageReference().getParameters().get('profileName');
        IsRequired = false;
        IsRendered = true;  
        if(profileOfUser == 'XYZ'){
            if(selectedType == 'Pick Val1'){
                IsRequired = true;
            }else if(selectedType == 'Pick Val2'){
                IsRendered = false;  
        }          
    }    
}

User-added image

Problem:
1) once if the error message is displyed on screen, then until the "accccount id " is filled, no "action" is executed.
For example, in my use case action "updateSubjectAndDescription" is never executed if a error message is added to screen.
2) similar case happens when Asset become mandatory
3) the issue occurs when "Type" is changed or "save" is clicked.

Questions:
1) I perfectly understad that, when "save" is cliked then erro message should be displyed, but i do not understad why error mesage is displyed when "Type" is changed.

thanks for suggestions
  • December 28, 2016
  • Like
  • 0
Hi,
   While  logged in user is creating a new user, based on the logged in user role, I want to show value in Profile picklist. Is this possible? 

Thanks in advance.
 
Hi all,

How to display a million records in a visual force page.

Thnx-Vinay
There was an unhandled exception. Please reference ID: GYGJIZQF. Error: ArgumentError. Message: bad argument (expected URI object or URI string)

I am stuck at Package an ISV app module 3 . I created already three new orgs and don´t know what else to do. Any advise
Thanks
I can't seem to control rendering a page block section . For result sets that are not empty the pageblock section remains unrendered. 
 
<apex:actionRegion > 
       <apex:selectList value="{!SelectedSubmissions}" multiselect="true">
         <apex:selectOptions value="{!SubmissionOptions}"/>
       </apex:selectList><p/>        
   <apex:commandButton value="Select Submissions" action="{!getSelectedSubmissions}" rerender="section2ba,out2a,out2b,out2ba,out2c,out2d,out3a,out3b,out8,out8h,globalMessages" status="status"/>
   </apex:actionRegion>


<apex:actionRegion >
  <apex:pageBlockSection columns="1" id="section2ba" title="* Expiring Quota Share Contract Information" showHeader="true" rendered="{!NOT(!contractQSSectionList.empty)}" > 
             <apex:outputPanel id="out2ba">
                <apex:actionstatus startText="loading...">
                    <apex:facet name="stop" >
                        <apex:outputPanel >
                            
                            <apex:dataTable style="text-align:right;" value="{!contractQSSectionList}" var="cqs" rules="all" cellpadding="5" >
                            
                                <apex:column value="{!cqs.MR_Contract__c}" headerValue="Contract"/>
                                <apex:column value="{!cqs.Name}" headerValue="Section"/> 
                                <apex:column value="{!cqs.Brokerage__c}" headerValue="Brok%"/>                                                                                               

                                                           
                            </apex:dataTable>                                 
                            
                                                    
                        </apex:outputPanel>
                    </apex:facet>
                </apex:actionstatus>
            </apex:outputPanel>

 
 </apex:pageBlockSection> 
 </apex:actionRegion>






 
When i select the drop down the account object name filed values are display in this picklist field. will you Plz suggest how to write code & How to create VF Page ?
Hi all,
I want to show the fields when a check box is check and hide the fields when the checkbox is uncheck. Below is my vfpage and extenstion class.
<apex:page standardController="Account" extensions="constructor">
<apex:form >
<apex:pageBlock Title="Account Checkbox Test">
<apex:pageBlockSection id="Selected_PBRS">
<apex:inputCheckbox value="{!account.Port__c}" id="checkedone">
<apex:actionSupport event="onchange"  rerender="Fieldrender" action="{!Fieldupdate}"/>
                </apex:inputCheckbox>
    <apex:inputText value="{!account.Score__c}"  rendered="{!field}" id="Fieldrender"/>
    <apex:inputText value="{!account.Review__c}" rendered="{!field}" />
</apex:pageBlockSection>

</apex:pageBlock>
</apex:form>
</apex:page>
public class constructor{

    public Boolean Portfolio{get; set;}
    public Boolean field {get;set;}
    public string Score {get;set;}
     public string Review {get;set;}
public constructor(ApexPages.StandardController controller) { } 
Public constructor() {
    field=true;
}

public void Fieldupdate{
     If(account.Port__c == true){
           field=false;
     }else{
            field=true;
      }
}
    
}
I have been facing the error as below.

Error: Compile Error: unexpected token: 'If' at line 13 column 5

Can anyone help me over here.
Thanks in advance.
Regrads,
mac.

 
1つのカスタムボタンに2つの動作を入れたいのですが、実現可能でしょうか。

下記2つの動作を行いたいと考えています。
1.現在開いているレコードのページを再読み込みする。(最新の状態にする)
2.レコードの項目値によって、ボタンクリック時に画面遷移の有無を決定する

当初2のみを実装する予定でしたが、画面に表示している情報が古い場合に、画面に表示されている情報を参照したため1を実装したいです。
ご教授ください。よろしくお願いします。

Kindly provide a solution to the following : 

 

Details

I as a product manager require a custom search page for my salesforce CRM account. I don’t want to use the standard search functionality for this. Here is what I want to be done:

 

    1. On the VF page, create accustom “search” button and a checkbox with the name “limit to accounts I own”
    2. I should be able to enter and search on the following fields (these are the search criteria fields):
      1. Account name(standard field)
      2. Industry (standard field)
      3. Rating(standard field)
      4. Account  region(custom field)
      5. Account priority(custom filed)
      6. Account summary(text)
    3. The search functionality should be a logical OR of all the above combinations.
    4. The correct search results should be displayed ON THE SAME PAGE only after clicking the “submit” button.Display columns should have these fields: account name, industry, rating, account priority.
    5. If the checkbox “limit to accounts I Own” is checked before clicking on search the display only those accounts where the owner=current logged in user. 

I have developed the following code:

 

<apex:page Controller="AccountSearch">
<apex:form >
 
<apex:outputPanel layout="block">
<label for="checkbox"> Limit to Account I own: </label>
<input id="checkbox" type="checkbox"/>
</apex:outputPanel>
<apex:commandButton action="{!search}" value="Search"/>
 
<apex:pageBlock mode="edit" id="block">
         <apex:pageBlockSection >
            <apex:pageBlockSectionItem >
               <apex:outputLabel for="searchText">Search Text</apex:outputLabel>
               <apex:panelGroup >
                  <apex:inputText id="searchText" value="{!searchText}"/>
                  <apex:commandButton value="Submit" action="{!search}" 
                                      rerender="block"/>
               </apex:panelGroup>
            </apex:pageBlockSectionItem>
        </apex:pageBlockSection>
 <apex:actionStatus id="status" startText="requesting..."/>
<apex:pageBlockSection title="Results" id="results" columns="1">
           <apex:pageBlockTable value="{!results}" var="a"
                               rendered="{!NOT(ISNULL(results))}">
                               
              <apex:column value="{!a.Name}"/>
              <apex:column value="{!a.Industry}"/>
              <apex:column value="{!a.Rating}"/>
              <apex:column value="{!a.Account_Region__c}"/>
              <apex:column value="{!a.Account_Priority__c}"/>
              <apex:column value="{!a.Account_Summary__c}"/>
   </apex:pageBlockTable>
   </apex:pageBlockSection>
</apex:pageBlock>
</apex:form>
</apex:page>
__________________________________________________________________________________________
 
public class AccountSearch {
 
  String searchText;
   List<Account> results;
 
public String getSearchText() {
      return searchText;
   }
 
   public void setSearchText(String s) {
      searchText = s;
   }
 
   public List<Account> getResults() {
      return results;
   }
    public PageReference search() {
    results = (List<Account>)[FIND :searchText RETURNING Account(Name, Industry, Rating, Account_Region__c, Account_Priority__c, Account_Summary__c)][0];  
        return null;
    }
 
}
Please provide the necessary modifications
  • May 27, 2013
  • Like
  • 3

Hi all,

 

I have a problem about upload file using apex:InputFile control, when i add this control (apex:InputFile) to form that uses renderer attribute, there is an error occurs:

apex:inputFile can not be used in conjunction with an action component, apex:commandButton or apex:commandLink that specifies a rerender or oncomplete attribute

 

Pls help me to solve this problem.