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
beenerbeener 

Save doesn't work using Visualforce, partner portal and std contoller

Hi,

 

My Save button doesn't work 

I am attempting to mimic web-to-lead and (later web-to-case) functionality using the following:

 

  • visualforce. 
  • partner portal (which is free, but doesn't allow self registration)
  • standard controller for lead.

 

 

Here's what I've come up with:

 

My Problem: 

SAVE doesn't work.

 

In case you are curious, The reason I'm not using the standard webform is:

 

  • I get the visual design for free
  • I don't have to modify the form every time I modify a pick list (which is very annoying).
  • (Later on. I can use apex code after the submission.)
Any ideas?

Thanks in advance.
 
Comments:
  • I tried to use the same page from salesforce (rather than from the site, so we have authentication).
    I still CAN'T Save, BUT if there is an ?id=XXXXXXXXXX in the URL, I can make a change, and save. this works.
  • I'm attaching the outer part of my VF page, just so you see I'm using standarrd functionality, apex: inputfield and no special tricks.

<apex:page standardController="Lead">

<apex:form > <apex:pageBlock title="Initial Agreement" mode="edit">

 

<apex:pageBlockButtons >

<apex:commandButton action="{!save}" value="Save"/>

</apex:pageBlockButtons><apex:pageBlockSection title="Title" columns="1">

<apex:outputText ><br/>Welcome to My Application form.<br/>Please fill in the form below. </apex:outputText>

<apex:inputfield value="{!Lead.Agreement__c}" />

<!-- more input fields here -->

<!-- more input fields here -->

<!-- more input fields here -->

<!-- more input fields here -->

</apex:pageblocksection></apex:pageBlock></apex:form></apex:page>

 



 

Message Edited by beener on 11-12-2009 01:47 PM
Message Edited by beener on 11-12-2009 01:48 PM
beenerbeener

please?

 

beenerbeener

It's working. your help is much appreciated.

 

Is there a ready made example to do the same with web2case?

 

Thanks again  

eric_deveric_dev

Hi 

is it possible to update Lead data via Sites?

 

i created VisualforcePage and extension class for lead standard controller,

very similar to that you've described below.

 

Update lead works great inside salesforce : .../apex/UpdateLead?id=000000..ABC

but when i open the lead via Sites, all fields are read only. (i use inputfield property)

 

Any idea?

in site security i marked Read and Create options for Lead, there are no option to mark edit

 

Thank you 

 

 

 

beenerbeener

I'm not sure, but to the best of my understanding: I think that SF distinguish between

 

  • Customer portal (allows sign in, paid service), where you CAN UPDATE. and 
  • Partner Portal (no-sign in, free service), NO UPDATE.
 
I may be reversing the terms.
 
Ben  

 

BulentBulent

Sites license allows you to read and create on standard objects (except products, pricebooks and ideas you only get read access)

and full access on custom objects 

eric_deveric_dev

Hi,

thank you for your response.

 

i created custom object as a workaround and i want to update fields via Site.
it works fine inside salesforce, but via Site only standard field is editable (RecordName field)
all custom fields that i've created in that object don't present values.

Can you help please?

i tried to add a query instead of getrecord() - didn't work

i think that update record also doesn't work

class vfUpdate:
private final Site__c s ;

 

 public vfUpdate (ApexPages.StandardController controller) {
        cmController = controller;
            
        this.ls = (Site__c) cmController.getrecord();

}

public PageReference UpdateAction() 
{
    try
    {
        update s;
    }
    catch(DmlException ex)
    {
          ApexPages.addMessages(ex);
    }
       
    return new PageReference('homepage');
}

 

Page:

 

<apex:page standardController="Site__c" 
extensions="vfUpdate" 
sidebar="false" showHeader="false" cache="true"> 
<apex:form >
 <apex:inputfield value="{!Site__c.Name}"   <!-- this value is VISIBLE -->
 <apex:inputfield value="{!Site__c.FirstName__c}" <!-- this value is NOT VISIBLE -->
 <apex:inputfield value="{!Site__c.LastName__c}" <!-- this value is NOT VISIBLE -->
 
 <apex:commandButton value="Submit" action="{!UpdateAction}"
 </apex:form>
 </apex:page>


       

Thank you

beenerbeener

Sounds to me like you should look at the persmissions

 

 Grant the “Create” permission to your site for the lead object:
a. In the Site Details page, click Public Access Settings.
b. In the Profile page, click Edit.
c. Under Standard Object Permissions, select the “Create” permission for <<YOUR CUSTOM OBJECT>>.
d. Click Save.

 

I hope this helps

 

Ben 

eric_deveric_dev

Thank you Ben.

 

i alreay had Read Create and Edit permissions on my custom object.

 

Finally a problem was in Field Accessibilty permissions for Guest profile.

all custom fields by default where "hidden". once i changed it to Editable, it started to work.

 

Thanks to all for help !