• sfdc_beginner7
  • NEWBIE
  • 5 Points
  • Member since 2017

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 3
    Questions
  • 5
    Replies
There is a custom object Designation which have 3 fields :
Employee_Designation (text) ,
Account_Name(look up to account),
Contact_Name(look up to contact)
I want to do  a duplicate check so that value in all the 3 field should be different.
Eg : Suppose there is an existing record in Designation
  Employee_Designation=Test Lead and Account_Name=Universal containers and Conatct_Name=Daniel Philz
i dont want any new or updated record to have same values in all 3 fields
If i go for duplicate management rule ,then the matching rule wont allow 2 look up fields.
How it can be done?
 
I have a below requirement  ,Need to create a custom object "Custom A"  which will have 2 look fields Account Name and Contact Name
.I need to create a vf page such that if I click on account name it shows me 10 records and a search box that
let me search account by putting 3 alphabets and same funcationality in contact name but it should search contact only related  to selected
account.

I have created a basic code .
Apex class
public class create_employee_mv {
    public List<String> listofAccountName {get;set;}
    public List<String> listofContactFirstName {get;set;}
    public Set<Id> AccId;
    public create_employee_mv(ApexPages.StandardController stdcntrl)
    {
        listofAccountName = new List<String>();
        Accid = new Set<Id>();
        for(Account a : [Select Id, Name,(select Employee_Designation__c from Employee_MVs__r)
                         from Account])
        {
         listofAccountName.add(a.name);
         Accid.add(a.id);
        }
        
        
    }

}

VF page
<apex:page standardController="Employee_MV__c" extensions="create_employee_mv" docType="html-5.0">
    <apex:form>
        
        <apex:inputText list="{!listofAccountName}"  /> &nbsp;
        <apex:inputField value="{!Contact_Name__c}"/>
        
    </apex:form>
</apex:page>



 
trigger prevent_duplicate_account on Account (before insert) {
    map<id,Account> mapAcc = new map<id,Account>([Select id,name,rating from Account ]);
    for(Account a : Trigger.new)
    {
        if(a.Name==mapAcc.get(a.id).name && a.rating==mapAcc.get(a.id).rating)
            a.adderror('you cant add duplicate account');
    }

}
I have already an account with name as IGA ,i am updating this account with rating =warm ,it is preventing to save record .since I have used && condition ,if both are true then only it should save the record to save . Also If i am creating a record with name as IGA and rating different from the previous one than also I am getting error .What can be done please help
Thanks in advance!!
I have a below requirement  ,Need to create a custom object "Custom A"  which will have 2 look fields Account Name and Contact Name
.I need to create a vf page such that if I click on account name it shows me 10 records and a search box that
let me search account by putting 3 alphabets and same funcationality in contact name but it should search contact only related  to selected
account.

I have created a basic code .
Apex class
public class create_employee_mv {
    public List<String> listofAccountName {get;set;}
    public List<String> listofContactFirstName {get;set;}
    public Set<Id> AccId;
    public create_employee_mv(ApexPages.StandardController stdcntrl)
    {
        listofAccountName = new List<String>();
        Accid = new Set<Id>();
        for(Account a : [Select Id, Name,(select Employee_Designation__c from Employee_MVs__r)
                         from Account])
        {
         listofAccountName.add(a.name);
         Accid.add(a.id);
        }
        
        
    }

}

VF page
<apex:page standardController="Employee_MV__c" extensions="create_employee_mv" docType="html-5.0">
    <apex:form>
        
        <apex:inputText list="{!listofAccountName}"  /> &nbsp;
        <apex:inputField value="{!Contact_Name__c}"/>
        
    </apex:form>
</apex:page>



 
trigger prevent_duplicate_account on Account (before insert) {
    map<id,Account> mapAcc = new map<id,Account>([Select id,name,rating from Account ]);
    for(Account a : Trigger.new)
    {
        if(a.Name==mapAcc.get(a.id).name && a.rating==mapAcc.get(a.id).rating)
            a.adderror('you cant add duplicate account');
    }

}
I have already an account with name as IGA ,i am updating this account with rating =warm ,it is preventing to save record .since I have used && condition ,if both are true then only it should save the record to save . Also If i am creating a record with name as IGA and rating different from the previous one than also I am getting error .What can be done please help
Thanks in advance!!
Hi Experts,

i have little confuse ,Why we are using test.start and test stop test methods in test class to batch apex ? Any one can demonstrate on this  .      pls don't paste the link.

Regards,
Chanti
Has anyone completed this trail? I am stomped on challenge number 3, regarding created the process for fulfillment. Any pointers or guidance would be appreciated.