• abha
  • NEWBIE
  • 0 Points
  • Member since 2013

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 12
    Questions
  • 11
    Replies

In general database structure, we relate 2 tables by specifying some column as a foreign key.

In my application I have created 2 custom objects "Donor" and "DonLogin". Donor contains all basic information like 'donorID', name, address.. While DonLogin have login information i.e.. fields like username, password etc. I want to create 1-1 relationship between Donor-DonLogin. DonorID is AutoNumber.  Can I relate these 2 objects using DonorID?

I am creating object records through visualforce page and controller class. I have managed to create records for both objects through same controller. But I want to take some field of 'Donor'(especially DonorID) and want to insert its value in 'DonLogin'.  It is giving me error saying 'DonorID is not writable field'. What should be done so that DonorID will be editable field?  I want to refer  this system generated value in other custom objects as a reference key. How to do this?

Master-detail relationship type does not allow any specific field to select as reference key. How can I set some field as a connection between 2 objects?

I have created custom object called 'students'. I have developed the visualforce page and controller class, which accepts student details and creates a new record. It is working properly when executed from 'https://c.ap1.visual.force.com/apex/StudentForm8'.. I.e. within the account. 

When I try to load this VF page from my website, it is giving me error like

Authorization Required
You must first log in or register before accessing this page.
If you have forgotten your password, click Forgot Password to reset it.

 

I checked the following things :-

1- custom object status is set as "Deployed"

2-  the site public access settings has Read, create and edit permission on this custom object

3- the Site public access settings  Field Level security are set as "Visible" for the fields that are displaying on this page 

4-  Page is associated with my site

 

Here I am attaching my code

Visualforce page "StudentForm8"

<apex:page controller="MyController8" tabStyle="Account" >
    <apex:form >
        <apex:pageBlock mode="edit">
            <apex:pageMessages />
            <apex:pageBlockSection >
                <apex:inputField value="{!Details.name}"/>
                <apex:inputField value="{!Details.Branch__c}"/>
                <apex:inputField value="{!Details.Subjects__c}"/>
                <apex:inputField value="{!Details.Aggregate__c}"/>
            
            </apex:pageBlockSection>
            <apex:pageBlockButtons location="bottom">
                <apex:commandButton value="Save" action="{!save}"/>
            </apex:pageBlockButtons>
        </apex:pageBlock>
    </apex:form>
</apex:page>

 

Controller code named "MyController8"

public class MyController8 {

    public Student__c stud { get; set; }
    public MyController8() {
     stud = new Student__c();
    }
        public Student__c getDetails() {
        return stud;
    }
    public PageReference save() {
        try {
            insert(stud);
        } catch(System.DMLException e) {
            ApexPages.addMessages(e);
            return null;
        }
      PageReference pageRef = new PageReference('http://myappmbb-developer-edition.ap1.force.com/RegiSuccess');
      return pageRef;
    }
}

 

After record creation page wasredirecting to system page showing detail new record. I thought it is creating problem as system page can't be available on website. So I redirected it to fix url "http://myappmbb-developer-edition.ap1.force.com/RegiSuccess".. RegiSuccess page is visible from my website.

 

 

In spite of all these things page is not accessible from website.

What would be the possible error?

Any kind of help would be greatly appreciated.

I have created custom object called 'students'. I have developed the visualforce page and controller class, which accepts student details and creates a new record. It is working properly when executed from 'https://c.ap1.visual.force.com/apex/StudentForm8'.. I.e. within the account. 

When I try to load this VF page from my website, it is giving me error like

Authorization Required
You must first log in or register before accessing this page.
If you have forgotten your password, click Forgot Password to reset it.

 

I checked the following things :-

1- custom object status is set as "Deployed"

2-  the site public access settings has Read, create and edit permission on this custom object

3- the Site public access settings  Field Level security are set as "Visible" for the fields that are displaying on this page 

4-  Page is associated with my site

 

Here I am attaching my code

Visualforce page "StudentForm8"

<apex:page controller="MyController8" tabStyle="Account" >
    <apex:form >
        <apex:pageBlock mode="edit">
            <apex:pageMessages />
            <apex:pageBlockSection >
                <apex:inputField value="{!Details.name}"/>
                <apex:inputField value="{!Details.Branch__c}"/>
                <apex:inputField value="{!Details.Subjects__c}"/>
                <apex:inputField value="{!Details.Aggregate__c}"/>
            
            </apex:pageBlockSection>
            <apex:pageBlockButtons location="bottom">
                <apex:commandButton value="Save" action="{!save}"/>
            </apex:pageBlockButtons>
        </apex:pageBlock>
    </apex:form>
</apex:page>

 

Controller code named "MyController8"

public class MyController8 {

