For external users, we will be sending a link in the email to fill survey and when they click submit.
A record should be created/saved into salesforce custom Object(Survey__c)
This Survey object has a lookup field which is Account, this should also be saved.
How do I achieve this?
Below is my code:
VisualForce Page
<apex:page controller="myAudit">
<apex:form >
<apex:pageblock >
<apex:inputField value="{!account.name}"/>
<apex:inputText id="Survey" value="{!txtSurvey}"/>
<apex:commandButton action="{!save}" value="save"/>
</apex:pageblock>
</apex:form>
</apex:page>
Controller
public class myAudit {
public String account { get; set; }
public String txtAuditQ { get; set; }
public PageReference save() {
//Add your custom logic to update specific fields here
Survey__c aq = new Survey__c();
aq.Name = txtSurvey;
aq.account__c = account;
insert aq;
return null;
}
}
}