• Vishal Gupta
  • NEWBIE
  • 25 Points
  • Member since 2012

  • Chatter
    Feed
  • 1
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 2
    Questions
  • 18
    Replies

We have a requirement where we need to show all the custom field on a visualforce page , now what exactly is the issue that I do not know what all are the custom fields in that particular object. This is something like creating a product and giving it to the user, now whenever that user uses the functionality of this product through some button a pop appears where he has the ability to select standard and custom filed of that object. While developing this product we cannot hardcode anything. Therefore I was looking for any help so that I can show all the custom field of that particular object on my visual force page. Any help is highly appreciated.

I have a number field.  I wana put a validation that this field should start with 5 else error is given.  How to accomplish it

I have a very less idea of how to make the code coverage.So could anybody guide me through it once so that i get some idea.

 

This class is used as an extension in a VF page. I am fetching the ID of  a record and then navigating to different page on a button click passing that retrieved ID in the next page URL.

 

public class PortExt
{
String currentportfolioId;


public PortExt(ApexPages.StandardController controller)
{
currentportfolioId=ApexPages.currentPage().getParameters().get('id');
}

public Pagereference testRedirect()
{
Pagereference p=new Pagereference('/apex/saveportfolio?id='+ currentportfolioId);
p.setredirect(true);
return p;
}
}

I have a number field.  I wana put a validation that this field should start with 5 else error is given.  How to accomplish it

Hello,

 

My business requirement is "when user clicked on "New Button" on Account, then it should redirect to some other page", pls help me with the VF code for this action.

Thanks,

 

  • October 03, 2012
  • Like
  • 0

Hi,

 

I am not able to use the wrapperclass selected property in my visal force checkbox button.

 

Error: Invalid field selected for SObject User

 

<apex:pageBlockTable value="{!results}" var="t" id="theTable">
        <apex:column >
          <apex:inputCheckbox value="{!t.selected}"/>
        </apex:column>

 

public class UserWrapper 
 {   
  
 public User wuser { get; set; }   
 public boolean selected { get; set; }
 public UserWrapper(User u)    
   {        wuser = u; 
            selected = false;    
   } 

 }

 

Please suggest.

 

Thnaks.

 

 

 

Is it possible to perform multiple actions from a single custom button click? likewise, onclick of a button, the data gets saved as well as the page redirects to another link/page.

Hi ,

 

I need to pass a value when i am clicking the output link . I am using the following the code .It is not working .

 

<apex:outputPanel rendered="{!results1.size !=0 }">

  <div class="mapResults">
           <div class="sort">
                <span>{!$Label.Results}</span>

 <div id="hideMap1" style="display:none">
                 <apex:outputLink id="map2" value="javascript&colon;hidemap();" styleClass="hideMapLink">
                        <span>{!$Label.Hide_Map}</span>
                  </apex:outputLink>
                 <apex:param name="a1" value="true" assignTo="{!displayAccImage}" />
</div>

<div id="showMap1" >
                         <apex:outputLink id="map1" value="javascript&colon;showmap();resizeMap();" styleClass="showMapLink">
                                   <span>{!$Label.Show_Map}</span>
                       </apex:outputLink>
                      <apex:param name="a2" value="true" assignTo="{!displayAccImage}" />
 </div>
</div>

<div id="mapContainer" class="mapclass" style="display:none">
            <div id="map" >
             </div>
 </div>

<div >
         <div id="hideMap2" style="display:none">
                        <apex:outputLink value="javascript&colon;hidemap();" styleClass="hideMapTab">{!$Label.Hide_Map}
                                     <apex:param id="zyx" name="a3" value="false" assignTo="{!displayAccImage}" />
                        </apex:outputLink>
          </div>
         <div id="showMap2" >
                       <apex:outputLink value="javascript&colon;showmap();resizeMap();" styleClass="showMapTab">                                                   { ! $Label.Show_Map}
                       <apex:param id="xyz" name="a4" value="true" assignTo="{!displayAccImage}" />
           </apex:outputLink>
     </div>
 </div>
</div>
</apex:outputPanel>

 

My task is when i click the showmap link the value for displaAccImage set to true . when i click the hidemap link the value should be false . i want to acheive this with outputlink i dont want commandlink ..etc . All javascript methods are properly called .

 

