• MikeGinou
  • NEWBIE
  • 75 Points
  • Member since 2009
  • Senior Consultant
  • Cloudware Connections

  • Chatter
    Feed
  • 3
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 3
    Questions
  • 16
    Replies

I'm developing an application that contains multiple custom objects whose records function as more or less static data that is looked up in another custom object by the user.

 

I'm talking accounts, currencies etc except there are around 10 custom objects in all.

 

I want to have a single page that lets me select the custom object type from a drop down and display something similar to the default controller's list view.

 

So far, I've just been showing and hiding blocks of html to achieve this result but it's not really an ideal way of doing this in terms of code reuse. Is there any more generic way I can display info about multiple custom objects on a single page?

Hi all,

 

I have two custom objects questions and answers. Answers object has a lookup to questions object.

I am displaying a question name and the answers related to that question as radio buttons  in a row of a datatable.

 

I am using the following code for that

<apex:dataTable value="{!surveyListPage}" var="surveyqns" cellpadding="10">
              
              <apex:column rendered="{!ISNULL(surveyqns.question.Question_Name__c)}">
                   <apex:outputText value="{!surveyqns.question.Question_Number__c}"/>
                   &nbsp;&nbsp;&nbsp;&nbsp;
                  <apex:outputText value="{!surveyqns.question.Name}"/>
              </apex:column>
              <apex:column rendered="{!NOT(ISNULL(surveyqns.question.Question_Name__c))}">
                  <apex:outputText value="{!surveyqns.question.Question_Number__c}"/>
                   &nbsp;&nbsp;&nbsp;&nbsp;
                  <apex:outputText value="{!surveyqns.question.Question_Name__c}"/>
              </apex:column>    
              <apex:column breakBefore="true" rendered="{!surveyqns.question.Type__c == 'Radio'}">
                  <apex:selectRadio value="{!surveyqns.response.Response_Text__c}"
                  rendered="{!surveyqns.question.Type__c == 'Radio'}">
                            <apex:selectOptions value="{!surveyqns.ansop}"/>
                        </apex:selectRadio>
              </apex:column>
              <apex:column >
                  <apex:inputField value="{!surveyqns.response.Response_Number__c}" rendered="{!surveyqns.question.Type__c == 'Number'}"/>
              </apex:column>
          </apex:dataTable>

 

 

Here all the answer options are coming as radiobuttons in a single line. How do I display the answer options one below the other?

 

Any suggestion will be helpful

 

Thanks

Arvind

 

 

What is wrong with my statement:

 

{!IF(metricname=='Overall',saname==null,'<apex:outputText value={!saname}/>' )}

 

 

Thanks

eTechCareers

When a previously closed case is re-opened, we would like the case to get pushed to the existing case owner in the same way a new case does. They key here is getting a notification through Omni-Channel so that the agent doesn't have to remember to go back to their personal queue and check for re-opened cases.

Simply re-opening a case does not invoke a notification. Changing the owner to a non-omnichannel queue and then re-assigning back to the original owner does not invoke a notification either. Re-opening the case and assigning to an omni-channel queue does cause a notification....however, we want the case to stay with the currently assigned owner/agent, not to get re-assigned.

We are happy to use any combination of workflow and apex to invoke the notification.

Is this an Apex bug, documented limitation, or am I just crazy to think that the following should be possible?

 

Here is a simple example demonstrating an example of attempting to call an overridden implementation of a protected method from a superclass. I've set the example as three separate class files:

 

Parent Class:

 

public virtual class TestParent {
	  private string data = 'Parent Data';
	
	  protected virtual string getData() {
	    return this.data;
	  }
	
	  public string getText()
	  { // This is where the Overwritten child method gets called!
	    return 'Data : ' + this.getData();
	  }
}

Child Class:

 

public class TestChild extends TestParent {
	private string myData = 'Child Data';

	protected override string getData() {
		return super.getData() + ' and ' + myData;
	}
}

 Test Class:

 

