• SPD
  • NEWBIE
  • 185 Points
  • Member since 2010

  • Chatter
    Feed
  • 7
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 2
    Questions
  • 44
    Replies

Hi

 

I'm creating a VisualForce email template and am using apex:outputPanel to produce a list.

 

How do I get a single row at the top of the table with column headings?

 

<apex:repeat var="line" value="{!relatedTo.OpportunityLineItems}">
            <apex:outputPanel rendered="{!line.priceBookEntry.product2.family = 'Licence, support & update cover'}" >
                     <apex:panelGrid columns="3" columnClasses="left,left,right" width="100%">

                                  <apex:outputField value="{!line.priceBookEntry.product2.name}"/>
                                  <apex:outputField value="{!line.priceBookEntry.product2.description}"/>
                                  <apex:outputField value="{!line.TotalPrice}"/>
                       </apex:panelGrid>
            </apex:outputPanel>
</apex:repeat> 

 

This gives me the list I want, but can't work out how to head up each column.

  • March 19, 2010
  • Like
  • 0

Hi,

 

I have a requirement to find the Friday of this week and then find the Friday before 13 weeks. How can I do that. To find the current friday I did the following

 

this.dateView.Pack__Start_Date__c = date.today().toStartOfWeek().addDays(6);

 

Now how can I get the 13 week before date? as there is no date subtraction function here. So please tell me how can it be done in Apex classes

  • March 17, 2010
  • Like
  • 0

HI,

 

I would like to create a button in "opportunity products" to accept a visual force page.

 

When I create a visual force page how do I associate it to come under opportunity products.

 

eg.<apex:page standardController="Opportunity">

 

Opportunity products does not come under standard controller nor custom object.

  • March 11, 2010
  • Like
  • 0

Hi I am trying to create a return to previous Page link... and I do not have id's on my link in which they stay on the same Visual Force page name but it calls another page within it...

So I am trying to do this:

 

<apex:component > <apex:outputPanel rendered="{!$CurrentPage.parameters.apex}"> <a class="detailLink" href="/apex/MagicListView">Return To Previous Page</a> </apex:outputPanel> </apex:component>

 

 

 

Hi,

 

I need to pass a parameter to my controller but it seems that this parameter is always empty when the action is executed. Any ideas?

 

 

private String attachmentToRemove;

public String getAttachmentToRemove() { return this.attachmentToRemove; }

public void setAttachmentToRemove(String el) { this.attachmentToRemove = el; }

 

public void deleteAttachment() {

System.debug('PARAM::::::::::::: ' + attachmentToRemove);

}

 From the logs: 

 

PARAM:::::::: null

 

<apex:commandLink value="Remove" title="Remove attachment" action="{!deleteAttachment}" onclick="showRemoveFileLoadingIcon('{!attachment.id}'); reRender="fileListing">

<apex:param assignTo="{!attachmentToRemove}" value="{!attachment.id}" />

</apex:commandLink>

 

it seems that the "{!attachmentToRemove}" is never called? 

 

Thanks 

 

Message Edited by lopezc on 02-18-2010 03:23 AM
  • February 18, 2010
  • Like
  • 0

Hai ,buddies i have problem with code ,that we add a add,Save buttons to a page and display the customFields any of 3 fields ex-Name,Departement from Employee and  if we click on  add  then add the new row and same as all that means i have to show the page as a Multi Add Page and above all added pages we given enter the values the all will be save in the Custom object and allso we delete the  a perticular row tha we selected using a 'action button ' .

 

 :manhappy:

Hey guys,

 

I've got a controller that has two lists:

 

newLocs (Location__c custom obj)

newCtcs (Contact obj)

 

 

I've got a VF page that allows users to create an Account, nContacts, and nLocs. But I need to relate the contacts and Locations to my account when I hit my custom save button.

 

I don't know how to modify the contents of thoses lists and THEN insert them.

 

ie: I want to modify all records in newLocs list to have the Account__c field of my newly inserted account.

 

 

Here is my controller so far:

public with sharing class accountController { public Account act {get;set;} public List<Contact> newCtcs {get;set;} public List<Location__c> newLocs {get; set;} // ... some other code // public PageReference saveStep1() { try { //Lots to do here! - First insert the account insert act; //Then insert the contacts

  //before I do this, I want to change all the AccountId fields to be act.id

insert newCtcs; //Then insert the locations

  //before I do this, I want to change all the Account__c fields to bt act.id

insert newLocs; } catch (Exception e) { ApexPages.addMessages(e); } return null; } }

 

 

 