Please help me how to acheive this .

 

Many Thanks in Advance

Prakash.N

Hello,

 

I have a VF page with some basic inputs that populates values on a custom object that is a child of the Account object.  Below is the VF page and custom controller.  My problem is that the Company Name field on the custom object should pre-populate with the Account Name from the record the VF page is initiated.  Everything seems to work fine, however, the Account Name is not coming through.  Can anyone tell me what I'm doing wrong, or not doing?  Thanks.

 

VF Page:

 

<apex:page standardController="Account" tabStyle="Account" extensions="TestController3">
   <apex:form >
    <apex:pageBlock title="Test" >
            <apex:pageBlockButtons >
                <apex:commandButton value="Save" action="{!save}" rerender="error" />
            </apex:pageBlockButtons>
            <apex:pageBlockTable value="{!test}" var="a" id="table">
                <apex:column headerValue="Company Name">
                    {!a.Company_Name_Test__c}
                </apex:column>                
                <apex:column headerValue="Input 1">
                    <apex:inputField value="{!a.Input_1__c}"/>
                </apex:column>                
                <apex:column headerValue="Input 2">
                    <apex:inputField value="{!a.Input_2__c}"/>
                </apex:column>
            </apex:pageBlockTable>
    </apex:pageBlock>
    </apex:form>
</apex:page>

 

 

Controller:

 

public class TestController3 {

public List<Test_Object__c> test {get; set;}
    private final Account acct;
    public TestController3(ApexPages.StandardController myController) {
        acct=(Account)myController.getrecord();
        test= new List<Test_Object__c>();
        Test_Object__c test2 = new Test_Object__c();
        test2.Company_Name_Test__c = acct.id;
        test.add(test2);}


    public PageReference save() {
        insert test;
        PageReference home = new PageReference('/home/home.jsp');
        home.setRedirect(true);
        return home; }

}

  • August 06, 2012
  • Like
  • 0

I want to refresh the current page after inserting values, those values should not visible after refreshing.

>>

>>

 I WANT TO DISPLAY MY OWNER FIELD ON VISUAL FORCE FIELD.

 

Example:

 

I HAVE UNIVERSITIES__C CUSTOME OBJECT OWNER IS SIVASANKAR ADMIN

 

 

I'm unable to display my woner field on the visual force page

 

<apex:inputField value=" {!Universities__c.owner} "/>

 

OR

 

<apex:outputField value="{!Universities__C.Owner}"/>

We have a requirement where we need to show all the custom field on a visualforce page , now what exactly is the issue that I do not know what all are the custom fields in that particular object. This is something like creating a product and giving it to the user, now whenever that user uses the functionality of this product through some button a pop appears where he has the ability to select standard and custom filed of that object. While developing this product we cannot hardcode anything. Therefore I was looking for any help so that I can show all the custom field of that particular object on my visual force page. Any help is highly appreciated.

i need clarity about insert before and insert after.

what happens when we use before insert and after insert

please give me clarification with an example

Hi,

       I have developed a visual force page and am tring to pagination my page but am not getting

this concept plase help me.

this is my code all contacts update

 

 

<apex:page controller="contactstoupdate" showHeader="false" sidebar="false">
<apex:form >
<apex:pageBlock rendered="{!clist}">
<apex:pageBlockTable value="{!conlist}" var="acc">
<apex:column headerValue="Contacts" >
<apex:commandLink value="{!acc.name}" action="{!condetail}">
<apex:param name="conname" value="{!acc.id}"/>
</apex:commandlink>
</apex:column>
</apex:pageBlockTable>
</apex:pageBlock>
<apex:panelGrid columns="4">
<apex:commandLink action="{!first}">First</apex:commandlink>
<apex:commandLink action="{!previous}" rendered="{!hasPrevious}">Previous</apex:commandlink>
<apex:commandLink action="{!next}" rendered="{!hasNext}">Next</apex:commandlink>
<apex:commandLink action="{!last}">Last</apex:commandlink>
</apex:panelGrid>
<apex:pageblock rendered="{!condetail}" title="Contact detail page" >
<apex:pageBlockButtons >
<apex:commandButton value="Edit" action="{!Edit}"/>
</apex:pageBlockButtons>
<apex:pageblockSection >
<apex:outputField value="{!con.lastname}"/>
<apex:outputField value="{!con.phone}"/>
<apex:outputField value="{!con.email}"/>
</apex:pageblockSection>
</apex:pageblock>
<apex:pageBlock rendered="{!conedit}">
<apex:pageblockButtons >
<apex:commandButton value="save" action="{!save}"/>
<apex:commandButton value="back" action="{!back}"/>
</apex:pageblockButtons>
<apex:pageblockSection >
<apex:inputField value="{!con.lastname}"/>
<apex:inputField value="{!con.phone}"/>
<apex:inputField value="{!con.email}"/>
</apex:pageblockSection>
</apex:pageBlock>
</apex:form>
</apex:page>

 

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

 