@isTest
private class inheritancetest {
	static testmethod void testUseChild()
	{
		try {
			TestChild c = new TestChild();
			c.getText();
		} catch (Exception e) {
			System.Assert( false, 'Exception! ' + e.getMessage() );
		}
	}
	
	static testmethod void testUseParent()
	{
		try {
			TestParent p = new TestChild();
			p.getText();
		} catch (Exception e) {
			System.Assert( false, 'Exception! ' + e.getMessage() );
		}
	}
}

 

I was expecting the test methods to pass without any issues, instead they fail because "[TestChild].getData() is not accessible", (a line number indicating Test.Parent.getText()'s code statement is provided).

 

 

 

 

 

I am trying to use a Custom Label as the default value for a string attribute in an Apex Component, however it doesn't appear to work.

 

Given the a custom label Default_Title with a value of "Default Title" and the following component:

 

 

<apex:component>
  <apex:attribute name="title" type="String" default="{!$Label.Default_Title}" description="Title" />

  <apex:outputText value="{!title}" />
</apex:component>

 

 

What you would expect to see is "Default Title", instead what I'm getting instead is "#{$Label.Default_Title}". 

 

Any advice?

 

Thanks!

We have a piece of code that has been unchanged for months that has stopped working; not entirely sure when. It's very simple:

 

<apex:outputPanel layout="none" rendered="{!showEmailLink}">

  <apex:commandlink action="{!mailToMe}" styleClass="mail_link" oncomplete="mailConfirmation()" rerender="dummyPanel">

    <apex:param name="documentId" assignTo="{!documentId}" value="{!document.Id}"/>

    <apex:image value="{!URLFOR($Resource.Singletrack, '/images/mail.gif')}" styleClass="mailto_icon" />

  </apex:commandlink>

</apex:outputPanel>

 

The problem seems to be that the mailToMe method is never called. Firebug doesn't report any script errors but also shows that there is no call being made to the server.

 

Any ideas?

I have a VF page that takes the id of an object. I want to display another listview which has a list view button on it. I want to be able to pass the original id when button is clicked. How do I do it.

 

So my VF page is accessed using /apex/myVFPage?id=0017000000OSuub

 

My VF page code looks like follows:

 

 

<apex:page Controller="myVFPageController">
<apex:listViews type="Contact"/> 
</apex:page>

 

 

On my Contacts List View, I have added a button "Do Something".

 

When the user clicks "Do Something", I want to link these contacts with the id I passed in VF page (0017000000OSuub). How do I pass this ID to the code the handles the "Do Something" button?

 

 

 

 

Hi,

I have a Visualforce page which displays some accounts after selecting a certain filter.
After selecting a filter and displaying the accounts, I want to generate a new custom object for each of the accounts displayed.
This should be done by clicking at the button as below {****THIS IS MISSING****} or if this is not possible by
clicking on one button in every row (how can I display one button per row?).

Is this possible?
I am new to Visualforce.

Note: I can not use Apex Classes due to Enterprise edition, no developer edition.

Hope anyone can give some advice.
thank you
Sabine

<apex:page standardController="Account" recordSetVar="accounts" tabStyle="Account" sidebar="true">
    <apex:form >
        <apex:pageBlock >
            <apex:pageMessages />
            <apex:pageBlock >
                <apex:panelGrid columns="2">
                    <apex:outputLabel value="View:"/>
                    <apex:selectList value="{!filterId}" size="1">
                        <apex:actionSupport event="onchange" rerender="opp_table"/>
                        <apex:selectOptions value="{!listviewoptions}"/>
                    </apex:selectList>
                </apex:panelGrid>
            </apex:pageBlock>

            <apex:pageBlockButtons >
                <apex:commandButton value="Save" action="{!save}"/>
                <apex:commandButton value="Create Jubi" action="{****THIS IS MISSING****}"/>
               
            </apex:pageBlockButtons>
            <apex:pageBlockTable value="{!accounts}" var="account" id="acc_table">
                <apex:column headerValue="Name" value="{!account.name}"/>
                <apex:column headerValue="Status aktuelles Jubi Review">
                    <apex:inputField value="{!account.Status_1_Jubilaeums_Review__c}"/>
                </apex:column>                
                <apex:column headerValue="Consultant">
                    <apex:inputField value="{!account.Consultant_1_Jubilaeums_Review__c}"/>
                </apex:column>                
                <apex:column headerValue="Jubis 2007" value="{!account.Jubis2007__c}"/>                
                <apex:column headerValue="Jubis 2008" value="{!account.Jubis2008__c}"/>                
                <apex:column headerValue="Jubis 2009" value="{!account.Jubis2009__c}"/>
                <apex:column headerValue="Jubis 2010" value="{!account.Jubis2010__c}"/>
               
            </apex:pageBlockTable>
        </apex:pageBlock>
    </apex:form>
</apex:page>

Hi,

 

I need to have a  picklist with values for example: ( Template 1, Template 2, Template 3 ) Anytime time this pick list's selection is changed I need to place different text value in a text field corresponding to a custom field.

 

I tried with an s-control and some javascript, however I was wondering if anyone managed to do this with a visual force code?

I am working on a visualforce page and I would like to display a list of custom objects that have the current Account as their account. The layout editor for the default Account page lets me simply add this custom object as a Related List, but the custom object is not actually in the Account objects list of properties.

 

So, first I am confused about the relationship between the custom object and Account, and 2 how can I implement that Related List in visualforce in the same way that it appears in the default Account object.

 

Thanks in advance!

I'm developing an application that contains multiple custom objects whose records function as more or less static data that is looked up in another custom object by the user.

 

I'm talking accounts, currencies etc except there are around 10 custom objects in all.

 

I want to have a single page that lets me select the custom object type from a drop down and display something similar to the default controller's list view.

 

So far, I've just been showing and hiding blocks of html to achieve this result but it's not really an ideal way of doing this in terms of code reuse. Is there any more generic way I can display info about multiple custom objects on a single page?

Hi everyone.

 

I have a bit of a problem that I have been trying to get around for quite awhile now. I wrote a previous post (http://community.salesforce.com/t5/Visualforce-Development/Problem-with-Component-in-javascript/m-p/190323#M25337) about a problem I had where I was trying to get around issues with one type of workaround I tried, but have been unable to resolve that.

 

Rather than focus on my current failed attempt at getting around this I am now presenting my problem as it is, in hope that someone out there might see this from another perspective and offer some insights.

 

What I have is a visualforce page with a controller extension that runs within an iframe in a custom object's page layout (see screenshot below). What this does is allow users to edit certain properties of a related object in-line on the current page layout, without having to open each line up. This is done by the user by clicking the "QuickEdit" link for each line, and then either "Save" or "Cancel".

 

visualforce page layout component

 

When the Save link is clicked (#3 on screenshot) I always want the controller to fire up, do some logic, including saving the record obviously, but then, based on the selection in one of the picklists (#4 on screenshot) I want the return to either just refresh the list (#2 on screenshot), or redirect the parent page (#1 on screenshot) to a different location.

 

I am able to easily hardcode this to always do one of the two by setting the "rerender" or "target" properties of the commandLink (#3), but I want this to change dynamically based on the selection in (#4).

 

Now the render properties are set in the attributes of the commandLink (#2) element and are thus already set when the controller receives the request making it impossible (I think) for me to manipulate the return target from the controller, so I have been trying to use javascript to do this, without much success. I have been trying to call a javascript function on the "onChange" event of the controlling element (#4), but the javascript can only access DOM elements and thus can only change the commandLink's "target" attribute, not it's VF-specific "rerender" property.

 

I hope I managed to describe what I am dealing with, and hopefully someone has a suggestion for me that might work.

 

Best regards,

Ivar

  • June 28, 2010
  • Like
  • 0

Hi all,

 

I have two custom objects questions and answers. Answers object has a lookup to questions object.

I am displaying a question name and the answers related to that question as radio buttons  in a row of a datatable.

 

I am using the following code for that

<apex:dataTable value="{!surveyListPage}" var="surveyqns" cellpadding="10">
              
              <apex:column rendered="{!ISNULL(surveyqns.question.Question_Name__c)}">
                   <apex:outputText value="{!surveyqns.question.Question_Number__c}"/>
                   &nbsp;&nbsp;&nbsp;&nbsp;
                  <apex:outputText value="{!surveyqns.question.Name}"/>
              </apex:column>
              <apex:column rendered="{!NOT(ISNULL(surveyqns.question.Question_Name__c))}">
                  <apex:outputText value="{!surveyqns.question.Question_Number__c}"/>
                   &nbsp;&nbsp;&nbsp;&nbsp;
                  <apex:outputText value="{!surveyqns.question.Question_Name__c}"/>
              </apex:column>    
              <apex:column breakBefore="true" rendered="{!surveyqns.question.Type__c == 'Radio'}">
                  <apex:selectRadio value="{!surveyqns.response.Response_Text__c}"
                  rendered="{!surveyqns.question.Type__c == 'Radio'}">
                            <apex:selectOptions value="{!surveyqns.ansop}"/>
                        </apex:selectRadio>
              </apex:column>
              <apex:column >
                  <apex:inputField value="{!surveyqns.response.Response_Number__c}" rendered="{!surveyqns.question.Type__c == 'Number'}"/>
              </apex:column>
          </apex:dataTable>

 

 

Here all the answer options are coming as radiobuttons in a single line. How do I display the answer options one below the other?

 

Any suggestion will be helpful

 

Thanks

Arvind

 

 

Is this an Apex bug, documented limitation, or am I just crazy to think that the following should be possible?

 

Here is a simple example demonstrating an example of attempting to call an overridden implementation of a protected method from a superclass. I've set the example as three separate class files:

 

Parent Class:

 

public virtual class TestParent {
	  private string data = 'Parent Data';
	
	  protected virtual string getData() {
	    return this.data;
	  }
	
	  public string getText()
	  { // This is where the Overwritten child method gets called!
	    return 'Data : ' + this.getData();
	  }
}

Child Class:

 

public class TestChild extends TestParent {
	private string myData = 'Child Data';

	protected override string getData() {
		return super.getData() + ' and ' + myData;
	}
}

 Test Class:

 

@isTest
private class inheritancetest {
	static testmethod void testUseChild()
	{
		try {
			TestChild c = new TestChild();
			c.getText();
		} catch (Exception e) {
			System.Assert( false, 'Exception! ' + e.getMessage() );
		}
	}
	
	static testmethod void testUseParent()
	{
		try {
			TestParent p = new TestChild();
			p.getText();
		} catch (Exception e) {
			System.Assert( false, 'Exception! ' + e.getMessage() );
		}
	}
}

 

I was expecting the test methods to pass without any issues, instead they fail because "[TestChild].getData() is not accessible", (a line number indicating Test.Parent.getText()'s code statement is provided).

 

 

 

 

 

Hi,

 

I have a Visualforce page where I am displaying a multipicklist field as checkboxes.I am facing an issue with the allignment of the checkboxes in the page.I want my checkboxes to be displayed in 5 rows and 5 columns.

I have tried 2 approaches for doing this:

1) Using a wrapper class to bind the checkbox to the picklist field and then displaying them in the page by looping through a data table.

2)I also tried using the selectcheckboxes option.

 

My problem is that i get the checkbox bound to my picklist value.But the allignment is distorted(either all in same row or in 1 column).

So,i tried using a style class which will provide me the tabular display of the values in the datatable.But still this doesnt help.

Here is the javascript i used:

 

<script>

window.onload = init;

 function init() {

tables = document.getElementsByTagName("table");

for (i = 0; i < tables.length; i++) {

table = tables[i];

if (table.className == 'makeRows') {

makeRows(table,4);

}

}

}

function makeRows(table, columnCount) {

cells = table.rows[0].cells;

cellCount = cells.length;

rowCount = Math.ceil(cellCount / columnCount);

for (i = 0; i < rowCount; i++) {

table.insertRow(0);

}

for (i = 0; i < cellCount; i++) {

row = Math.floor(i / columnCount);

table.rows[row].appendChild(cells[i].cloneNode(true));

}

table.deleteRow(rowCount);

}

</script>

 

 

The datatable in my page looks like:

 

<apex:dataTable value="{!IndustryValues}" var="ind" styleClass="makeRows" >

<apex:column >

<apex:inputCheckbox value="{!ind.selected}"/>

<apex:outputText value="{!ind.induswrap}" />

</apex:column>

</apex:dataTable>

 

Please help me to find a solution to this problem.The styleclass seems to have no effect in the datatable.I am totally lost..

 

 

Thanks & Regards,

Vinny

Hi newbie here and have already read alot and researched on the topic before posting but need more help for straight forward response.

 

I've created a wizard for a custom object for creating new records.  If I dont use the wizard and use the platform I can create a new record with all the validations I made working- they appear on the field being validated. But when I create my wizard I'm not getting any validation errors next to the field, it only displays the error in field for required.

 

eg. I have a validation rule that checks a birthdate to make sure user is above 15 years old.

 

If I try to save my record I then get an error.

 

System.DmlException: Insert failed. First exception on row 0; first error: FIELD_CUSTOM_VALIDATION_EXCEPTION, You must be 15 yrs old or older.: [Birth_Date__c]

 

I appreciate any tips and suggestions for the proper approach to take.

What is wrong with my statement:

 

{!IF(metricname=='Overall',saname==null,'<apex:outputText value={!saname}/>' )}

 

 

Thanks

eTechCareers

We need to automatically generate the serial number on the “new asset” screen (i.e. asset edit), based on several parameters, including date and a function written in javascript.

 

First thought: Add something to the “save” button to do this. Problems (all “near as I can tell, based on trying it, and then googling”):

1)     Can’t modify edit screen. So can’t add javascript.

2)     If extend class and override “save” button, SFDC finds the empty fields first, and I never get called.

 

Second thought: Add a button to generate data, insert data into DOM so that it is there for the save. Problems:

1)     Still can’t modify screen.

2)     Even if I could add button, if it uses Visualforce, it will fail due to Cross site scripting restrictions.

 