    public Student__c stud { get; set; }
    public MyController8() {
     stud = new Student__c();
    }
        public Student__c getDetails() {
        return stud;
    }
    public PageReference save() {
        try {
            insert(stud);
        } catch(System.DMLException e) {
            ApexPages.addMessages(e);
            return null;
        }
      PageReference pageRef = new PageReference('http://myappmbb-developer-edition.ap1.force.com/RegiSuccess');
      return pageRef;
    }
}

 

After record creation page wasredirecting to system page showing detail new record. I thought it is creating problem as system page can't be available on website. So I redirected it to fix url "http://myappmbb-developer-edition.ap1.force.com/RegiSuccess".. RegiSuccess page is visible from my website.

 

 

In spite of all these things page is not accessible from website.

What would be the possible error?

Any kind of help would be greatly appreciated.

 

In my application user will enter his data on visualforce webpage. It should get saved in object models? Do I need to write any separate controller for that? How can I achieve this?

In addition, I am authenticating user's through customer portal. Whether I need some extra user's permissions or any changes in object's settings?

Can anybody provide me some tutorials, which contains data and visualforce page connectivity?

I implemented customer portal's login and registration functionality.

1. User logged in through customer portal can see those pages listed in site's visualforce pages list. But these pages are public. What setting do I need to do, so that pages will be available only to users' logged in though customer portal?

2. After login user gets the default page of customer portal. It is combination of site's home page and default tabs like home, cases, solutions, etc. How can I redirect login function to any other visulforce page? I tried to change startUrl but it is not working.  What changes are needed in following login code?

 

 global PageReference login() {
     String startUrl = System.currentPageReference().getParameters().get('startUrl');
        return Site.login(username, password,startUrl);
    }

