-
ChatterFeed
-
0Best Answers
-
0Likes Received
-
0Likes Given
-
16Questions
-
7Replies
what is the best practice for below trigger i want to prevent duplicate phone in my account
trigger predupphone on Account (before insert) {
for(Account a:trigger.new)
{
list<Account> la= [select id from Account where phone=:a.Phone];
if(la.size() > 0)
{
a.Phone.adderror('phone already exist');
}
}
for(Account a:trigger.new)
{
list<Account> la= [select id from Account where phone=:a.Phone];
if(la.size() > 0)
{
a.Phone.adderror('phone already exist');
}
}
- Devaraj 7
- June 05, 2018
- Like
- 0
- Continue reading or reply
- Devaraj 7
- March 28, 2018
- Like
- 0
- Continue reading or reply
how to display multiple obects fields in single pageblock table.
iam just able to seen headers only i have data but iam unable to seen in pageblock table.
according to my knowledge that is correct only but where is the problem iwant to know
my vf page
<apex:page controller="Multipleobjwrapper">
<apex:form >
<apex:pageBlock >
<apex:pageBlockSection >
<apex:pageBlockTable value="{!wrplst}" var="w">
<apex:column headervalue="AccountName" value="{!w.acc.name}" />
<apex:column headervalue="ContactName" value="{!w.con.name}"/>
<apex:column headervalue="OpportunityName" value="{!w.opp.name}"/>
<apex:column headervalue="LeadName" value="{!w.led.name}"/>
<apex:column headervalue="CreditCardName" value="{!w.crd.name}"/>
<apex:column headervalue="Employee" value="{!w.emp.name}"/>
<apex:column headervalue="Student" value="{!w.stu.name}"/>
<apex:column headervalue="faculty" value="{!w.fac.name}"/>
<apex:column headervalue="paymentName" value="{!w.pay.name}"/>
<apex:column headervalue="pharmacyName" value="{!w.phm.name}"/>
</apex:pageBlockTable>
</apex:pageBlockSection>
</apex:pageBlock>
</apex:form>
</apex:page>
public class Multipleobjwrapper {
public list<Account> acclst{get; set;}
public list<Contact> conlst{get; set;}
public list<Opportunity> opplst{get; set;}
public list<Lead> ledlst{get; set;}
public list<CreditCard__c> crdlst{get; set;}
public list<Employee__c> emplst{get; set;}
public list<Student__c> stdlst{get; set;}
public list<faculty__c> faclst{get; set;}
public list<payment__c> paylst{get; set;}
public list<pharmacy__c> phmlst{get; set;}
public list<Mywrapper> wrplst{get; set;}
public Multipleobjwrapper(){
acclst=[select Id,name from Account];
system.debug('accounts'+acclst);
conlst=[select id,name from Contact];
opplst=[select id,name from Opportunity];
ledlst=[select id,name from Lead];
crdlst=[select id,Name__c from CreditCard__c];
emplst=[select id,Lastname__c from Employee__c];
stdlst=[select id,Name from Student__c];
faclst=[select id,Name from faculty__c];
paylst=[select id,Name from payment__c];
phmlst=[select id,Name from pharmacy__c];
wrplst=new list<Mywrapper>();
for(integer i=0; i<10; i++)
{
if(wrplst.size()!=0)
{
wrplst.add(new Mywrapper (acclst[i],conlst[i],opplst[i],ledlst[i],crdlst[i],emplst[i],stdlst[i],faclst[i],paylst[i],phmlst[i]));
}
}
}
public class Mywrapper{
public Account acc{get; set;}
public Contact con{get; set;}
public Opportunity opp{get; set;}
public Lead led{get; set;}
public CreditCard__c crd{get; set;}
public Employee__c emp{get; set;}
public Student__c stu{get; set;}
public faculty__c fac{get; set;}
public payment__c pay{get; set;}
public pharmacy__c phm{get; set;}
public Mywrapper(Account a,Contact c,Opportunity o,Lead l,CreditCard__c cr, Employee__c e,
Student__c s,faculty__c f,payment__c p,pharmacy__c ph)
{
acc=a;
con=c;
opp=o;
led=l;
crd=cr;
emp=e;
stu=s;
fac=f;
pay=p;
phm=ph;
}
}
}
according to my knowledge that is correct only but where is the problem iwant to know
my vf page
<apex:page controller="Multipleobjwrapper">
<apex:form >
<apex:pageBlock >
<apex:pageBlockSection >
<apex:pageBlockTable value="{!wrplst}" var="w">
<apex:column headervalue="AccountName" value="{!w.acc.name}" />
<apex:column headervalue="ContactName" value="{!w.con.name}"/>
<apex:column headervalue="OpportunityName" value="{!w.opp.name}"/>
<apex:column headervalue="LeadName" value="{!w.led.name}"/>
<apex:column headervalue="CreditCardName" value="{!w.crd.name}"/>
<apex:column headervalue="Employee" value="{!w.emp.name}"/>
<apex:column headervalue="Student" value="{!w.stu.name}"/>
<apex:column headervalue="faculty" value="{!w.fac.name}"/>
<apex:column headervalue="paymentName" value="{!w.pay.name}"/>
<apex:column headervalue="pharmacyName" value="{!w.phm.name}"/>
</apex:pageBlockTable>
</apex:pageBlockSection>
</apex:pageBlock>
</apex:form>
</apex:page>
public class Multipleobjwrapper {
public list<Account> acclst{get; set;}
public list<Contact> conlst{get; set;}
public list<Opportunity> opplst{get; set;}
public list<Lead> ledlst{get; set;}
public list<CreditCard__c> crdlst{get; set;}
public list<Employee__c> emplst{get; set;}
public list<Student__c> stdlst{get; set;}
public list<faculty__c> faclst{get; set;}
public list<payment__c> paylst{get; set;}
public list<pharmacy__c> phmlst{get; set;}
public list<Mywrapper> wrplst{get; set;}
public Multipleobjwrapper(){
acclst=[select Id,name from Account];
system.debug('accounts'+acclst);
conlst=[select id,name from Contact];
opplst=[select id,name from Opportunity];
ledlst=[select id,name from Lead];
crdlst=[select id,Name__c from CreditCard__c];
emplst=[select id,Lastname__c from Employee__c];
stdlst=[select id,Name from Student__c];
faclst=[select id,Name from faculty__c];
paylst=[select id,Name from payment__c];
phmlst=[select id,Name from pharmacy__c];
wrplst=new list<Mywrapper>();
for(integer i=0; i<10; i++)
{
if(wrplst.size()!=0)
{
wrplst.add(new Mywrapper (acclst[i],conlst[i],opplst[i],ledlst[i],crdlst[i],emplst[i],stdlst[i],faclst[i],paylst[i],phmlst[i]));
}
}
}
public class Mywrapper{
public Account acc{get; set;}
public Contact con{get; set;}
public Opportunity opp{get; set;}
public Lead led{get; set;}
public CreditCard__c crd{get; set;}
public Employee__c emp{get; set;}
public Student__c stu{get; set;}
public faculty__c fac{get; set;}
public payment__c pay{get; set;}
public pharmacy__c phm{get; set;}
public Mywrapper(Account a,Contact c,Opportunity o,Lead l,CreditCard__c cr, Employee__c e,
Student__c s,faculty__c f,payment__c p,pharmacy__c ph)
{
acc=a;
con=c;
opp=o;
led=l;
crd=cr;
emp=e;
stu=s;
fac=f;
pay=p;
phm=ph;
}
}
}
- Devaraj 7
- November 13, 2017
- Like
- 0
- Continue reading or reply
- Devaraj 7
- October 27, 2017
- Like
- 0
- Continue reading or reply
- Devaraj 7
- October 16, 2017
- Like
- 0
- Continue reading or reply
- Devaraj 7
- October 12, 2017
- Like
- 0
- Continue reading or reply
how to insert lookup field in custom object in salesforce
I have a custom object Employee in that ihave lookup field city.
i have another custom object city.
i want to insert Employee but city not will be inserted.
how can i insert.
if it will insert in city object as well as employee object it is possible using standard controller.
it is only be possible in controller.
please helpl me
thanks
devaraj
i have another custom object city.
i want to insert Employee but city not will be inserted.
how can i insert.
if it will insert in city object as well as employee object it is possible using standard controller.
it is only be possible in controller.
please helpl me
thanks
devaraj
- Devaraj 7
- July 14, 2017
- Like
- 0
- Continue reading or reply
how to show contact phone numbers with the count in vf page
phone count
995566 2
995566 2
123456 1
995566 2
995566 2
123456 1
- Devaraj 7
- May 19, 2017
- Like
- 0
- Continue reading or reply
how to display multiple obects fields in single pageblock table.
iam just able to seen headers only i have data but iam unable to seen in pageblock table.
according to my knowledge that is correct only but where is the problem iwant to know
my vf page
<apex:page controller="Multipleobjwrapper">
<apex:form >
<apex:pageBlock >
<apex:pageBlockSection >
<apex:pageBlockTable value="{!wrplst}" var="w">
<apex:column headervalue="AccountName" value="{!w.acc.name}" />
<apex:column headervalue="ContactName" value="{!w.con.name}"/>
<apex:column headervalue="OpportunityName" value="{!w.opp.name}"/>
<apex:column headervalue="LeadName" value="{!w.led.name}"/>
<apex:column headervalue="CreditCardName" value="{!w.crd.name}"/>
<apex:column headervalue="Employee" value="{!w.emp.name}"/>
<apex:column headervalue="Student" value="{!w.stu.name}"/>
<apex:column headervalue="faculty" value="{!w.fac.name}"/>
<apex:column headervalue="paymentName" value="{!w.pay.name}"/>
<apex:column headervalue="pharmacyName" value="{!w.phm.name}"/>
</apex:pageBlockTable>
</apex:pageBlockSection>
</apex:pageBlock>
</apex:form>
</apex:page>
public class Multipleobjwrapper {
public list<Account> acclst{get; set;}
public list<Contact> conlst{get; set;}
public list<Opportunity> opplst{get; set;}
public list<Lead> ledlst{get; set;}
public list<CreditCard__c> crdlst{get; set;}
public list<Employee__c> emplst{get; set;}
public list<Student__c> stdlst{get; set;}
public list<faculty__c> faclst{get; set;}
public list<payment__c> paylst{get; set;}
public list<pharmacy__c> phmlst{get; set;}
public list<Mywrapper> wrplst{get; set;}
public Multipleobjwrapper(){
acclst=[select Id,name from Account];
system.debug('accounts'+acclst);
conlst=[select id,name from Contact];
opplst=[select id,name from Opportunity];
ledlst=[select id,name from Lead];
crdlst=[select id,Name__c from CreditCard__c];
emplst=[select id,Lastname__c from Employee__c];
stdlst=[select id,Name from Student__c];
faclst=[select id,Name from faculty__c];
paylst=[select id,Name from payment__c];
phmlst=[select id,Name from pharmacy__c];
wrplst=new list<Mywrapper>();
for(integer i=0; i<10; i++)
{
if(wrplst.size()!=0)
{
wrplst.add(new Mywrapper (acclst[i],conlst[i],opplst[i],ledlst[i],crdlst[i],emplst[i],stdlst[i],faclst[i],paylst[i],phmlst[i]));
}
}
}
public class Mywrapper{
public Account acc{get; set;}
public Contact con{get; set;}
public Opportunity opp{get; set;}
public Lead led{get; set;}
public CreditCard__c crd{get; set;}
public Employee__c emp{get; set;}
public Student__c stu{get; set;}
public faculty__c fac{get; set;}
public payment__c pay{get; set;}
public pharmacy__c phm{get; set;}
public Mywrapper(Account a,Contact c,Opportunity o,Lead l,CreditCard__c cr, Employee__c e,
Student__c s,faculty__c f,payment__c p,pharmacy__c ph)
{
acc=a;
con=c;
opp=o;
led=l;
crd=cr;
emp=e;
stu=s;
fac=f;
pay=p;
phm=ph;
}
}
}
according to my knowledge that is correct only but where is the problem iwant to know
my vf page
<apex:page controller="Multipleobjwrapper">
<apex:form >
<apex:pageBlock >
<apex:pageBlockSection >
<apex:pageBlockTable value="{!wrplst}" var="w">
<apex:column headervalue="AccountName" value="{!w.acc.name}" />
<apex:column headervalue="ContactName" value="{!w.con.name}"/>
<apex:column headervalue="OpportunityName" value="{!w.opp.name}"/>
<apex:column headervalue="LeadName" value="{!w.led.name}"/>
<apex:column headervalue="CreditCardName" value="{!w.crd.name}"/>
<apex:column headervalue="Employee" value="{!w.emp.name}"/>
<apex:column headervalue="Student" value="{!w.stu.name}"/>
<apex:column headervalue="faculty" value="{!w.fac.name}"/>
<apex:column headervalue="paymentName" value="{!w.pay.name}"/>
<apex:column headervalue="pharmacyName" value="{!w.phm.name}"/>
</apex:pageBlockTable>
</apex:pageBlockSection>
</apex:pageBlock>
</apex:form>
</apex:page>
public class Multipleobjwrapper {
public list<Account> acclst{get; set;}
public list<Contact> conlst{get; set;}
public list<Opportunity> opplst{get; set;}
public list<Lead> ledlst{get; set;}
public list<CreditCard__c> crdlst{get; set;}
public list<Employee__c> emplst{get; set;}
public list<Student__c> stdlst{get; set;}
public list<faculty__c> faclst{get; set;}
public list<payment__c> paylst{get; set;}
public list<pharmacy__c> phmlst{get; set;}
public list<Mywrapper> wrplst{get; set;}
public Multipleobjwrapper(){
acclst=[select Id,name from Account];
system.debug('accounts'+acclst);
conlst=[select id,name from Contact];
opplst=[select id,name from Opportunity];
ledlst=[select id,name from Lead];
crdlst=[select id,Name__c from CreditCard__c];
emplst=[select id,Lastname__c from Employee__c];
stdlst=[select id,Name from Student__c];
faclst=[select id,Name from faculty__c];
paylst=[select id,Name from payment__c];
phmlst=[select id,Name from pharmacy__c];
wrplst=new list<Mywrapper>();
for(integer i=0; i<10; i++)
{
if(wrplst.size()!=0)
{
wrplst.add(new Mywrapper (acclst[i],conlst[i],opplst[i],ledlst[i],crdlst[i],emplst[i],stdlst[i],faclst[i],paylst[i],phmlst[i]));
}
}
}
public class Mywrapper{
public Account acc{get; set;}
public Contact con{get; set;}
public Opportunity opp{get; set;}
public Lead led{get; set;}
public CreditCard__c crd{get; set;}
public Employee__c emp{get; set;}
public Student__c stu{get; set;}
public faculty__c fac{get; set;}
public payment__c pay{get; set;}
public pharmacy__c phm{get; set;}
public Mywrapper(Account a,Contact c,Opportunity o,Lead l,CreditCard__c cr, Employee__c e,
Student__c s,faculty__c f,payment__c p,pharmacy__c ph)
{
acc=a;
con=c;
opp=o;
led=l;
crd=cr;
emp=e;
stu=s;
fac=f;
pay=p;
phm=ph;
}
}
}
- Devaraj 7
- November 13, 2017
- Like
- 0
- Continue reading or reply
- Devaraj 7
- October 16, 2017
- Like
- 0
- Continue reading or reply
- Devaraj 7
- October 12, 2017
- Like
- 0
- Continue reading or reply
How to display selected records(check box) of one page block table in another pageblocktable?
Hi i want to develop a page block table with all the account records ,each record contains a checkbox in the pageblocktable ,when a user check/select some records on the table and press show selected button it need to display selected records in another pageblocktable. i am new to this and i am in learning stage.i have referred http://wiki.developerforce.com/page/Wrapper_Class but the example wont work . I have developed visualforce code but confused with the adding controller and wrapperclass.can any one help me plsss.. Thanks&Regards Veer
- veeru417
- June 16, 2012
- Like
- 0
- Continue reading or reply