Third thought: Write a new page in Visualforce. There are several minor problems:

1)     How do I fill in the account text box? $Component doesn’t seem to work.

2)     How do I set the date to be 90 days in the future for the calendar pulldown?

3)     How do I get the default calendar date into its text box right at the start?

But the major problem with #3 is that I can’t get the data saved! I’ve tried:

1)     this.save – that was fun when my extension function was save: endless loop. When I renamed my function, it said “I see no save here”.

2)     super.save – oh, right, this isn’t java.

3)     Save controller (which is passed in to initializer) as private variable "co" in the initializer, call co.save() in my save function.

4)     Upsert co.getRecords() in my save function.

 

I suppose if I knew SF better, this would be easy, but so far, it just ain’t happenin’, and any help would be appreciated.

  • April 26, 2010
  • Like
  • 0

I am trying to use a Custom Label as the default value for a string attribute in an Apex Component, however it doesn't appear to work.

 

Given the a custom label Default_Title with a value of "Default Title" and the following component:

 

 

<apex:component>
  <apex:attribute name="title" type="String" default="{!$Label.Default_Title}" description="Title" />

  <apex:outputText value="{!title}" />
</apex:component>

 

 

What you would expect to see is "Default Title", instead what I'm getting instead is "#{$Label.Default_Title}". 

 

Any advice?

 

Thanks!