• Pharaohgirl
  • NEWBIE
  • 10 Points
  • Member since 2015

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

I'm trying to create a page that allows users to add new records for a custom object with master-detail relationships.

Project_team__c is the parent and Contact__c and Rule_closeout_report__c are child objects (via master-detail).

The page I've created allows me to add information and save a new record, but the "Contact name" and "Rule closeout report" fields do not appear as lookup - they just allow the user to enter free text.

Provided the text is entered correctly, it works perfectly. But I want these fields to show as lookup fields. Could you please help me make this work?
 
<apex:page standardController="Project_team__c"  standardStylesheets="false" 
           applyBodyTag="false" applyHtmlTag="false" showHeader="false" sidebar="false" cache="true"  > 
	<apex:form>
		<html>
      		<body>

<style>
.buttons{background-color:#7D4082;background-image:none;color:#FFFFFF;font-weight:bold;font-size:120%;}          
   
.basictable, td {border-collapse: collapse; padding-right: 15px; font-size:90%; padding-top: 10px; padding-bottom: 10px; font-family:"Helvetica",sans-serif; } 
    
</style>          
                
			<apex:pageBlock title="Add project team members to your close-out report">
          
         			<table class=".basictable" >
                   	<tr>
                    <td><strong><apex:outputLabel value="Contact name:"></apex:outputLabel></strong></td>
                    <td><apex:inputField label="" style="width: 85%; height: 25px" value="{!Project_team__c.Contact__c}"></apex:inputField></td>
                    <td><strong><apex:outputLabel value="Role:"></apex:outputLabel></strong></td>
                    <td><apex:inputField label="" style="width: 85%; height: 25px" value="{!Project_team__c.Role__c}"></apex:inputField></td>
              		<td><strong><apex:outputLabel value="Notes:"></apex:outputLabel></strong></td>
                    <td><apex:inputField label="" style="width: 85%; height: 25px" value="{!Project_team__c.Notes__c}"></apex:inputField></td>
					<td><strong><apex:outputLabel value="Project number:"></apex:outputLabel></strong></td>
                    <td><apex:inputField label="" style="width: 85%; height: 25px" value="{!Project_team__c.Rule_closeout_report__c}"></apex:inputField></td>
                    </tr>
          			</table>
      
       		</apex:pageBlock>	 
     
            <br></br>
          	<div align="left" draggable="false" >
			<apex:commandButton styleClass="buttons" id="savenewteammember" value="Add new team member" action="{!save}" style="height:35px;width:18%;" />
        	</div>
			<br></br>          
                                                          
      		</body>
		</html>
	</apex:form>
</apex:page>

 

This is how it currently appears:

How it currently appears on screen

I need to define an automatic fixed sort order for a table in a Visualforce page without using javascript (so no Tablesorter) as I need to use renderasPDF.

My main custom object is Rulecloseout__c.

Then I have Project_team__c which is connected via a Master-Detail relationship to Rulecloseout__c [field name Rule_closeout_report__c] and Contact [field name Contact__c].

This is the code I currently have on my Visualforce page, which shows the fields I want, but doesn’t sort the table. I want to sort by the Role__c field.
 
<br></br><apex:pageBlockSection title="Project team"> </apex:pageBlockSection>
<apex:pageblocktable style="width:720px" border="1" cellpadding="4" value="{!Rulecloseout__c.Project_teamsrel__r}" id="projectteam" var="rcpt" >
    <apex:column style="width:150px" value="{!rcpt.Contact__r.Full_Name__c}" />
    <apex:column style="width:200px" value="{!rcpt.Role__c}" />
    <apex:column style="width:370px" value="{!rcpt.Notes__c}" />
</apex:pageblocktable>

I have tried making a controller extension to sort the table, but haven’t got very far. I’m not even sure if I’ve got the right object in my extension, or if it should be Project_team__c.

And I’m also getting an error message: Missing “ at ‘select’
 
public with sharing class TableOrder {
    private final Rulecloseout__c ruco;
    public TableOrder(ApexPages.StandardController stdController) {
        this.ruco = (Rulecloseout__c)stdController.getRecord();}
} select Contact__c from Project_team__c ORDER BY Role__c ASC
}
}

Could anyone please point me in the right direction?
 
Thanks,

Rowena
 

Hi everyone,

I am very new to Apex (as in completed the introductory Apex Trailhead badge a few days ago), so apologies if I say anything stupid or that doesn't make sense.

