+ Start a Discussion
IC-TannerIC-Tanner 

Campaign object doesn't appear to allow 'create' via force Sites

Hi everyone,

 

I have created a visualForce page that has a couple "<apex:inputField>" for the 'campaign' object. When I view the VF page directly in Salesforce, it appears correct with the input box. But when I view it via 'Sites', the input area/box is not displaying as though the fields are 'read only'.  I assumed it was an issue with 'field security' and the guest user profile but the fields are set to 'editable'. I also verified that 'view' and 'create' were checked for the 'Standard Object Permissions' for the profile. I tested it with other objects and only campaigns seems to be an issue?

 

Here is the sites page:

 

http://icbeta1-developer-edition.na2.force.com/

http://icbeta1-developer-edition.na2.force.com/ 

 

 

Fields:

 

<apex:inputField id="inputValue" value="{!campaign.startDate}"/>

<apex:inputField id="inputValue2" value="{!campaign.isactive}"/>

 

Thanks ahead of time! 

 
Page code: 

 

 

    <apex:page standardcontroller="Campaign">
    <apex:form >
<apex:pageBlock title="School Recruiter Events">
<apex:pageBlockButtons >
<apex:commandButton action="{!save}" value="Save"/>
</apex:pageBlockButtons>
<apex:pageBlockSection title="Event Details" columns="2">
<apex:inputField id="inputValue" value="{!campaign.startDate}"/>
<apex:inputField id="inputValue2" value="{!campaign.isactive}"/>
</apex:pageBlockSection>
</apex:pageBlock>
</apex:form>
</apex:page>
Best Answer chosen by Admin (Salesforce Developers) 
Sandeep001Sandeep001
I think you can't use value="{!campaign.startDate}" in the input field directly if you are using public Sites. You have to use wrapper class and create properties which return the value of the required fields after querying from the object. e.g. campaign.startDate here. 

All Answers

BulentBulent

have you tried with mode="edit"?

 

<apex:pageBlock title="School Recruiter Events" mode="edit">

 

 

 

IC-TannerIC-Tanner

Thanks for the suggestion Bulent but this didn't resolve the issue. Here is the updated code: 

 

<apex:page standardcontroller="campaign">
<apex:form >
<apex:pageBlock title="School Recruiter Events" mode="edit">
<apex:pageBlockButtons >
<apex:commandButton action="{!save}" value="Save"/>
</apex:pageBlockButtons>
<apex:pageBlockSection title="Event Details" columns="2">

<apex:inputField value="{!campaign.name}"/>
<apex:inputField value="{!campaign.startDate}"/>
<apex:inputField value="{!campaign.endDate}"/>

</apex:pageBlockSection>
</apex:pageBlock>
</apex:form>
 

</apex:page>

 

Could this be a system error? I've also replicated it on other Salesforce instances, provided access to all objects (where applicable), and tested with other objects to verify they didn't have the same issue.  It seems to me that it could be an issue/conflict with the fact that you cannot select 'marketing user' for the 'sites' profile user. (which offcourse is required to create campaign records for standard SF users). 

 

Message Edited by IC-Tanner on 09-22-2009 12:28 PM
Sandeep001Sandeep001
I think you can't use value="{!campaign.startDate}" in the input field directly if you are using public Sites. You have to use wrapper class and create properties which return the value of the required fields after querying from the object. e.g. campaign.startDate here. 
This was selected as the best answer
BulentBulent
Correct. Site guest user (site details> public access settings> view users) doesn't expose the "marketing user" check box which is required to create campaigns. I'm discussing this with the product manager of the marketing product. 
Message Edited by Bulent on 10-07-2009 03:18 PM