I have developer edition account. I am implementing customer portal as stated in this ( https://na6.salesforce.com/help/doc/en/salesforce_customer_portal_implementation_guide.pdf ) guide. To enable customer portal, we need to set some user permissions like 'customize application', 'manage users' etc. How to set those permissions?

I want to develop login application on developerforce.com. Previously I developed such web project in java using Eclipse IDE. It was validating login request  using username and password stored in MySql database. I used JSP and servlet for this.

I created some web pages using JSP for accepting user's name and password; and for indicating successful or failed login. I created servlet which accepts HTTP request. then I connected my app to Mysql using JDBC. and finally sent HTTP response back, which is displayed on web page.

I want to develop same application on developer force. From where should I start? How to connect visualfroce web pages to db? Whether I have to store each (username . password) as a object? Where to write code for authentication? Can anybody help me with this?

hi i was trying to insert a set of data to a custom object i was able to do it in normal visual force page but when i checked it on sites i was not able to this is the code i used.

 

 

controller

 

 

public class conedits 
{
    public guestuser__c guest{get;set;}

    public PageReference cancel() {
        return null;
    }


    

string conid;
    public contact led{get;set;}

    public conedits() 
    {
    this.conid=ApexPages.currentPage().getParameters().get('paramID');   
        if(conid!=null||conid!='')
        {
            getdetails(conid); 
        }   

    }

    
    //public preference(ApexPages.StandardController controller)
    //{
        // get the id of the quote and store it in quoteid
      //  this.leadid=ApexPages.currentPage().getParameters().get('paramID');   
       // if(leadid!=null||leadid!='')
      //  {
            //getdetails(leadid); 
      //  }    
   // }
    public void getdetails(string conid)
    {
        List<contact> cons=[select id,Email,Phone,Title,HasOptedOutOfEmail,A_H_Interest__c,Aftermarket_Interest__c,Construction_Interest__c,D_O_Interest__c,Energy_Interest__c,Environmental_Interest__c,Financial_Enterprises_Interest__c,Healthcare_Interest__c,Manufacturing_Interest__c,Property_Interest__c,Real_Estate_Interest__c,Technology_Interest__c,Windstorm_Notification__c from contact where Id=: conid];
        if(cons.size()>0)
        {
            led=cons[0];
        }
        else
        {
            
        }
    }
    public void save()
    {
        guest = new guestuser__c();
        guest.Email__c= led.email;
        guest.Title__c = led.title;
        guest.Email_Optout__c = led.HasOptedOutOfEmail;
        guest.Phone__c = led.Phone;
        guest.Healthcare_interests__c = led.Healthcare_Interest__c;
        guest.Environmental_interests__c = led.Environmental_Interest__c;
        guest.Energy_interests__c = led.Energy_Interest__c;
        guest.Technology_interests__c = led.Technology_Interest__c;
        guest.RealEstate_interests__c= led.Real_Estate_Interest__c;
        guest.A_H_interests__c = led.A_H_Interest__c;
        guest.D_O_interests__c = led.D_O_Interest__c;
        guest.After_Markets_interests__c = led.Aftermarket_Interest__c;
        guest.Construction_interests__c = led.Construction_Interest__c;
        guest.Windstorm_notification_interests__c = led.Windstorm_Notification__c;
        guest.Property_interests__c = led.Property_Interest__c;
        guest.Financial_Enterprises_interests__c = led.Financial_Enterprises_Interest__c;
        guest.Manufacturing_interests__c = led.Manufacturing_Interest__c;
        insert (guest);
        
    }
    
}

 

 

VF page

 

 

 

<apex:page showHeader="false" controller="conedits">
  <apex:form >
  <apex:pageBlock title="My Preferences" mode="edit">
  <apex:pageBlockButtons >
  <apex:commandButton action="{!save}" value="submit"/>
  <apex:commandButton action="{!cancel}" value="cancel"/>
  </apex:pageBlockButtons>
  <apex:pageBlockSection title="Personal Information" columns="2">
  <apex:pageBlockSectionItem >
  <apex:outputText >Email &nbsp;
  <apex:inputText value="{!led.email}" title="email"/></apex:outputText> </apex:pageBlockSectionItem>
 
 <apex:pageBlockSectionItem > 
 <apex:outputText >Phone &nbsp;<apex:inputText value="{!led.phone}" title="Phone"/></apex:outputText></apex:pageBlockSectionItem>
 
 <apex:pageBlockSectionItem >
 <apex:outputText >Title &nbsp;&nbsp;&nbsp; <apex:inputText value="{!led.title}" title="Title"/></apex:outputText>
 </apex:pageBlockSectionItem>
 
 <apex:pageBlockSectionItem >
 <apex:outputText >Email Optout &nbsp;<apex:inputCheckbox value="{!led.HasOptedOutOfEmail}" title="Emailoptout"/></apex:outputText>
 </apex:pageBlockSectionItem>
  </apex:pageBlockSection>
  
  <apex:pageBlockSection title="My Interests" columns="3">
  
  <apex:pageBlockSectionItem >
  <apex:outputText >Real Estate &nbsp;<apex:inputCheckbox value="{!led.Real_Estate_Interest__c}"/></apex:outputText>
  </apex:pageBlockSectionItem>
  
  <apex:pageBlockSectionItem >
  <apex:outputText >Property &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<apex:inputCheckbox value="{!led.Property_Interest__c}"/></apex:outputText>
  </apex:pageBlockSectionItem>
  
  <apex:pageBlockSectionItem >
  <apex:outputText >Manufacturing &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<apex:inputCheckbox value="{!led.Manufacturing_Interest__c}"/></apex:outputText>
  </apex:pageBlockSectionItem>
  
  <apex:pageBlockSectionItem >
  <apex:outputText >Healthcare &nbsp;&nbsp;<apex:inputCheckbox value="{!led.Healthcare_Interest__c}"/></apex:outputText>
  </apex:pageBlockSectionItem>
  
  <apex:pageBlockSectionItem >
  <apex:outputText >Technology &nbsp;<apex:inputCheckbox value="{!led.Technology_Interest__c}"/></apex:outputText>
  </apex:pageBlockSectionItem>
  
  <apex:pageBlockSectionItem >
  <apex:outputText >Environemntal &nbsp;&nbsp;&nbsp;&nbsp;<apex:inputCheckbox value="{!led.Environmental_Interest__c}"/></apex:outputText>
  </apex:pageBlockSectionItem>
  
  <apex:pageBlockSectionItem >
  <apex:outputText >Energy &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<apex:inputCheckbox value="{!led.Energy_Interest__c}"/></apex:outputText>
  </apex:pageBlockSectionItem>
  
  <apex:pageBlockSectionItem >
  <apex:outputText >Construction <apex:inputCheckbox value="{!led.Construction_Interest__c}"/></apex:outputText>
  </apex:pageBlockSectionItem>
  
  <apex:pageBlockSectionItem >
  <apex:outputText >After Market &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<apex:inputCheckbox value="{!led.Aftermarket_Interest__c}"/></apex:outputText>
  </apex:pageBlockSectionItem>
  
  <apex:pageBlockSectionItem >
  <apex:outputText >Windstorm &nbsp;&nbsp;<apex:inputCheckbox value="{!led.Windstorm_Notification__c}"/></apex:outputText>
  </apex:pageBlockSectionItem>
  
  <apex:pageBlockSectionItem >
  <apex:outputText >A&amp;H &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<apex:inputCheckbox value="{!led.A_H_Interest__c}"/></apex:outputText>
  </apex:pageBlockSectionItem>
  
   <apex:pageBlockSectionItem >
  <apex:outputText >D&amp;O &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<apex:inputCheckbox value="{!led.D_O_Interest__c}"/></apex:outputText>
  </apex:pageBlockSectionItem>
  
  
  <apex:pageBlockSectionItem >
  <apex:outputText >Financial &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<apex:inputCheckbox value="{!led.Financial_Enterprises_Interest__c}"/></apex:outputText>
  </apex:pageBlockSectionItem>
  
  </apex:pageBlockSection>
  </apex:pageBlock>
  </apex:form>
</apex:page>

 

can anybody suggest me how to make it work on sites.