function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
JayGravesJayGraves 

Recruiting App and Sites

Has anyone modified the "Recruiting App" to successfully use Sites for a public display of available jobs?  Ironically the tutorial for Sites development and the existing Recruiting App do not appear to be the same code base.

 

Thanks in advance, Jay

BritishBoyinDCBritishBoyinDC

I know - makes no sense - for what it's worth, I offered that feedback to SF in a focus group that held the other week...

 

Here's a very basic example of the job list working but without the search stuff working, installed in the free platform edition...

 

Here's the page I used:

 

<apex:page showheader="false" action="{!initList}" controller="PublicJobSearchController" standardStylesheets="true">
<apex:composition template="{!$Site.Template}">
<apex:define name="body">
<apex:form >
<!-- Search by Department, Location, or Keyword -->
<apex:outputText value="Department"/>
<apex:selectList value="{!viewDepartmentName}" id="departmentViews" size="1" required="true">
<apex:selectOptions value="{!DepartmentViewNames}"/>
</apex:selectList>
<apex:outputText value="Location"/>
<apex:selectList value="{!viewLocationName}" id="locationViews" size="1" required="true">
<apex:selectOptions value="{!LocationViewNames}"/>
</apex:selectList>
<br/><br/>
<apex:outputText value="Keyword"/>
<apex:inputText value="{!searchPosition}"/>
<apex:outputText value=""/>
<apex:commandButton value="Search" action="{!populatequery}" reRender="JobList" />
</apex:form>
<p>&nbsp;</p>
<!-- Search results -->
<apex:dataTable id="JobList" value="{!Position}" var="Position__c" cellspacing="4" rendered="{!NOT(ISNULL(Position))}">
<apex:column >
<apex:facet name="header">
<apex:outputText value="Position ID"/>
</apex:facet>
<!-- Position name field linked to job details page -->
<apex:outputLink value="PublicJobDetails?id={!Position__c.id}" id="theLink">{!Position__c.name}</apex:outputLink>
</apex:column>
<apex:column >
<apex:facet name="header">
<apex:outputText value="Type"/>
</apex:facet>
<apex:outputText value="{!Position__c.Type__c}"/>
</apex:column>
<apex:column >
<apex:facet name="header">
<apex:outputText value="Department"/>
</apex:facet>
<apex:outputText value="{!Position__c.Department__c}"/>
</apex:column>
<apex:column >
<apex:facet name="header">
<apex:outputText value="Location"/>
</apex:facet>
<apex:outputText value="{!Position__c.Location__c}"/>
</apex:column>
<apex:column >
<apex:facet name="header">
<apex:outputtext value="Position Open Date"/>
</apex:facet>
<apex:outputField value="{!Position__c.Open_Date__c}"/>
</apex:column>
</apex:dataTable>
</apex:define>
</apex:composition>
</apex:page>

 

 And the modified controller - I didn't really remove anything , with the idea I will at some point go back and modify it to work as it was originally intended, but it does at least work with the recruiting app, which was all I was trying to demonstrate...can't remember if I had to change the SOQl to match the fields, or if I just created the new fields to match, but you can change the final SOQL statement as required...

public class PublicJobSearchController {
Position__c[] ccts;
String searchPosition;
String positionid;
String DepartmentName = '%';
String LocationName = '%';
String likeStr = '%';
private String viewDepartmentName = 'Department';
private String viewLocationName = 'Locations';
// Department picklist for the search page
private static final List<SelectOption>
VIEW_DEPARTMENT = new SelectOption[] {
new SelectOption('0','All Departments'),
new SelectOption('Engineering','Engineering'),
new SelectOption('Finance','Finance'),
new SelectOption('IT','IT'),
new SelectOption('Sales','Sales'),
new SelectOption('Support','Support')
};
// Location picklist for search page
private static final List<SelectOption>
VIEW_LOCATION = new SelectOption[] {
new SelectOption('0','All Locations'),
new SelectOption('San Francisco, CA','San Francisco, CA'),
new SelectOption('Austin, TX','Austin, TX'),
new SelectOption('Reston','Reston'),
new SelectOption('Toronto','Toronto')
};
public List<SelectOption> getDepartmentViewNames() {
return VIEW_DEPARTMENT;
}
public List<SelectOption> getLocationViewNames() {
return VIEW_LOCATION;
}
public void setViewDepartmentName(String viewDepartmentName) {
this.viewDepartmentName = viewDepartmentName;
}
public String getViewDepartmentName() {
return viewDepartmentName;
}
public void setViewLocationName(String viewLocationName) {
this.viewLocationName = viewLocationName;
}
public String getViewLocationName() {
return viewLocationName;
}
// Page onLoad action to auto-run the job postings query
public void initList() {
query();
}
public String getSearchPosition() {
return this.searchPosition;
}
public void setSearchPosition(String search) {
this.searchPosition = search;
}
public void populateQuery() {
likeStr = '%' + searchPosition + '%';
if (viewDepartmentName != '0') DepartmentName =
viewDepartmentName;
if (viewLocationName != '0') LocationName = viewLocationName;
query();
}
// Query to return the first 100 matching positions
public PageReference query() {
ccts = [SELECT id, name, Department__c, Type__c,Location__c, Job_Description__c, Open_Date__c, Status__c FROM Position__c WHERE Department__c like :DepartmentName AND Location__c like :LocationName AND name like :likeStr
ORDER BY Name ASC LIMIT 100];
return null;
}
public Position__c[] getPosition() {
return ccts;
}
}

 


 

 

 

 

Message Edited by BritishBoyinDC on 11-15-2009 10:22 PM