Can someone help me out?

 

  • January 29, 2010
  • Like
  • 0

Hi...

 

I have a requirement to wrap a text inside a table cell...i have a panelgrid inside which im using repeat. inside repeat i have used a td tag where i am giving it a fixed width...but i am not able to wrap a text if it is too long..this affects the alignment in my table...can any one suggest a proper method to do it...

 

 

<apex:panelGrid >
<apex:repeat value="{!ProcessCellValuesWithoutName}" var="strCellValue">

<td width="200" align="center">

<apex:outputLabel rendered="{!(!strCellValue.renderLink)}">{!strCellValue.recValues}</apex:outputLabel>
<apex:outputLabel rendered="{!(!strCellValue.renderLink)}">&nbsp;&nbsp;&nbsp;</apex:outputLabel>

</td>

</apex:repeat>
</apex:panelGrid>

 

  • March 15, 2010
  • Like
  • 0

hi,

 

Im new to salesforce and im trying out some simple things first.

 

I am having two custom objects :- Employee__c and Department__c

 

Employee__c has a lookup for department__c.

 

What i want to do is  display all the employees associated with a particular department in one single row.(Two columns :- Departments and Employees)

 

 

for eg:- if ther are two departments:-

 

1) Sales 2)HR

 

then the page should look like:

 

Sales(under departments column)  -  xyz, pqr, etc(in employee column)   

 

For that purpose i've the following class:-

 

 

public class EmpList2
{   
   
   public List<Department__c> lstDepartment = new List<Department__c>();
  
    
    public EmpList2(ApexPages.StandardController Ctlr )
    {  
               
           
        lstDepartment = [select name,(Select Name From Employees__r) from department__c];
        system.debug('---lstdept---'+lstDepartment);
                        
    }
   
  
    public List<department__c> getListDpt()
    {
        return lstDepartment;
    }
        

}

 

 

and the following visualforce page ..

 

 

 

<apex:page standardController="Employee__c" extensions="EmpList2">
<apex:form >
<apex:sectionHeader title="Employee List" subtitle="(All Departments)"/>
<apex:pageBlock title="Employees">
<apex:pageblocktable value="{!ListDpt}" var="item1" id="pb">
<apex:column headerValue="Departments">{!item1.name}</apex:column>
<apex:column headerValue="Employees" >
      <c:myComponent record="{!item1.employees__r}"></c:myComponent>
</apex:column>
</apex:pageblocktable>
</apex:pageBlock>
</apex:form>
</apex:page>

 

 

also im trying to have my own custom component(myComponent)..i am passing the records recived(i guess that is a list....item1.employees__r)  to a custom component which is as follows :-

 

 

<apex:component >
<apex:attribute name="record" description="Create a link(outputLink)" type="Employee__c[]" ></apex:attribute>
<apex:outputLink value="/someurl">{!record) </apex:outputLink>
</apex:component>

 

when i use this code the output i am getting is 

 

department names under departments column...but i am not getting the employee names under employee column....instead i am getting their ids...but that to inside a sqaure bracket like the one below:

 

 

column 1 : department name         column 2: - [a0190000000c26QAAQ, a0190000000c2A8AAI, a0190000000c2U4AAI],

 

 

 

so please help me find a solution over it...do i need to use a seperate class for a custom component too?

 

if yes..then how am i going to pass the list to the component's controller?

 

 

Thanks in advance.  

 

 

  • January 29, 2010
  • Like
  • 0

Hi,

 

I have the following Query where I want to get latest and oldest date of entry how can I get that

 

 

Date dat= [select max(Pack__Date_of_Entry__c) from Pack__TCI__c].Pack__Date_of_Entry__c; Date dat= [select min(Pack__Date_of_Entry__c) from Pack__TCI__c].Pack__Date_of_Entry__c;

 But the aggregate function does not seem to be working on Date type

 

 

Secondly, I want to display an already generated report in a visualforce page I have developed. Is it possible if yes please tell me how...

 

 

  • March 25, 2010
  • Like
  • 0

Hi all:

   I have the following trigger which I need to update everytime a new or old update occurs:

I keep getting this error:

Compile Error: Incompatible key type String for MAP:smileyvery-happy:ecimal,Id at line 18 column 82

 