I have a custom object called Rulecloseout__c and a second custom object called Rule_change_milestone__c which has a lookup relationship to Rulecloseout__c.

There will be multiple milestones for each rulecloseout.

Each milestone has a status, and I want to update the parent Rulecloseout's status based on these (and every time they're edited).

So if all child milestones for a rulecloseout record are updated to be either Completed or No longer required (picklist values), then I want the Rulecloseout status to automatically be updated to Completed.

I've done quite a bit of reading, and the only possible solution I can find is an Apex trigger rollup summary of all the child milestone statuses on the Rulecloseout, and then a formula field for the status using the contains function.

1) Will this work?

2) Could someone please help me with what I need to put in the Apex Trigger?

You probably think I'm trying to run before I can walk, which is true! But I am going to go away and do the Trailhead units on Apex Triggers in the meantime.

Thanks in advance for your help.

Rowena

I have a visualforce page with javascript (tablesorter).

It's vital that I specify the sort order for several tables in the PDF output - it can't be a random order which is what happens without tablesorter.

I know that renderAs="PDF" ignores javascript, so is there any alternate method to export to PDF?

Even just loading the visualforce page from the object and then a manual 'save as PDF' doesn't work, because there's no way to hide the Salesforce header in Lightning.

Any suggestions?

Thanks!

Rowena
Hello,

I'm trying to create a page that allows users to add new records for a custom object with master-detail relationships.

Project_team__c is the parent and Contact__c and Rule_closeout_report__c are child objects (via master-detail).

The page I've created allows me to add information and save a new record, but the "Contact name" and "Rule closeout report" fields do not appear as lookup - they just allow the user to enter free text.

Provided the text is entered correctly, it works perfectly. But I want these fields to show as lookup fields. Could you please help me make this work?
 
<apex:page standardController="Project_team__c"  standardStylesheets="false" 
           applyBodyTag="false" applyHtmlTag="false" showHeader="false" sidebar="false" cache="true"  > 
	<apex:form>
		<html>
      		<body>

<style>
.buttons{background-color:#7D4082;background-image:none;color:#FFFFFF;font-weight:bold;font-size:120%;}          
   
.basictable, td {border-collapse: collapse; padding-right: 15px; font-size:90%; padding-top: 10px; padding-bottom: 10px; font-family:"Helvetica",sans-serif; } 
    
</style>          
                
			<apex:pageBlock title="Add project team members to your close-out report">
          
         			<table class=".basictable" >
                   	<tr>
                    <td><strong><apex:outputLabel value="Contact name:"></apex:outputLabel></strong></td>
                    <td><apex:inputField label="" style="width: 85%; height: 25px" value="{!Project_team__c.Contact__c}"></apex:inputField></td>
                    <td><strong><apex:outputLabel value="Role:"></apex:outputLabel></strong></td>
                    <td><apex:inputField label="" style="width: 85%; height: 25px" value="{!Project_team__c.Role__c}"></apex:inputField></td>
              		<td><strong><apex:outputLabel value="Notes:"></apex:outputLabel></strong></td>
                    <td><apex:inputField label="" style="width: 85%; height: 25px" value="{!Project_team__c.Notes__c}"></apex:inputField></td>
					<td><strong><apex:outputLabel value="Project number:"></apex:outputLabel></strong></td>
                    <td><apex:inputField label="" style="width: 85%; height: 25px" value="{!Project_team__c.Rule_closeout_report__c}"></apex:inputField></td>
                    </tr>
          			</table>
      
       		</apex:pageBlock>	 
     
            <br></br>
          	<div align="left" draggable="false" >
			<apex:commandButton styleClass="buttons" id="savenewteammember" value="Add new team member" action="{!save}" style="height:35px;width:18%;" />
        	</div>
			<br></br>          
                                                          
      		</body>
		</html>
	</apex:form>
</apex:page>

 

This is how it currently appears:

How it currently appears on screen

I have a visualforce page with javascript (tablesorter).

It's vital that I specify the sort order for several tables in the PDF output - it can't be a random order which is what happens without tablesorter.

I know that renderAs="PDF" ignores javascript, so is there any alternate method to export to PDF?

Even just loading the visualforce page from the object and then a manual 'save as PDF' doesn't work, because there's no way to hide the Salesforce header in Lightning.

Any suggestions?

Thanks!

Rowena