You need to sign in to do that
Don't have an account?
sfdc fresher
formulae expression is required on the action attributes
hi everyone,
could anyone please help. when am trying to insert an account am getting Formula Expression is required on the action attributes.
below is my code. please guide/suggest me what needs to be changed.
public class DML_Example1 {
public String accName {set;get;}
public String phone {set;get;}
public String rating {get;set;}
public String ownership {set;get;}
public PageReference create()
{
List<Account> accs=[select id from Account where name=:accName and phone=:phone];
if(accs.size()>0)
{
ApexPages.Message msg=new ApexPages.Message(Apexpages.Severity.ERROR,'Duplicate Record Found');
ApexPages.addMessage(msg);
return null;
}
else
{
Account acc=new Account();
acc.Name=accName;
acc.phone=phone;
acc.rating=rating;
acc.Ownership=ownership;
insert acc;
PageReference p=new PageReference('/'+acc.ID);
return p;
}
}
public void cancel()
{
accName=null;
phone=null;
rating=null;
ownership=null;
}
}
//// VF Page Code
<apex:page controller="DML_Example1" >
<apex:sectionHeader title="Account" subtitle="NewAccount"/>
<apex:form >
<apex:pageMessages/>
<apex:pageBlock title="Account">
<apex:pageBlockButtons location="top">
<apex:commandButton value="save" action="!create}"/>
<apex:commandButton value="cancel" action="{!cancel}"/>
</apex:pageBlockButtons>
<apex:pageBlockSection columns="2">
<apex:pageBlockSectionItem>
<apex:outputLabel value="AccountName"/>
<apex:inputText value="{!accName}"/>
</apex:pageBlockSectionItem>
<apex:pageBlockSectionItem>
<apex:outputLabel value="AccountPhone"/>
<apex:inputText value="{!phone}"/>
</apex:pageBlockSectionItem>
<apex:pageBlockSectionItem>
<apex:outputLabel value="Rating"/>
<apex:inputText value="{!rating}"/>
</apex:pageBlockSectionItem>
<apex:pageBlockSectionItem>
<apex:outputLabel value="ownership"/>
<apex:inputText value="{!ownership}"/>
</apex:pageBlockSectionItem>
</apex:pageBlockSection>
</apex:pageBlock>
</apex:form>
</apex:page>
could anyone please help. when am trying to insert an account am getting Formula Expression is required on the action attributes.
below is my code. please guide/suggest me what needs to be changed.
public class DML_Example1 {
public String accName {set;get;}
public String phone {set;get;}
public String rating {get;set;}
public String ownership {set;get;}
public PageReference create()
{
List<Account> accs=[select id from Account where name=:accName and phone=:phone];
if(accs.size()>0)
{
ApexPages.Message msg=new ApexPages.Message(Apexpages.Severity.ERROR,'Duplicate Record Found');
ApexPages.addMessage(msg);
return null;
}
else
{
Account acc=new Account();
acc.Name=accName;
acc.phone=phone;
acc.rating=rating;
acc.Ownership=ownership;
insert acc;
PageReference p=new PageReference('/'+acc.ID);
return p;
}
}
public void cancel()
{
accName=null;
phone=null;
rating=null;
ownership=null;
}
}
//// VF Page Code
<apex:page controller="DML_Example1" >
<apex:sectionHeader title="Account" subtitle="NewAccount"/>
<apex:form >
<apex:pageMessages/>
<apex:pageBlock title="Account">
<apex:pageBlockButtons location="top">
<apex:commandButton value="save" action="!create}"/>
<apex:commandButton value="cancel" action="{!cancel}"/>
</apex:pageBlockButtons>
<apex:pageBlockSection columns="2">
<apex:pageBlockSectionItem>
<apex:outputLabel value="AccountName"/>
<apex:inputText value="{!accName}"/>
</apex:pageBlockSectionItem>
<apex:pageBlockSectionItem>
<apex:outputLabel value="AccountPhone"/>
<apex:inputText value="{!phone}"/>
</apex:pageBlockSectionItem>
<apex:pageBlockSectionItem>
<apex:outputLabel value="Rating"/>
<apex:inputText value="{!rating}"/>
</apex:pageBlockSectionItem>
<apex:pageBlockSectionItem>
<apex:outputLabel value="ownership"/>
<apex:inputText value="{!ownership}"/>
</apex:pageBlockSectionItem>
</apex:pageBlockSection>
</apex:pageBlock>
</apex:form>
</apex:page>
<apex:commandButton value="save" action="{!create}"/>