Now yes, Term is a decimal/formula field.... 

Also within my trigger I need to update a field that is a string but will update from the Term field...

Could someone shine some light on my error?? Please

 

trigger UpdateSARQ on Course (before insert, before update) {
List<Course> htoUpdte = new List<Course__c>();
Map<String, Id> rTypes = new Map<String, Id>();
Map<Decimal, Id> rTypes2 = new Map<Decimal, Id>();

for(Subject__c rType :[SELECT Id,Subject_Area__r.Name,Term__c FROM Subject__c]) {
rTypes.put(rType.Subject_Area__r.Name, rType.Id);
rTypes2.put(rType.Term__c, rType.Id);
}


Id oppRecType1 = rTypes.get('Subject_Area__r.Name');


for(Course__c ch: trigger.new)
{

if(rTypes.get('Subject_Area__r.Name')== ch.Subject__c && rTypes2.get('Term__c')== ch.Term__c){
ch.SARQ__c=rTypes.get('Id');
}

htoUpdte.add(ch);

}
}

Hi,

 

I am pretty new to Visualforce... I have the developer guide printed out in front of me trying to get my head wrapped around everything.

 

I currently have a custom controller that pulls a bunch of records from a custom object called Milestone__c based on the Opp ID of the current page.That works fine, I am just trying to get a save button to work so I/whoever can update the milestones quickly. I used the "An Approach to Inline Editting" tutorial and that works fine but now am thinking that a save button on the list would be better. Can anyone help me with this?

 

I really want to make the Status field a drop down where you can edit multiple then save. Right now it is a drop down but I can't figure out the Save function, I've tried a bunch of different approaches based on posts but have been unsuccessful.

 

VF:

 

<apex:page Controller="TestMilestones" showHeader="false" > <apex:form > <apex:pageBlock title="Milestones" > <apex:pageBlockButtons location="top"> <apex:commandButton action="{!save}" value="save" id="saveButton"/> </apex:pageBlockButtons> <apex:outputPanel id="projectList"> <table> <tr> <th style="width:25px; "> </th> <th style="width:25px; "> </th> <th style="width:150px; ">Name</th> <th style="width:68px; ">Status</th> <th style="width:30px; ">Duration</th> </tr> <apex:repeat value="{!projects}" var="p"> <tr style="height:22px"> <apex:outputPanel id="editRow" layout="none" rendered="{!p.Id == editProject.Id}"> <td><apex:commandLink action="{!cancelEdit}" rerender="projectList">Cancel</apex:commandLink></td> <td><apex:commandLink action="{!saveEdit}" rerender="projectList">Save</apex:commandLink></td> <td><apex:inputField rendered="{!p.Id == editProject.Id}" value="{!editProject.Name}"/></td> <td><apex:inputField rendered="{!p.Id == editProject.Id}" value="{!editProject.Status__c}"/></td> <td><apex:inputField rendered="{!p.Id == editProject.Id}" value="{!editProject.Duration__c}"/></td> </apex:outputPanel> <apex:outputPanel id="viewRow" layout="none" rendered="{!p.Id != editProject.Id}"> <td style="font-style:italic; font-size:10px"> <apex:commandLink action="{!del}" onclick="return confirm('Are you sure you want to delete this project?')">Del <apex:param name="delid" value="{!p.Id}"/> </apex:commandLink> </td> <td style="font-style:italic"> <apex:commandLink action="{!edit}" rerender="projectList">Edit <apex:param name="editid" value="{!p.Id}"/> </apex:commandLink> </td> <td>{!p.Name}</td> <td style="background-color:yellow"><apex:inputField id="stat" value="{!p.Status__c}" /></td> <td><CENTER>{!p.Duration__c}</CENTER></td> </apex:outputPanel> </tr> </apex:repeat> </table> <CENTER><STRONG>**Click on status to update it</STRONG></CENTER> </apex:outputPanel> </apex:pageBlock> </apex:page>

 

 Controller:

 

