-
ChatterFeed
-
1Best Answers
-
2Likes Received
-
0Likes Given
-
24Questions
-
43Replies
Complex WHERE Statement to Exclude IDs
I want to be able to create a record in Map_Customer_Notes__c with the Type__c 'Exclude' and the ID will omitted from the Map Point results. These are the two otions I've tried and can't get to work.
Thank you so much for your insight and help.
public list<Map_Point__c> getOption1()
{
points = [select ID, NAME, (SELECT ID FROM Map_Point__c.Map_Customer_Notes__r WHERE Type__c = 'Exclude') FROM Map_Point__c WHERE ID NOT IN (SELECT ID FROM Map_Point__c.Map_Customer_Notes__r WHERE Type__c = 'Exclude')];
return points;
}
public List<Map_Point__c> getOption2() {
List<Id> ExcludeIDs = new List<Id>();
for (Summary sum : [SELECT ID FROM Map_Point__c.Map_Customer_Notes__r WHERE Type__c = 'Exclude']) {
ExcludeIDs.add(sum.excludeid);
}
List<Map_Point__c> points = [SELECT Id, Name FROM Map_Point__c WHERE ID NOT IN :ExcludeIDs];
return points;
}
-
- jls_74_tx
- November 24, 2021
- Like
- 0
- Continue reading or reply
Insert records from wrapper class
CONTROLLER:
public class ApartmentMapLister {
public Map_Lead__c MapLead {get;set;}
public Map_Point__c MapPoint {get;set;}
public Map<Integer, Map_Point__c> ApartmentMap {get;set;}
Public List<Wrapper> Wrapperlist {get;set;}
public ApartmentMapLister() {
MapLead = [SELECT ID, NAME, First_Name__c, Last_Name__c FROM Map_Lead__c WHERE ID=:ApexPages.currentPage().getParameters().get('id')];
}
public Map<Integer, Map_Point__c> getonebedadmin() {
Wrapperlist = new List<Wrapper>();
ApartmentMap = new Map<Integer, Map_Point__c>();
List<Map_Point__c> ApartmentList = [SELECT Id, Name, IsSelected__c FROM Map_Point__c Order By Name];
for(Map_Point__c mp: ApartmentMap.values()) {
Wrapper wrap = new Wrapper();
wrap.mappoint = mp;
Wrapperlist.add(wrap);
}
for(Integer index = 0 ; index < ApartmentList.size() ; index++) {
ApartmentMap.put(index, ApartmentList[index]);
}
return ApartmentMap;
}
public class Wrapper{
public boolean isSelected {get;set;}
public Map_Point__c mappoint {get;set;}
}
public void InsertApartment(){
for(Wrapper wr : Wrapperlist){
if(wr.mappoint.isSelected__c == true){
Map_List__c ml = new Map_List__c();
ml.Map_Lead__c=ApexPages.currentPage().getParameters().get('id');
ml.Map_Point__c=wr.mappoint.ID;
ml.Unique__c=(MapLead.NAME + wr.mappoint.AIMid__c);
insert ml;
}
}
}
public PageReference SaveRecords(){
List<Map_Point__c> records = new List<Map_Point__c>();
for(Map_Point__c df : ApartmentMap.values()) {
records.add(df);
}
// Bulk update with one DML call
update records;
return null;
}
}
VISUALFORCE PAGE:
<apex:page sidebar="false" showHeader="false" cache="true" id="page" docType="HTML" readOnly="false" controller="ApartmentMapLister">
<apex:form >
{!MapLead.First_Name__c} {!MapLead.Last_Name__c}
<apex:pageBlock >
<apex:pageBlockButtons location="top">
<apex:commandButton value="Save" action="{!InsertApartment}"/>
</apex:pageBlockButtons>
<apex:pageBlockTable value="{!onebedadmin}" var="Map_Point__c">
<apex:column >
<apex:inputField value="{!onebedadmin[Map_Point__c].IsSelected__c}"/>
</apex:column>
<apex:column >
<apex:inputField value="{!onebedadmin[Map_Point__c].Name}"/>
</apex:column>
</apex:pageBlockTable>
</apex:pageBlock>
</apex:form>
</apex:page>
-
- jls_74_tx
- October 31, 2021
- Like
- 0
- Continue reading or reply
Wrapper Class Dynamic Record ID
Thank you in advance for you help!
public class DataListingController {
public String CID;
public List<Wrapper> Wrapperlist {get;set;}
public DataListingController(){
CID = ApexPages.currentPage().getParameters().get('id');
//Fetch Referrals
List<Data_Feed__c> dfList = new List<Data_Feed__c>();
Wrapperlist = new List<Wrapper>();
dfList = [SELECT ID, NAME, Rental__r.NAME, Data_Client__r.ID FROM Data_Feed__c WHERE Data_Client__c=:CID ORDER BY Rental__r.NAME];
if(!dfList.isEmpty()){
for(Data_Feed__c df: dfList) {
Wrapper wrap = new Wrapper();
wrap.isSelected = FALSE;
wrap.dfeedObj = df;
Wrapperlist.add(wrap);
}
}
}
/* Insert Apartment functionality based on selected records
*/
public void InsertApartment(){
for(Wrapper wr : Wrapperlist){
if(wr.isSelected = true){
Data_Listing__c dl = new Data_Listing__c();
dl.Data_List__c='a0g55000000S7Cs';
dl.Data_Feed__c='a0m55000001Ihno';
insert dl;
}
}
}
/* Wrapper class with checkbox and Apartment object.
this is also called as inner class
*/
public class Wrapper{
public boolean isSelected {get;set;}
public Data_Feed__c dfeedObj {get;set;}
public Data_List__c dlistObj {get;set;}
}
}
-
- jls_74_tx
- March 18, 2019
- Like
- 0
- Continue reading or reply
Issues with Development Mode Footer?
Chrome Developer Tools says:
edit_area_loader.js?sfdcVersion=1366068272000:664 [Deprecation] Synchronous XMLHttpRequest on the main thread is deprecated because of its detrimental effects to the end user's experience. For more help, check https://xhr.spec.whatwg.org/.
When I inspect the element I receive:
get_template : function(){
if(this.template=="")
{
var xhr_object = null;
if(window.XMLHttpRequest) // Firefox
xhr_object = new XMLHttpRequest();
else if(window.ActiveXObject) // Internet Explorer
xhr_object = new ActiveXObject("Microsoft.XMLHTTP");
else { // XMLHttpRequest not supported
alert("XMLHTTPRequest not supported. EditArea not loaded");
return;
}
xhr_object.open("GET", this.baseURL+"template.html", false);
xhr_object.send(null);
if(xhr_object.readyState == 4)
this.template=xhr_object.responseText;
else
this.has_error();
}
},
I can actually see my code in the top .25cm of the footer window but I cannot get it to display correctly (re-open/close/developer mode on/developer mode off) I've tried everything.
Anyone have a workaround?
-
- jls_74_tx
- August 15, 2017
- Like
- 0
- Continue reading or reply
OnClick JavaScript - Multiple Rows - Single Child Record each Row
I have a parent object floor_plan__c. I am trying to create a list button that will allow me to select multiple rows, and when clicked will create one child record on a custom object list__c for each of the floor_plan__c rows I have selected. The list__c object only requires two fields to be passed on: floor_plan__c.ID and floor_plan__c.renterID__c.
Problem #1: I can get the code below to work if I hard code the ID numbers. I don't know how to write a var statement to capture them dynamically.
Problem #2: No matter how many rows I click, only one child record is created for the first row I select.
I'm pretty sure this has something to do with an array? HELP!
Thank you in advance!
Jodi
{!REQUIRESCRIPT("/soap/ajax/33.0/connection.js")}
//identify parent record
var floorplan = {!GETRECORDIDS($ObjectType.Floor_Plan__c)};
floorplan.id = "{!Floor_Plan__c.Id}";
floorplan.renter = "{!Floor_Plan__c.RenterID__c}";
//insert LIST Record
var list = new sforce.SObject("List__c");
list.Floor_Plan__c = floorplan.id;
list.Renter__c = floorplan.renter;
result = sforce.connection.create([list]);
var NewListID = result[0].id;
alert(NewListID);
-
- jls_74_tx
- February 11, 2017
- Like
- 0
- Continue reading or reply
Facebook Open Graph Tags Meta og:image
- applyBodyTag true and false
- applyHtmlTag true and false
- contentType text/html
- docType html-5.0
<apex:page sidebar="false" showHeader="false" cache="false" standardController="Locator_Friendly__c" id="profile">
<html>
<head>
<meta property="og:image" content="http://locatormls.com/staticfiles/misc/metadata_facebook.jpg" />
<meta property="og:image:width" content="1300" />
<meta property="og:image:height" content="650" />
<meta property="og:title" content="Check out my professional profile on LocatorFriendly.com" />
<meta property="og:site_name" content="Locator Friendly Professional Profiles"/>
<meta property="og:url" content="http://www.locatorfriendly.com" />
<meta property="og:description" content="A marketplace to promote apartment locators and apartment communities who demonstrate integrity, performance, and trust. LocatorFriendly.com celebrates role models in the industry by publishing professional reviews that reflect marketplace behavior." />
<meta property="og:type" content="profile" />
<meta property="article:author" content="https://www.facebook.com/jodisouthwick" />
<meta property="article:publisher" content="https://www.facebook.com/locatorfriendly" />
</head>
<body>
<apex:form >
<p style="text-align: center;">
<apex:image url="http://www.locatormls.com/staticfiles/misc/locatorfriendlylogo.png"/>
</p>
</apex:form>
</body>
</html>
</apex:page>
Depending on the variations of the <apex:page> tags I have tried, the Object Debugger error messages include:
- Object at URL 'http://aim.force.com/locatorfriendly/test?ID=a0lF00000064g36' of type 'website' is invalid because a required property 'og:title' of type 'string' was not provided.
- Your page has meta tags in the body instead of the head. This may be because your HTML was malformed and they fell lower in the parse tree. Please fix this in order for the tags to be usable. (I do not have tags in the body)
- The 'og:url' property should be explicitly provided, even if a value can be inferred from other tags.
- The 'og:title' property should be explicitly provided, even if a value can be inferred from other tags.
- The 'og:image' property should be explicitly provided, even if a value can be inferred from other tags.
<apex:page sidebar="false" showHeader="false" cache="false" standardController="Locator_Friendly__c" id="profile" applyBodyTag="false" applyHtmlTag="false" contentType="text/html" docType="html-5.0" >
It pulls the meta data directly from my home page http://locatorfriendly.com - which I guess would work, but not my objective. I have searched the internet for articles about this and can't find any documentation specifically about VisualForce pages.
Has anyone had success passing Open Graph tags to Facebook from a Sites.com page?
Thank you in advance for your help!
-
- jls_74_tx
- November 04, 2015
- Like
- 0
- Continue reading or reply
Add the parent object to a wrapper class
__________________________________________________
public class ApartmentDeleteWrapperCLs{
public ClientDetails__c CID {get; set;}
public Referral__c Ref {get; set;}
public List<ApartmentRecordCls> accWrapperRecordList {get;set;}
public ApartmentDeleteWrapperCLs(){
//Fetch Referrals
List<Referral__c> accList= new List<Referral__c>();
accWrapperRecordList = new List<ApartmentRecordCls>();
accList = [select id, Apartment__r.Complex_Name__c, Apartment__r.Warning_Image__c, Apartment__r.Phone__c, Apartment__r.Year_Built__c,
Apartment__r.Submarket__r.Name, Apartment__r.Address__c, Apartment__r.City__c, Apartment__r.State__c, Apartment__r.Zip_Code__c,Apartment__r.Commission_Bonus__c,
Unit__r.Bedrooms__c, Unit__r.Bathrooms__c, Unit__r.Layout__c, Unit__r.Square_Feet__c, Unit__r.Rent__c, Unit__r.CR_6M_Final__c,
Unit__r.CR_6M_Final_Percent__c, Unit__r.CR_12M_Final__c, Unit__r.CR_12M_Final_Percent__c, Unit__r.Status__c,
ClientDetails__r.ID, ClientDetails__r.Referring_Locator__r.ID, ClientDetails__r.First_Name__c
from Referral__c WHERE ClientDetails__c = :CID];
//For loop to set data
if(!accList.isEmpty()) {
for(Referral__c acc: accList){
ApartmentRecordCls arcls = new ApartmentRecordCls();
arcls.isSelected = false;
arcls.accObj = acc;
accWrapperRecordList.add(arcls);
} //end of for loop.
} //end of if condition.
}
/*
Delete Apartment functionality based on the selected records.
*/
public PageReference DeleteApartment(){
List<Referral__c> accToDelete = new List<Referral__c>();
//To hold the unselected Apartment records.
List<ApartmentRecordCls> listUnSelectedRecords = new List<ApartmentRecordCls>();
if(accWrapperRecordList !=null && accWrapperRecordList.size()>0) {
for(ApartmentRecordCls wrapObj : accWrapperRecordList){
if(wrapObj.isSelected == true){
accToDelete.add(wrapObj.accObj);
}else{
listUnSelectedRecords.add(wrapObj);
}
}//end of for.
/*
checking the delete list size and assign the unselected values to
original wrapper list.
*/
if(accToDelete !=null && accToDelete.size()>0){
delete accToDelete;
accWrapperRecordList.clear();
accWrapperRecordList.addAll(listUnSelectedRecords);
}
}else{
ApexPages.Message myMsg = new ApexPages.Message(ApexPages.Severity.info, 'Records were not there to delete.');
ApexPages.addMessage(myMsg);
}
return null;
}
/* Wrapper class with checkbox and Apartment object.
this is also called as inner class
*/
public class ApartmentRecordCls{
public boolean isSelected {get;set;}
public Referral__c accObj {get;set;}
}
}
-
- jls_74_tx
- August 08, 2015
- Like
- 2
- Continue reading or reply
Test class for my first wrapper
---------------------------------------------------
public class ApartmentDeleteWrapperCLs{
public List<ApartmentRecordCls> accWrapperRecordList {get;set;}
public ApartmentDeleteWrapperCLs(){
List<Referral__c> accList= new List<Referral__c>();
accWrapperRecordList = new List<ApartmentRecordCls>();
accList = [select id, Apartment__r.Complex_Name__c, Apartment__r.Warning_Image__c, Apartment__r.Phone__c, Apartment__r.Year_Built__c,
Apartment__r.Submarket__r.Name, Apartment__r.Address__c, Apartment__r.City__c, Apartment__r.State__c, Apartment__r.Zip_Code__c,
ClientDetails__r.ID, ClientDetails__r.Referring_Locator__r.ID, Unit__r.Bedrooms__c, Unit__r.Bathrooms__c, Unit__r.Layout__c, Unit__r.Square_Feet__c,
Unit__r.Rent__c, Unit__r.CR_6M_Final__c, Unit__r.CR_6M_Final_Percent__c, Unit__r.CR_12M_Final__c, Unit__r.CR_12M_Final_Percent__c,
Apartment__r.Commission_Bonus__c, Unit__r.Status__c
from Referral__c];
if(!accList.isEmpty()) {
for(Referral__c acc: accList){
ApartmentRecordCls arcls = new ApartmentRecordCls();
arcls.isSelected = false;
arcls.accObj = acc;
accWrapperRecordList.add(arcls);
} //end of for loop.
} //end of if condition.
}
/*
Delete Apartment functionality based on the selected records.
*/
public PageReference DeleteApartment(){
List<Referral__c> accToDelete = new List<Referral__c>();
//To hold the unselected Apartment records.
List<ApartmentRecordCls> listUnSelectedRecords = new List<ApartmentRecordCls>();
if(accWrapperRecordList !=null && accWrapperRecordList.size()>0) {
for(ApartmentRecordCls wrapObj : accWrapperRecordList){
if(wrapObj.isSelected == true){
accToDelete.add(wrapObj.accObj);
}else{
listUnSelectedRecords.add(wrapObj);
}
}//end of for.
/*
checking the delete list size and assign the unselected values to
original wrapper list.
*/
if(accToDelete !=null && accToDelete.size()>0){
delete accToDelete;
accWrapperRecordList.clear();
accWrapperRecordList.addAll(listUnSelectedRecords);
}
}else{
ApexPages.Message myMsg = new ApexPages.Message(ApexPages.Severity.info, 'Records were not there to delete.');
ApexPages.addMessage(myMsg);
}
return null;
}
/* Wrapper class with checkbox and Apartment object.
this is also called as inner class
*/
public class ApartmentRecordCls{
public boolean isSelected {get;set;}
public Referral__c accObj {get;set;}
}
}
-
- jls_74_tx
- August 05, 2015
- Like
- 0
- Continue reading or reply
IF statement with an image
Any suggestions? The full code is below:
{!IF(apt.Star_Image__c > 0, IMAGE('http://www.locatormls.com/staticfiles/misc/{!apt.Star_Image__c}star.png', "Image"), NULL)}
<apex:pageBlock >
<apex:pageBlockTable value="{!HOUDirectory}" id="HOUdir" var="apt" columnClasses="colcenter" headerClass="header" rowClasses="row" columnsWidth="200px,80px,60px,200px,200px,200px,150px">
<apex:column style="vertical-align:top;text-align:left;font-family:trebuchet ms" headerValue="Complex Name">
{!apt.Complex_Name__c}
</apex:column>
<apex:column style="vertical-align: top;font-family:trebuchet ms" headerValue="Phone">
{!apt.Phone__c}
</apex:column>
<apex:column style="vertical-align: top;font-family:trebuchet ms" headerValue="Year Built">
{!apt.Year_Built__c}
</apex:column>
<apex:column style="vertical-align: top;font-family:trebuchet ms" headerValue="Management">
{!apt.Management_Company__r.Name}
</apex:column>
<apex:column style="vertical-align: top;font-family:trebuchet ms" headerValue="Area">
{!apt.Submarket__r.Name}
</apex:column>
<apex:column style="vertical-align: top;font-family:trebuchet ms" headerValue="Commission">
{!apt.Commission_Type__c}
</apex:column>
<apex:column style="vertical-align: top;font-family:trebuchet ms" headerValue="">
{!IF(apt.Star_Image__c > 0, IMAGE('http://www.locatormls.com/staticfiles/misc/{!apt.Star_Image__c}star.png', "Image"), NULL)}
</apex:column>
</apex:pageBlockTable>
-
- jls_74_tx
- June 26, 2015
- Like
- 0
- Continue reading or reply
Form Undefined Not Found In Document
I have several random clients who are experiencing this error. I however cannot recreate the error using any browser simulator or older machnie I have access too. Both clients I have been able to research are using I.E. 9 but I can't resolve the issue if I can't recreate the problem. Here is my code:
-
- jls_74_tx
- March 11, 2014
- Like
- 0
- Continue reading or reply
Flash Photo Gallery in VF Page
I have customized a great flash photo gallery on my server$. The images are coming from an image folder on the same server.
http://www.locatormls.com/staticfiles/flashgallery/flashgallery.html
When I move the HTML code over to a VF page I can't get the images to display. I have tried referencing the javascript and swf files by direct URL to my server and by uploading a zip file to static resources, neither worked.
I CAN use the <apex:flash> tag and it will display correctly on my VF page, but I need to reference dynamic salesforce ID numbers in my visualforce page. I have 5,000 SF records with a coresponding image folder, so I need to reference the image folder dynamically.
Is there a trick to displaying flash on a VF page?
-
- jls_74_tx
- November 12, 2013
- Like
- 0
- Continue reading or reply
Save and Redirect If No PageMessages
I'm a newbie to controllers but I compiled the following controller from various posts on the board, to use on a custom object on a force.com site. After the user clicks a command button to save the form, I want SF to check for errors (using the <apex:PageMessages /> tag) and if no errors, save the form and redirect to www.tarl.com. If there are errors, then I want the standard error messages to show and stay on the page.
The controller fails the deployment and I don't know enough about controllers to identify the problem. If someone could please help me, I would greatly appreciate it...and Kudos!
Thank you in advance!
public class SaveAndRedirectController { public ApexPages.StandardController controller; public SaveAndRedirectController(ApexPages.StandardController controller) { this.controller = controller; } public PageReference SaveAndRedirect() { try { this.controller.Save(); } catch(DmlException ex){ //this catches the errors and ensures they register on the page ApexPages.addMessages(ex); } //if there's an error message, perform a refresh // if not, redirect to google.com if (ApexPages.hasMessages()) { return null; } else { return new PageReference('http://www.tarl.com'); } } }
-
- jls_74_tx
- May 24, 2013
- Like
- 0
- Continue reading or reply
Update a text field onclick
I want to insert "yes" into a text field {!Referral__c.Viewed__c} when a user clicks an outputLink. How do I do that?
Thank you in advance!
-
- jls_74_tx
- March 29, 2013
- Like
- 0
- Continue reading or reply
1,000 Record Limit Error
I'm reading that the record limit was raised from 1,000 to 50,000 but I'm still getting an error that my results produce 3,411 records with the second select statement. What am I doing wrong?
public class referralExtension{
public Apartment__c Apt;
public ApexPages.StandardController controller {get; set;}
public List<Referral__c> referrals; public referralExtension (ApexPages.Standardcontroller c)
{
this.controller = c; Apt = (Apartment__c)Controller.getRecord();}
public Referral__c [ ] getReferralList()
{referrals = ([Select CreatedDate,Name,Actual_Move_Date__c,Apartment__c,Approximate_Move_Date__c,Client_Began_On__c,ClientDetails__c,Client_Name__c,Confirmed_By__c,Lease_Term__c,Locators_Email__c,Locators_Phone__c,NAAL_Member__c,Referring_Company__c,Referring_Locator__c,Rent__c,Reservation_Date__c,Reservation_Time__c,Unit__c,Unit_Description__c,Unit_Number__c from Referral__c Where Apartment__c = :Apt.id ORDER BY Approximate_Move_Date__c]);
return referrals;}
public Apartment__c [ ] getApartmentDirectory()
{return [Select ID,Complex_Name__c from Apartment__c Where Owner.Id = '005A0000000OJ3b'];
}
}
Thank You and Kuddos!
-
- jls_74_tx
- March 15, 2013
- Like
- 0
- Continue reading or reply
Allow Guest License to delete records
I have a force.com site page: http://aim.force.com/locatormls/apex/MLS_ClientReservation?ID=a1KF0000001Nqw0MAC
I am using the apex:relatedlist to list the invoices created by the guest user. I am using the standard salesforce Add New button which works fine. Why doesn't the standard SF delete link work? I have confirmed that permissions are granted.
How do I envoke standard SF delete action method?
-
- jls_74_tx
- March 09, 2013
- Like
- 0
- Continue reading or reply
$Action.New on Custom Object
I need to create a new child record (Email__c) with the master record ID automatically inserted via outputLink:
<apex:outputLink target="__blank" style="color:blue" value="{!URLFOR($Action.Email__c.New)}">Create New Email</apex:outputLink>
Here is the public page where the link is displayed:
http://aim.force.com/locatormls/apex/MLS_EmailEBrochureList?id=a19F0000001LuHF
I am using the standard $Action.New but not sure why the record ID isn't passed automatically. I have gone into set up and overritten the "new" functionality with my new custom page. The new page displays correctly, but the master record ID isn't displayed.
Please help!
-
- jls_74_tx
- March 06, 2013
- Like
- 0
- Continue reading or reply
Update past dates to today's date each morning
I have an object that holds over 800,000 apartment units. One date field is Available__c which tells us when that apartment unit is available. If a client enters an available date as today and that unit is still available tomorrow, I want the date to automatically update tomorrow. I don't want to run a report each morning and update the dates using the data loader.
How would I go about writing code that evaluates all dates in the Unit Object that are older than today and changing the date to today?
-
- jls_74_tx
- February 26, 2013
- Like
- 0
- Continue reading or reply
PageBlockTable Sort Controller
I'm a newbie to controllers and need some help sorting a pageblocktable.
Custom Object: Apartment__c
Related List: Unit__c
Result: Sort Units by Nickname__c
Simple VF Page:
<apex:page sidebar="false" showHeader="false" cache="false" standardController="Apartment__c" extensions="sortExtention" >
<apex:form >
<apex:pageBlock >
<apex:pageBlockTable value="{!sortExtension}" var="item">
<apex:column value="{!item.ID}" />
<apex:column value="{!item.Unit_Number__c}" />
<apex:column value="{!item.Nickname__c}" />
<apex:column value="{!item.Available__c}" />
<apex:column value="{!item.Bedrooms__c}" />
<apex:column value="{!item.Bathrooms__c}" />
</apex:pageBlockTable>
</apex:pageBlock>
</apex:form>
</apex:page>
Controller
public class sortExtension{
public Apartment__c Apt;
public ApexPages.StandardController controller {get; set;}
public List<Unit__c> units; public sortExtension (ApexPages.Standardcontroller c)
{
this.controller = c; Apt = (Apartment__c)Controller.getRecord(); }
public Unit__c [ ] getUnitList()
units = ([Select ID,Unit_Number__c,Available__c,Bathrooms__c,Bedrooms__c,Nickname__c from Unit__c Where Apartment__c.Unit__r = :TC.id ORDER BY Nickname__c]);
return units;}
ERROR: Compile Error: unexpected token: 'units' at line 9 column 7
Thank you in advance for your help!
-
- jls_74_tx
- February 16, 2013
- Like
- 0
- Continue reading or reply
Sort PageBlockTable
I'm a total newbie to writing controllers, but I would like to learn.
How do I sort a PageBlockTable? I have read several posts on here and understand I need to use the ORDER BY statement but I'm lost how to implement it in a controller.
Please Help!
-
- jls_74_tx
- February 15, 2013
- Like
- 0
- Continue reading or reply
Save and Redirect To Next Page
I created my first controller today and I can't figure out two final steps.
I created 3 public site pages for clients to update contact information. I want to Save and go to the Next page as navigation. I verified that the controller has permission on my sites.
1. I can't get the command button to show up in the production page. http://aim.force.com/apex/MLS_Step1?ID=a19F0000001HgYX
The button is visible with the page editor.
2. I tested the button in development mode and it does forward to the next page. How do I obtain the record ID so that page two forwards to: http://aim.force.com/apex/MLS_Step2?ID=apartment.id
Thank you in advance for your help and advice.
Here is my controller:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | public class Step1Controller { Apartment__c apartment; public ApexPages.StandardController controller; public Step1Controller (ApexPages.StandardController controller) { this.controller = controller; } public PageReference save() { controller.save(); PageReference nextPage = Page.MLS_Step2; nextPage.setRedirect(true); return nextPage; } } |
-
- jls_74_tx
- February 09, 2013
- Like
- 0
- Continue reading or reply
Add the parent object to a wrapper class
__________________________________________________
public class ApartmentDeleteWrapperCLs{
public ClientDetails__c CID {get; set;}
public Referral__c Ref {get; set;}
public List<ApartmentRecordCls> accWrapperRecordList {get;set;}
public ApartmentDeleteWrapperCLs(){
//Fetch Referrals
List<Referral__c> accList= new List<Referral__c>();
accWrapperRecordList = new List<ApartmentRecordCls>();
accList = [select id, Apartment__r.Complex_Name__c, Apartment__r.Warning_Image__c, Apartment__r.Phone__c, Apartment__r.Year_Built__c,
Apartment__r.Submarket__r.Name, Apartment__r.Address__c, Apartment__r.City__c, Apartment__r.State__c, Apartment__r.Zip_Code__c,Apartment__r.Commission_Bonus__c,
Unit__r.Bedrooms__c, Unit__r.Bathrooms__c, Unit__r.Layout__c, Unit__r.Square_Feet__c, Unit__r.Rent__c, Unit__r.CR_6M_Final__c,
Unit__r.CR_6M_Final_Percent__c, Unit__r.CR_12M_Final__c, Unit__r.CR_12M_Final_Percent__c, Unit__r.Status__c,
ClientDetails__r.ID, ClientDetails__r.Referring_Locator__r.ID, ClientDetails__r.First_Name__c
from Referral__c WHERE ClientDetails__c = :CID];
//For loop to set data
if(!accList.isEmpty()) {
for(Referral__c acc: accList){
ApartmentRecordCls arcls = new ApartmentRecordCls();
arcls.isSelected = false;
arcls.accObj = acc;
accWrapperRecordList.add(arcls);
} //end of for loop.
} //end of if condition.
}
/*
Delete Apartment functionality based on the selected records.
*/
public PageReference DeleteApartment(){
List<Referral__c> accToDelete = new List<Referral__c>();
//To hold the unselected Apartment records.
List<ApartmentRecordCls> listUnSelectedRecords = new List<ApartmentRecordCls>();
if(accWrapperRecordList !=null && accWrapperRecordList.size()>0) {
for(ApartmentRecordCls wrapObj : accWrapperRecordList){
if(wrapObj.isSelected == true){
accToDelete.add(wrapObj.accObj);
}else{
listUnSelectedRecords.add(wrapObj);
}
}//end of for.
/*
checking the delete list size and assign the unselected values to
original wrapper list.
*/
if(accToDelete !=null && accToDelete.size()>0){
delete accToDelete;
accWrapperRecordList.clear();
accWrapperRecordList.addAll(listUnSelectedRecords);
}
}else{
ApexPages.Message myMsg = new ApexPages.Message(ApexPages.Severity.info, 'Records were not there to delete.');
ApexPages.addMessage(myMsg);
}
return null;
}
/* Wrapper class with checkbox and Apartment object.
this is also called as inner class
*/
public class ApartmentRecordCls{
public boolean isSelected {get;set;}
public Referral__c accObj {get;set;}
}
}
-
- jls_74_tx
- August 08, 2015
- Like
- 2
- Continue reading or reply
Insert records from wrapper class
CONTROLLER:
public class ApartmentMapLister {
public Map_Lead__c MapLead {get;set;}
public Map_Point__c MapPoint {get;set;}
public Map<Integer, Map_Point__c> ApartmentMap {get;set;}
Public List<Wrapper> Wrapperlist {get;set;}
public ApartmentMapLister() {
MapLead = [SELECT ID, NAME, First_Name__c, Last_Name__c FROM Map_Lead__c WHERE ID=:ApexPages.currentPage().getParameters().get('id')];
}
public Map<Integer, Map_Point__c> getonebedadmin() {
Wrapperlist = new List<Wrapper>();
ApartmentMap = new Map<Integer, Map_Point__c>();
List<Map_Point__c> ApartmentList = [SELECT Id, Name, IsSelected__c FROM Map_Point__c Order By Name];
for(Map_Point__c mp: ApartmentMap.values()) {
Wrapper wrap = new Wrapper();
wrap.mappoint = mp;
Wrapperlist.add(wrap);
}
for(Integer index = 0 ; index < ApartmentList.size() ; index++) {
ApartmentMap.put(index, ApartmentList[index]);
}
return ApartmentMap;
}
public class Wrapper{
public boolean isSelected {get;set;}
public Map_Point__c mappoint {get;set;}
}
public void InsertApartment(){
for(Wrapper wr : Wrapperlist){
if(wr.mappoint.isSelected__c == true){
Map_List__c ml = new Map_List__c();
ml.Map_Lead__c=ApexPages.currentPage().getParameters().get('id');
ml.Map_Point__c=wr.mappoint.ID;
ml.Unique__c=(MapLead.NAME + wr.mappoint.AIMid__c);
insert ml;
}
}
}
public PageReference SaveRecords(){
List<Map_Point__c> records = new List<Map_Point__c>();
for(Map_Point__c df : ApartmentMap.values()) {
records.add(df);
}
// Bulk update with one DML call
update records;
return null;
}
}
VISUALFORCE PAGE:
<apex:page sidebar="false" showHeader="false" cache="true" id="page" docType="HTML" readOnly="false" controller="ApartmentMapLister">
<apex:form >
{!MapLead.First_Name__c} {!MapLead.Last_Name__c}
<apex:pageBlock >
<apex:pageBlockButtons location="top">
<apex:commandButton value="Save" action="{!InsertApartment}"/>
</apex:pageBlockButtons>
<apex:pageBlockTable value="{!onebedadmin}" var="Map_Point__c">
<apex:column >
<apex:inputField value="{!onebedadmin[Map_Point__c].IsSelected__c}"/>
</apex:column>
<apex:column >
<apex:inputField value="{!onebedadmin[Map_Point__c].Name}"/>
</apex:column>
</apex:pageBlockTable>
</apex:pageBlock>
</apex:form>
</apex:page>
- jls_74_tx
- October 31, 2021
- Like
- 0
- Continue reading or reply
Wrapper Class Dynamic Record ID
Thank you in advance for you help!
public class DataListingController {
public String CID;
public List<Wrapper> Wrapperlist {get;set;}
public DataListingController(){
CID = ApexPages.currentPage().getParameters().get('id');
//Fetch Referrals
List<Data_Feed__c> dfList = new List<Data_Feed__c>();
Wrapperlist = new List<Wrapper>();
dfList = [SELECT ID, NAME, Rental__r.NAME, Data_Client__r.ID FROM Data_Feed__c WHERE Data_Client__c=:CID ORDER BY Rental__r.NAME];
if(!dfList.isEmpty()){
for(Data_Feed__c df: dfList) {
Wrapper wrap = new Wrapper();
wrap.isSelected = FALSE;
wrap.dfeedObj = df;
Wrapperlist.add(wrap);
}
}
}
/* Insert Apartment functionality based on selected records
*/
public void InsertApartment(){
for(Wrapper wr : Wrapperlist){
if(wr.isSelected = true){
Data_Listing__c dl = new Data_Listing__c();
dl.Data_List__c='a0g55000000S7Cs';
dl.Data_Feed__c='a0m55000001Ihno';
insert dl;
}
}
}
/* Wrapper class with checkbox and Apartment object.
this is also called as inner class
*/
public class Wrapper{
public boolean isSelected {get;set;}
public Data_Feed__c dfeedObj {get;set;}
public Data_List__c dlistObj {get;set;}
}
}
- jls_74_tx
- March 18, 2019
- Like
- 0
- Continue reading or reply
I have a simple VF question
<apex:page standardController="Contact" > <apex:form > <apex:pageBlock title="Edit Contact"> <apex:pageBlockSection columns="1"> <apex:inputField value="{!Contact.FirstName}"/> <apex:inputField value="{!Contact.LastName}"/> <apex:inputField value="{!Contact.Email}"/> <apex:inputField value="{!Contact.Birthdate}"/> </apex:pageBlockSection> <apex:pageBlockButtons > <apex:commandButton action="{!save}" value="Save"/> </apex:pageBlockButtons> </apex:pageBlock> </apex:form> </apex:page>
- Jason Good 13
- August 15, 2017
- Like
- 0
- Continue reading or reply
OnClick JavaScript - Multiple Rows - Single Child Record each Row
I have a parent object floor_plan__c. I am trying to create a list button that will allow me to select multiple rows, and when clicked will create one child record on a custom object list__c for each of the floor_plan__c rows I have selected. The list__c object only requires two fields to be passed on: floor_plan__c.ID and floor_plan__c.renterID__c.
Problem #1: I can get the code below to work if I hard code the ID numbers. I don't know how to write a var statement to capture them dynamically.
Problem #2: No matter how many rows I click, only one child record is created for the first row I select.
I'm pretty sure this has something to do with an array? HELP!
Thank you in advance!
Jodi
{!REQUIRESCRIPT("/soap/ajax/33.0/connection.js")}
//identify parent record
var floorplan = {!GETRECORDIDS($ObjectType.Floor_Plan__c)};
floorplan.id = "{!Floor_Plan__c.Id}";
floorplan.renter = "{!Floor_Plan__c.RenterID__c}";
//insert LIST Record
var list = new sforce.SObject("List__c");
list.Floor_Plan__c = floorplan.id;
list.Renter__c = floorplan.renter;
result = sforce.connection.create([list]);
var NewListID = result[0].id;
alert(NewListID);
- jls_74_tx
- February 11, 2017
- Like
- 0
- Continue reading or reply
Facebook Open Graph Tags Meta og:image
- applyBodyTag true and false
- applyHtmlTag true and false
- contentType text/html
- docType html-5.0
<apex:page sidebar="false" showHeader="false" cache="false" standardController="Locator_Friendly__c" id="profile">
<html>
<head>
<meta property="og:image" content="http://locatormls.com/staticfiles/misc/metadata_facebook.jpg" />
<meta property="og:image:width" content="1300" />
<meta property="og:image:height" content="650" />
<meta property="og:title" content="Check out my professional profile on LocatorFriendly.com" />
<meta property="og:site_name" content="Locator Friendly Professional Profiles"/>
<meta property="og:url" content="http://www.locatorfriendly.com" />
<meta property="og:description" content="A marketplace to promote apartment locators and apartment communities who demonstrate integrity, performance, and trust. LocatorFriendly.com celebrates role models in the industry by publishing professional reviews that reflect marketplace behavior." />
<meta property="og:type" content="profile" />
<meta property="article:author" content="https://www.facebook.com/jodisouthwick" />
<meta property="article:publisher" content="https://www.facebook.com/locatorfriendly" />
</head>
<body>
<apex:form >
<p style="text-align: center;">
<apex:image url="http://www.locatormls.com/staticfiles/misc/locatorfriendlylogo.png"/>
</p>
</apex:form>
</body>
</html>
</apex:page>
Depending on the variations of the <apex:page> tags I have tried, the Object Debugger error messages include:
- Object at URL 'http://aim.force.com/locatorfriendly/test?ID=a0lF00000064g36' of type 'website' is invalid because a required property 'og:title' of type 'string' was not provided.
- Your page has meta tags in the body instead of the head. This may be because your HTML was malformed and they fell lower in the parse tree. Please fix this in order for the tags to be usable. (I do not have tags in the body)
- The 'og:url' property should be explicitly provided, even if a value can be inferred from other tags.
- The 'og:title' property should be explicitly provided, even if a value can be inferred from other tags.
- The 'og:image' property should be explicitly provided, even if a value can be inferred from other tags.
<apex:page sidebar="false" showHeader="false" cache="false" standardController="Locator_Friendly__c" id="profile" applyBodyTag="false" applyHtmlTag="false" contentType="text/html" docType="html-5.0" >
It pulls the meta data directly from my home page http://locatorfriendly.com - which I guess would work, but not my objective. I have searched the internet for articles about this and can't find any documentation specifically about VisualForce pages.
Has anyone had success passing Open Graph tags to Facebook from a Sites.com page?
Thank you in advance for your help!
- jls_74_tx
- November 04, 2015
- Like
- 0
- Continue reading or reply
Add the parent object to a wrapper class
__________________________________________________
public class ApartmentDeleteWrapperCLs{
public ClientDetails__c CID {get; set;}
public Referral__c Ref {get; set;}
public List<ApartmentRecordCls> accWrapperRecordList {get;set;}
public ApartmentDeleteWrapperCLs(){
//Fetch Referrals
List<Referral__c> accList= new List<Referral__c>();
accWrapperRecordList = new List<ApartmentRecordCls>();
accList = [select id, Apartment__r.Complex_Name__c, Apartment__r.Warning_Image__c, Apartment__r.Phone__c, Apartment__r.Year_Built__c,
Apartment__r.Submarket__r.Name, Apartment__r.Address__c, Apartment__r.City__c, Apartment__r.State__c, Apartment__r.Zip_Code__c,Apartment__r.Commission_Bonus__c,
Unit__r.Bedrooms__c, Unit__r.Bathrooms__c, Unit__r.Layout__c, Unit__r.Square_Feet__c, Unit__r.Rent__c, Unit__r.CR_6M_Final__c,
Unit__r.CR_6M_Final_Percent__c, Unit__r.CR_12M_Final__c, Unit__r.CR_12M_Final_Percent__c, Unit__r.Status__c,
ClientDetails__r.ID, ClientDetails__r.Referring_Locator__r.ID, ClientDetails__r.First_Name__c
from Referral__c WHERE ClientDetails__c = :CID];
//For loop to set data
if(!accList.isEmpty()) {
for(Referral__c acc: accList){
ApartmentRecordCls arcls = new ApartmentRecordCls();
arcls.isSelected = false;
arcls.accObj = acc;
accWrapperRecordList.add(arcls);
} //end of for loop.
} //end of if condition.
}
/*
Delete Apartment functionality based on the selected records.
*/
public PageReference DeleteApartment(){
List<Referral__c> accToDelete = new List<Referral__c>();
//To hold the unselected Apartment records.
List<ApartmentRecordCls> listUnSelectedRecords = new List<ApartmentRecordCls>();
if(accWrapperRecordList !=null && accWrapperRecordList.size()>0) {
for(ApartmentRecordCls wrapObj : accWrapperRecordList){
if(wrapObj.isSelected == true){
accToDelete.add(wrapObj.accObj);
}else{
listUnSelectedRecords.add(wrapObj);
}
}//end of for.
/*
checking the delete list size and assign the unselected values to
original wrapper list.
*/
if(accToDelete !=null && accToDelete.size()>0){
delete accToDelete;
accWrapperRecordList.clear();
accWrapperRecordList.addAll(listUnSelectedRecords);
}
}else{
ApexPages.Message myMsg = new ApexPages.Message(ApexPages.Severity.info, 'Records were not there to delete.');
ApexPages.addMessage(myMsg);
}
return null;
}
/* Wrapper class with checkbox and Apartment object.
this is also called as inner class
*/
public class ApartmentRecordCls{
public boolean isSelected {get;set;}
public Referral__c accObj {get;set;}
}
}
- jls_74_tx
- August 08, 2015
- Like
- 2
- Continue reading or reply
IF statement with an image
Any suggestions? The full code is below:
{!IF(apt.Star_Image__c > 0, IMAGE('http://www.locatormls.com/staticfiles/misc/{!apt.Star_Image__c}star.png', "Image"), NULL)}
<apex:pageBlock >
<apex:pageBlockTable value="{!HOUDirectory}" id="HOUdir" var="apt" columnClasses="colcenter" headerClass="header" rowClasses="row" columnsWidth="200px,80px,60px,200px,200px,200px,150px">
<apex:column style="vertical-align:top;text-align:left;font-family:trebuchet ms" headerValue="Complex Name">
{!apt.Complex_Name__c}
</apex:column>
<apex:column style="vertical-align: top;font-family:trebuchet ms" headerValue="Phone">
{!apt.Phone__c}
</apex:column>
<apex:column style="vertical-align: top;font-family:trebuchet ms" headerValue="Year Built">
{!apt.Year_Built__c}
</apex:column>
<apex:column style="vertical-align: top;font-family:trebuchet ms" headerValue="Management">
{!apt.Management_Company__r.Name}
</apex:column>
<apex:column style="vertical-align: top;font-family:trebuchet ms" headerValue="Area">
{!apt.Submarket__r.Name}
</apex:column>
<apex:column style="vertical-align: top;font-family:trebuchet ms" headerValue="Commission">
{!apt.Commission_Type__c}
</apex:column>
<apex:column style="vertical-align: top;font-family:trebuchet ms" headerValue="">
{!IF(apt.Star_Image__c > 0, IMAGE('http://www.locatormls.com/staticfiles/misc/{!apt.Star_Image__c}star.png', "Image"), NULL)}
</apex:column>
</apex:pageBlockTable>
- jls_74_tx
- June 26, 2015
- Like
- 0
- Continue reading or reply
Form Undefined Not Found In Document
I have several random clients who are experiencing this error. I however cannot recreate the error using any browser simulator or older machnie I have access too. Both clients I have been able to research are using I.E. 9 but I can't resolve the issue if I can't recreate the problem. Here is my code:
- jls_74_tx
- March 11, 2014
- Like
- 0
- Continue reading or reply
Save and Redirect If No PageMessages
I'm a newbie to controllers but I compiled the following controller from various posts on the board, to use on a custom object on a force.com site. After the user clicks a command button to save the form, I want SF to check for errors (using the <apex:PageMessages /> tag) and if no errors, save the form and redirect to www.tarl.com. If there are errors, then I want the standard error messages to show and stay on the page.
The controller fails the deployment and I don't know enough about controllers to identify the problem. If someone could please help me, I would greatly appreciate it...and Kudos!
Thank you in advance!
public class SaveAndRedirectController { public ApexPages.StandardController controller; public SaveAndRedirectController(ApexPages.StandardController controller) { this.controller = controller; } public PageReference SaveAndRedirect() { try { this.controller.Save(); } catch(DmlException ex){ //this catches the errors and ensures they register on the page ApexPages.addMessages(ex); } //if there's an error message, perform a refresh // if not, redirect to google.com if (ApexPages.hasMessages()) { return null; } else { return new PageReference('http://www.tarl.com'); } } }
- jls_74_tx
- May 24, 2013
- Like
- 0
- Continue reading or reply
Visualforce email template for new user template in customer portal
I am creating a visualforce email template. How do I know which object salesforce looks at when sending the "New User Template" via the customer portal? What sobjects go into
1. recipientType
2. relatedToType
I know it's user or contact or both however if it is both it's not working. What I am trying to do is set the language based on the LanguageLocaleKey field on the User object by either using
language="{!recipient.LanguageLocaleKey}"
or
language="{!relatedToType.LanguageLocaleKey}"
but it's not working. I have to create a new portal user evertime I test this so I was hoping someone could help. I am not finding much documentation when it comes to salesforce automatic emails which go out.
Also does it use the email address from the User object or the contact object?
Thanks,
Dahveed
- Dahveed
- May 22, 2013
- Like
- 0
- Continue reading or reply