public class contactstoupdate
{
public boolean clist{set;get;}
public boolean condetail{set;get;}
public boolean conedit{set;get;}
//public boolean hasprevious{set;get;}
//public boolean hasnext{set;get;}
list<contact> conlist=new list<contact>();

contact con=new contact();
public contactstoupdate()
{
clist=true;
condetail=false;
conedit=false;
for(contact c:[select id,name from contact])
conlist.add(c);
system.debug('@@@@@@'+conlist);
}

public ApexPages.StandardSetController con1 {
get {
if(con1==null)
{
con1 = new ApexPages.StandardSetController(Database.getQueryLocator([Select Id, Name FROM Contact limit 100]));
// sets the number of records in each page set
con1.setPageSize(5);
}
return con1;
}
set;
}
public Boolean hasNext {
get {
return con1.getHasNext();
}
set;
}
public Boolean hasPrevious {
get {
return con1.getHasPrevious();
}
set;
}
public Integer pageNumber {
get {
return con1.getPageNumber();
}
set;
}

 

public list<contact> getconlist()
{
return conlist;
}
public void condetail()
{
clist=false;
condetail=true;
id i=Apexpages.currentpage().getparameters().get('conname');
con=[select id,lastname,phone,email from contact where id=:i];
}
public void edit()
{
conedit=true;
condetail=false;
clist=false;
}
public void back()
{
condetail=true;
conedit=false;
clist=false;
}
public void save()
{
condetail=true;
conedit=false;
clist=false;
update con;
}
public contact getcon()
{
return con;
}
public void first()
{
con1.first();
}
public void previous()
{
con1.previous();
}
public void next()
{
con1.next();
}
public void last()
{
con1.last();
}
}

 

 

 

 

Thank you.

The code below rerenders the time on the "randompanel" but it doesn't shows the new value of the case status when clicking on the Reopen case button. The random panel and the NOW function were added just to test. The action {!ReOpenCase} sets the status of the case to "reopened" and this is happening but the rerender doesn't display that value. I opened a case with salesforce about this and is escalated to tier 3.....any ideas?

 

 

<apex:outputPanel id="randompanel" >
<apex:outputtext value="{!NOW()}"/>
<apex:outputtext value="{!case.status}"></apex:outputtext>

</apex:outputPanel>
<apex:form >

<apex:commandButton action="{!ReOpenCase}" value="Reopen Case" id="ReopenCaseButton" reRender="randompanel" rendered="{!IF(case.Status == 'Resolved' || case.Status == 'Closed',true,false)}"/>


</apex:form>

 

Thanks in advance for any help on this. I have spent a lot of time trying to make it work :(

How to Create a New Case button on Case detail page when we click on that button then automatically a 
new child case should be created under that case

I have a visualforcepage which is included in a layoutpage.

Viewlayout of this object has an override with another visual force page.

 

When I  call a pagereference methode from "inline" visualforcepage an try to leave the Iframe and load current objectpage again, salesforce creates a new URL with parameter inline=1.

By this parameter, Header and Sidebar is invisible. 

 

Code:

<apex:commandlink styleClass="btn newButton" style="text-decoration: none; margin: 2px !important;" value="Click" action="{!executeAction}" target="_parent">
</apex:commandlink>
pageRef = Page.NAME;
pageRef.getParameters().put('id',OBJECT.Id);
//pageRef = new ApexPages.StandardController(OBJECT).view();

 

 Is there a possibility to avoid getting parameter inline=1?

 

I tried:

  • new parameter inline=0
  • URL as a string
  • new redirect visualforce page

 

without success...