• jls_74_tx
  • NEWBIE
  • 95 Points
  • Member since 2011

  • Chatter
    Feed
  • 1
    Best Answers
  • 2
    Likes Received
  • 0
    Likes Given
  • 24
    Questions
  • 43
    Replies
I can't figure out why the insert function isn't working. Can anyone help me? Thank you so much.

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>
I can't figure out how to insert related record ID numbers dynamically. In the sample below they are hard coded and it works as needed, but I need the ID's included in the loop to insert records.

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;}
               
    }
     
}
Im on the getting started with visualforce module. I have written markup language before but it has been a while. in the code below, what line tell the form to put the save button at the top of the page vs the bottom? I always assumed that the code had to be placed where you wanted the button or at least have a line of code to tell it. Sorry for a simple question but i cant seem to pull the answer for myself.
 
<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>

 
Warning: I'm a complete newbie to JavaScript.

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);
Does anyone have recent documentation about using open graph tags on a sites.com page? I have tried several combinations of <apex:page> tags and I can't get the Facebook DeBugger to read my page correctly. I have tried:
  • applyBodyTag true and false
  • applyHtmlTag true and false
  • contentType text/html
  • docType html-5.0
I have built a company profile page and implemented sharing buttons but Facebook doesn't pick up my open graph tags.

<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:
  1. 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.
  2. 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)
  3. The 'og:url' property should be explicitly provided, even if a value can be inferred from other tags.
  4. The 'og:title' property should be explicitly provided, even if a value can be inferred from other tags.
  5. The 'og:image' property should be explicitly provided, even if a value can be inferred from other tags.
If I use these <apex:page> components:
<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!
 
I have a wrapper class for a custom object Referral__c but I need to add the parent object so only the child object display. The purpose for the wrapper class is so when looking at the ClientDetails__c object, a user can delete child records with a check box. I have displayed the child records previously with an extention, but I'm not able to duplicate the functionality with this wrapper class. Can you help?

__________________________________________________
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;}

 }

}
I have a pageBlockTable and I would like to display an image if certain criteria is met. I have tried every variation I can think of for this formula but the only result I get is showing the text result 'http://www.locatormls.com/staticfiles/misc/{!apt.Star_Image__c}star.png' it doesn't actually show the image. The formula below shows an error - IMAGE can't but used in this formula.

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>
Does anyone have experience with an internet explorer error "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:

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');  
    }
}
}

 

 

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