public class TestMilestones { public TestMilestones(ApexPages.StandardController controller) { } public Milestone__c newProject { get; set; } public Milestone__c editProject { get; set; } public TestMilestones() { newProject = new Milestone__c(); } public Milestone__c[] getProjects() { return [SELECT Name, Duration__c, Status__c FROM Milestone__c WHERE Opportunity__c = :ApexPages.currentPage().getParameters().get('id') ORDER BY CreatedDate DESC]; } public String getParam(String name) { return ApexPages.currentPage().getParameters().get(name); } public PageReference add() { try { INSERT newProject; // if successful, reset the new project for the next entry newProject = new Milestone__c(); } catch (Exception e) { ApexPages.addMessages(e); } return null; } public PageReference del() { try { String delid = getParam('delid'); Milestone__c project = [SELECT Id FROM Milestone__c WHERE ID=:delid]; DELETE project; } catch (Exception e) { ApexPages.addMessages(e); } return null; } public PageReference edit() { String editid = getParam('editid'); editProject = [SELECT Name, Duration__c, Status__c FROM Milestone__c WHERE Id=:editid]; return null; } public PageReference cancelEdit() { editProject = null; return null; } public PageReference saveEdit() { try { UPDATE editProject; editProject = null; } catch (Exception e) { ApexPages.addMessages(e); } return null; } }

 

 Any help would be greatly appreciated

 

 

I have VF page export to CSV or excel file (set content type), i expect after exporting CSV file or excel file, this will redirect to another VF page. But it do not work. So, anyone help me this, pls!

 

It my redirect code:

 

return new Pagereference('/apex/newPage');

 

 

 

 I have 10 picklists in one form, and when i run this, it run smooth. Then i create one more picklist it raise an error: Too many picklist describes: 11. has Force.com limited number of picklists display in a form is 10??????

 

all of picklist i get from different objects

Could you please help me with the class:

public class MyController {

   public String getName() {
   return 'MyController';
   }

}

There is a warning message at the first line of the class (I use Eclipse).

Does anyone have a good code sample of a Save() method that refreshes the vf page on itself?  OR can help me with my code below?

 

I have a vf form accessed via a sites page ...on save, i want to have the form insert the data and then refresh the newly created page.

 

I tried to do this via onclick action on the command:save ..but doesnt seem to work.

 

here is my current approach (not working)

 

<apex:commandButton action="{!save}" value="Calculate" onclick="back();"/>
 <script type="text/javascript">
function back()
{
window.parent.location.href='{!$Page.FAA_Compensation_Calculator}?id={!$CurrentPage.parameters.id}&txt={!$CurrentPage.parameters.txt}';
}
</script>

 

Tx!

Hi my header name goes away when I render the column but the value comes up???

 

<apex:column rendered="{!dd.TermD='9.2'}">
<apex:facet name="header">Subject Area</apex:facet>
<apex:outputText value="{!dd.Subject}"/>
</apex:column>

 

 Thanks

 

Message Edited by MMA_FORCE on 03-19-2010 11:07 AM

Hi

 

I'm creating a VisualForce email template and am using apex:outputPanel to produce a list.

 

How do I get a single row at the top of the table with column headings?

 

<apex:repeat var="line" value="{!relatedTo.OpportunityLineItems}">
            <apex:outputPanel rendered="{!line.priceBookEntry.product2.family = 'Licence, support & update cover'}" >
                     <apex:panelGrid columns="3" columnClasses="left,left,right" width="100%">

                                  <apex:outputField value="{!line.priceBookEntry.product2.name}"/>
                                  <apex:outputField value="{!line.priceBookEntry.product2.description}"/>
                                  <apex:outputField value="{!line.TotalPrice}"/>
                       </apex:panelGrid>
            </apex:outputPanel>
</apex:repeat> 

 

This gives me the list I want, but can't work out how to head up each column.

  • March 19, 2010
  • Like
  • 0

Hi...

 

I have a requirement to wrap a text inside a table cell...i have a panelgrid inside which im using repeat. inside repeat i have used a td tag where i am giving it a fixed width...but i am not able to wrap a text if it is too long..this affects the alignment in my table...can any one suggest a proper method to do it...

 

 

<apex:panelGrid >
<apex:repeat value="{!ProcessCellValuesWithoutName}" var="strCellValue">

<td width="200" align="center">

<apex:outputLabel rendered="{!(!strCellValue.renderLink)}">{!strCellValue.recValues}</apex:outputLabel>
<apex:outputLabel rendered="{!(!strCellValue.renderLink)}">&nbsp;&nbsp;&nbsp;</apex:outputLabel>

</td>

</apex:repeat>
</apex:panelGrid>

 

  • March 15, 2010
  • Like
  • 0