Don't have an account?
Search for an answer or ask a question of the zone or Customer Support.
You need to sign in to do that
Sign in to start searching questions
Signup for a Developer Edition
Sign in to start a discussion
{
sObject rec;
boolean result = false;
public boolean addRecord(string objName)
{
if(objName == 'Account')
{
rec = new Account(name='test');
insert rec;
result = true;
}
return result;
}
public void ClickMe()
{
boolean res = addRecord('Account');
}
}
Here you can call method ClickMe from visualforce page to create account record. Below will be example VF page:
<apex:page controller="InsertRecord">
<apex:form>
<apex:commandButton action="{!clickme}" value="Create Account"/>
</apex:form>
</apex:page>