You need to sign in to do that
Don't have an account?
Form to pre-populate from Campaigns and save to cases
Hi,
This is my first force page form and I need to make a form with pre-populated fields and fields that need to be manually filled out.
The fields that are pre-populated will be populated from "campaign" but I don't want to update the campaign I want the form to save the data to "Cases" as it is a feedback form about a campaign.
This is the code I have so far, these are the fields that I want to pre populate.
<apex:page standardController="Campaign" sidebar="false"> <apex:pageBlock > <apex:form > <apex:pageblockSection > <apex:inputField value="{!Campaign.Organising_Contact__c}"/> <apex:inputField value="{!Campaign.Organising_Contact_Company__c}"/> <apex:inputField value="{!Campaign.Organising_Contact_Email__c}"/> <apex:inputField value="{!Campaign.Long_Start_Date__c}"/> <apex:inputField value="{!Campaign.Product_Name__c}"/> <apex:inputField value="{!Campaign.Facilitator__c}"/> <apex:commandButton action="{!save}" value="Save!"/> </apex:pageblockSection> </apex:form> </apex:pageBlock> </apex:page>
But when I save it will update the controller "Campaign" so how do I tell it to make a new case and save it to "Cases"
Thank you in advance.
I am new to force pages so I would appreciate any help on this or even if someone could point me in the right direction.
Joe
Create two objects in apex one for campaign one for cases. Assign the values you want to respective fields.
here i am taking dummy fields you use your fields as required. Don't forget to supply data for mandatory fields in cases else insert operation will be failed
Thank you for your reply HussainSFDC.
Is there any way that I can add the apex class inline in the forcepage? Or do I need to create an apex class file?
Thanks again
Joe
here is vf page code which creates an inline edit input field to contact. and this field gets data form campaign, as we have declared cas.contact = cam.Organising_contact__c;. Remember this value is assigned to case only when you call save method in controller through command button.