• Manjusrinu
  • NEWBIE
  • 10 Points
  • Member since 2020

  • Chatter
    Feed
  • 0
    Best Answers
  • 1
    Likes Received
  • 0
    Likes Given
  • 22
    Questions
  • 18
    Replies

Hi ,

I have two fields in pardot forms , Out off those two fields i need to make atleast one field as manditory.

User-added imageHere Meet Summit AI or Courier it to me , atleast one should be ticked.But in the form fields , i have made it as both required.

I need to make one of them as required before submitting the forms.

Can anyone help me how to sort out this 

Hi,
I need to update lead owner based on course Interest and Batch(Number). I have wrote a trigger and working in lead insertion in ui .But when i insert leads from data loader ,Owners are not getting update as off my criteria. Can anyone help me where i am going wrong.

trigger LeadTrigger on Lead (before insert, before update) {
     String triggerEvent = '';
    if (Trigger.isBefore && Trigger.isInsert)
        triggerEvent = 'Before-Insert';
     LeadTriggerHelper obj = NEW LeadTriggerHelper ();  
    obj.AssigneeUser(triggerEvent,trigger.new);
}

//https://medium.com/@Naga801/salesforce-trigger-for-lead-round-robin-assignment-bcda7cc4193b :Reference
public class LeadTriggerHelper {
    public  void AssigneeUser(string event,List<Lead> newLeads) {
        LeadRoundRobinAssignment__c lrr = LeadRoundRobinAssignment__c.getOrgDefaults();
        Integer userIndex;
        Id queueId;
        Integer groupMemberSize;
        Boolean LeadQueueVal = false ;
        Boolean IIMLPMQueueVal = false;
        if(event == 'Before-Insert')
        {
            List<Group> queues = [
                SELECT Id,
                (Select Id, UserOrGroupId FROM GroupMembers Order By ID ASC)
                FROM Group
                WHERE Type = 'Queue' 
                AND DeveloperName = 'Lead_Queue' 
            ];
            // Lead-Queue : Dinesh,Rajesh,Harsha
            List<Group> IIML_PMQueues = [
                SELECT Id,
                (Select Id, UserOrGroupId FROM GroupMembers Order By ID ASC)
                FROM Group
                WHERE Type = 'Queue' 
                AND DeveloperName = 'IIML_PM'
            ];
            system.debug('HIIIIIIIIIIIIIIIIIIII'+queues.get(0).Id);
            // IIML_PM : Rajesh,jashwanth
            system.debug('P1111'+queues);
            system.debug('P222222'+IIML_PMQueues);
            if (queues.size() > 0 && queues.get(0).GroupMembers.size() > 0) {
                for (Lead eachLead : newLeads) {
                    if(eachLead.Course_Interest__c == 'IIML-SF' && (eachLead.Bucket__c == '1' || eachLead.Bucket__c == '2') ){
                        queueId = queues.get(0).Id;
                        groupMemberSize = queues.get(0).GroupMembers.size();
                        userIndex = (lrr.get('User_Index__c') == null || Integer.valueOf(lrr.get('User_Index__c')) < -1) 
                            ? -1 : Integer.valueOf(lrr.get('User_Index__c'));
                        if (eachLead.OwnerId != queueId) {
                            Integer leadUserIndex =  (userIndex + 1) >= groupMemberSize ? 0 : userIndex + 1;
                            eachLead.OwnerId = queues.get(0).GroupMembers.get(leadUserIndex).UserOrGroupId;
                            userIndex = leadUserIndex;
                            LeadQueueVal = true;
                        }
                    }
                    if(eachLead.Course_Interest__c == 'IIML-FA' && (eachLead.Bucket__c == '1'||eachLead.Bucket__c == '2') ) {
                        eachLead.OwnerId = '0052w0000018kFz'; // Rondey User
                    }
                }
                // Update the custom settings user index with the last lead assigned user
                if(LeadQueueVal == true){
                    lrr.User_Index__c = userIndex;
                    update lrr;
                }
            }
            
            if (IIML_PMQueues.size() > 0 && IIML_PMQueues.get(0).GroupMembers.size() > 0) {
                for (Lead eachLead1 : newLeads) {
                    if(eachLead1.Course_Interest__c =='IIML-PM' && (eachLead1.Bucket__c =='1' || eachLead1.Bucket__c =='2')){
                       system.debug('Executing');
                        queueId = IIML_PMQueues.get(0).Id;
                        system.debug('TTT'+queueId);
                        groupMemberSize = IIML_PMQueues.get(0).GroupMembers.size();
                        userIndex = (lrr.get('User_Index__c') == null || Integer.valueOf(lrr.get('User_Index__c')) < -1) 
                            ? -1 : Integer.valueOf(lrr.get('User_Index__c'));
                        if (eachLead1.OwnerId != queueId) {
                            Integer leadUserIndex =  (userIndex + 1) >= groupMemberSize ? 0 : userIndex + 1;
                            eachLead1.OwnerId = IIML_PMQueues.get(0).GroupMembers.get(leadUserIndex).UserOrGroupId;
                            userIndex = leadUserIndex;
                            IIMLPMQueueVal = true;
                        }
                    } 
                }
                // Update the custom settings user index with the last lead assigned user
                if(IIMLPMQueueVal == true) {
                    lrr.User_Index__c = userIndex;
                    update lrr;
                }
            }        
        }
    }
}

I  am able to pass the record id into lightning-component(From Vf page) ,but in the output page i am just getting Empty Form without any data populating .I should get Currrent Opp Details

I have seen that in console i am getting the Opportunity Id,But why data is not populating in input fields

Visualforce-Page : 

<apex:page standardController="Opportunity" extensions="PassingParaFromVfPageToCmp">
    <apex:includeLightning />
    <div  id="LightningCompContainer" />  <!--Used to display lightning component-->
     
    <script>
        $Lightning.use("c:EnrollemetFormApp", function() {
            $Lightning.createComponent("c:EnrollemetForm", {
            OppIdfromVfPage:"{!JSENCODE(Opportunity.Id)}"},
            "LightningCompContainer",
            function(cmp) {
               
            });
        });
    </script>
</apex:page>

Controller Method : 

public class PassingParaFromVfPageToCmp {
   public Id oppId;
public  PassingParaFromVfPageToCmp(Apexpages.StandardController stdcontroller) {
       oppId = Apexpages.currentPage().getParameters().get('id');
    system.debug('OPPPPP' +oppId);
}
}

Aura : Component :

<aura:component  controller="EnrollementFormCmp" implements="force:appHostable,flexipage:availableForAllPageTypes,flexipage:availableForRecordHome,force:hasRecordId,forceCommunity:availableForAllPageTypes,force:lightningQuickAction" 
                access="global" >
    <b> Details </b>
    <aura:attribute name="OppIdfromVfPage" type="string"/>
   <aura:handler name="init" value="{!this}" action="{!c.doInit}" />
     <aura:attribute name="Opp" type="Opportunity" default="{'SobjectType' : 'Opportunity'}"/>
    <div class="slds-p-around_Small">
            <lightning:recordEditForm objectApiName="Opportunity"
                                          recordId= '{!v.recordId}'>
                <lightning:messages />
                <lightning:inputField fieldName="Name" value="{!v.Name}" />
                <lightning:inputField fieldName="Actual_Cost__c" value="{!v.Actual_Cost__c}"/>
                <lightning:inputField fieldName="Requested_For_Loan_Assistance__c" value="{!v.Requested_For_Loan_Assistance__c}" />
                 <lightning:inputField fieldName="Account.Name" value="{!v.Account.Name}"/>
                 <lightning:inputField fieldName="Discount__c" value="{!v.Discount__c}" />
                 <lightning:inputField fieldName="Batch__c" value="{!v.Batch__c}" />
                <lightning:inputField fieldName="Course_Interest__c"  value="{!v.Course_Interest__c}"/>
                <center>
               <lightning:button variant="brand" label="Save" title="Brand action" />
                </center>
            </lightning:recordEditForm>
        </div>      
</aura:component>

Js.Method :

({
    doInit : function(component, event, helper) {
       var oppFromVfPage =component.get('v.OppIdfromVfPage');
        console.log('aaaaaaaaa'+ oppFromVfPage);
        var action = component.get("c.GetOpportunityDetails");
       action.setParams({ currentOppId : oppFromVfPage });
       $A.enqueueAction(action);
    }
})

Aura-Enabled Method :
public class EnrollementFormCmp {
    @AuraEnabled
    public static void  GetOpportunityDetails(Id currentOppId) {
        Opportunity opp = [SELECT Actual_Cost__c, Id,
                           Requested_For_Loan_Assistance__c,
                           Account.Name,
                           Discount__c,
                           Batch__c,Course_Interest__c FROM Opportunity where Id =:currentOppId ];
    }
}

 

Note : Vf-page is being called from cutom button from Opportunity Detail page . Can any one help me how to solve this issue

Hi ,

I am new to aura components . I have field where project records are to be displayed .On click of field I should get project records. I have tried and able to display input field ,but for displaying project records , i have no idea on how to do .Can anyone help me to solve my requirement .

<aura:component >
<div class="slds-align_absolute-center">
<lightning:layoutItem size="4"> <table> <tr>
<td style="padding:20px;">
<lightning:input type="sObject" aura:id="test" name="Project" label="Project" value="" placeholder="search project" onClick="{!c.handleClick}"/>
</td></tr>
</table>
</lightning:layoutItem>
</div>
</aura:component>
**Controller :**
public class ListOfProjects{
@AuraEnabled
public static List<project__c> getProjectList() {
List<project__c> myProjects = [SELECT Name from project__c ]; return myProjects;
}
}
**.Js file :**
({
handleClick : function(component, event, helper) {
var action = component.get("c.getProjectList");
action.setCallback(this, function(response) { console.log(response.getReturnValue());
component.set("v.Projects" ,response.getReturnValue());
});
$A.enqueueAction(action);
} })

My required outputCurrent output

Hi All,

I am iterating quote records ,

Now when the first quote record comes into loops ,i should get the associated prdouct price  which is linked to oppournity 

Can anyone help me how to query ?..

for(Quote eachQuote : oppournityQuotes) {
            if(eachQuote.Account.BillingState == 'Telangana'  && eachQuote.Oppournity.product2.listprice  ) {
}   

Hi ,

If someone visited my website for the first time ,i should know about the actions performed by the visitor using pardot .

if the same visitor visits for the second time i should know what he/she has done on the website using pardot 

Can anyone help ?..

Hi ,

I am trying to prevent duplicate email and at the same time i am updating count field on lead when i give the same email ..

The count should update on the existing email lead record .I am getting count updated value in debug logs,but on the record .

Can anyone help me out ?..

Trigger :

trigger LeadTrigger on Lead (before insert, before update) {
    if(trigger.isInsert || trigger.isUpdate) { 
    Leaddupliacateemailpreventor dupEmail = new Leaddupliacateemailpreventor();
    dupEmail.duplicateEmail(trigger.new);
    }
    }
    
Helper class :
public class Leaddupliacateemailpreventor {
    public void duplicateEmail (List<Lead> Records) {
        Map<string,Lead> leadRecords = new Map<string,Lead>();
        List<Lead> myLeads = new List<Lead>();
        myLeads = [SELECT id,Email ,Email_count__c from Lead where Email != null];
        for(Lead ll :myLeads) {
            if(!(leadRecords.containsKey(ll.Email))) {
                leadRecords.put(ll.Email ,ll); 
            }
        }
        system.debug('ssssssssssss' + leadRecords.keySet());
        for(Lead newRecord : Records) {
            if(leadRecords.ContainsKey(newRecord.Email)) { 
                newRecord.Email.addError('Email exists'); 
                if( leadRecords.get(newRecord.Email).Email_count__c != null ) {
                    leadRecords.get(newRecord.Email).Email_count__c = leadRecords.get(newRecord.Email).Email_count__c +1;
                } 
                else {
                    leadRecords.get(newRecord.Email).Email_count__c = 1;
                }
            } 
            System.debug('hhhhhh   ' + leadRecords.get(newRecord.Email).Email_count__c );
        } 
    }
}

Hi ,
I have custom object called Campaignaccount__c ,with lokkup related to account called(Related account) ,when i creating new Record ,if account doesnt have oppournities with the related Campaigaccount record it should create a new oppournity record with the camapignaccount Record name , I nedd to perform this with bulk insertions .
I have the following code for only one Record and its working fine .
Can anyone help me how to perform this for bulk records  ?



Helper class : 
public class CampaignaccountTriggerhelper {
    string accountName ;
    public void insertUpdateRecords (List<Campaignaccount__c> campaignRecords ) {
        set<Id> camapignAccounts = new set<Id>();
        for(Campaignaccount__c cmp  : campaignRecords) {
            if(cmp.RelatedAccount__c != null) {
                accountName = cmp.Name;                
                camapignAccounts.add(cmp.RelatedAccount__c);
            } 
        }
        List<Opportunity> oppRecords = new List<Opportunity>([select Name,    Campaigncount__c,
                                                              AccountId from Opportunity
                                                              where AccountId in :camapignAccounts AND 
                                                              Name =: accountName  ] );
        if(oppRecords.size() >0 ) {
            for(Opportunity opp : oppRecords ) {
                 opp.Campaigncount__c = 0;
                opp.Campaigncount__c = opp.Campaigncount__c + 1; 
            }
update oppRecords ;
        } 
        if(oppRecords.size() == 0) {
            Opportunity a = new Opportunity(
                Name=accountName ,
                Campaigncount__c = 0,
                CloseDate = system.today() ,
                StageName = 'Closed Lost');
                 insert a;
        }   
    }  
}


Trigger :
Trigger CampaignaccountTrigger on Campaignaccount__c (after insert) {
CampaignaccountTriggerhelper myCamp = new CampaignaccountTriggerhelper();
    myCamp.insertUpdateRecords (Trigger.New); 

Hi,

I have a senario where i need to display phone field on vf page when Leadsource in contact is equal to "other" .I am perfect with page and controller and functionality is working gd .But when comming to test class it is not covering boolean variable . i,e the below highlited line is not covering ...

Can anyone please check it out ?

controller class :

public class ActionFunctionExample {
    public Contact  con{get;set;}
    public Boolean phone{get;set;}
    public ActionFunctionExample() {
        con=new Contact (); 
    }
    public pagereference clickandchange() {
        if(con.LeadSource=='Other') {
           phone=true; 
        }
        else{
            phone= false;
        }
        return null;
    }
}.

Test class :

@istest
public class ActionFunctiontest_TC {
    public static testmethod void testForActiofunction() {
        contact mycon = new contact();
        mycon.LastName='raghu';
        mycon.LeadSource = 'Other';
        mycon.HomePhone= '2483742';
        insert mycon ; 
        ActionFunctionExample ac = new ActionFunctionExample();
        ac.clickandchange();
        
    }
}

Hi i have a senario where i should write a batch class to add oppournities whose stage is need analysis and type is new oppournity and Age of oppurnity__c should be greater than 15 days ,My functionality is working fine but test class is not getting code coverage 100 percentage 

So can anyone helpme to find out the problem 

Batch class :

global class Batchforaddingoppournitytoaccount implements Database.Batchable<sobject>{
    global Database.QueryLocator start(Database.BatchableContext BC){
        string oppRecords = 'SELECT id, Name, StageName, Type, Age_of_oppournity__c FROM Opportunity';
        return Database.getQueryLocator(oppRecords);
    }
    global void execute(Database.BatchableContext BC , List<Opportunity> oppList){
        string addingRecords = Label.Account_Record; // holding my account id in custom label//
        List<Opportunity> oppournityListupdate = new List<Opportunity>(); 
        for(Opportunity eachoppournity : oppList){
            if(eachoppournity.Type == 'New Opportunity' && eachoppournity.StageName == 'Needs Analysis' && 
               eachoppournity.Age_of_oppournity__c >= 15){ 
                eachoppournity.AccountId = addingRecords;
                oppournityListupdate.add(eachoppournity);
            } 
        }
        if(oppournityListupdate.size() > 0){
            update oppournityListupdate;
        }
    }
    global void finish(DataBase.BatchableContext BC){ 
        
    }
}

 

Test Class :

@isTest
public class Testforbatchoppournityrecords_TC {
    public  static testMethod void oppournityRecordstest(){
        string accountRecordid = Label.Account_Record;
        List<Opportunity> updatingOppournities = new List<Opportunity>();
        Opportunity opp = new Opportunity ();
        opp.Name= 'smart mobiles';  
        opp.Type ='New Business';
        opp.StageName = 'Needs Analysis'; 
        opp.CloseDate=date.today().addMonths(3);
        insert opp;
        test.startTest();
        Batchforaddingoppournitytoaccount b = new Batchforaddingoppournitytoaccount();
        DataBase.executeBatch(b); 
        test.stopTest();
    }
}

Hi i have a senario where
1. if contact email is already existed , while inserting or updating the contact  ,it should throw an error (Email already exists with the name ) 
2. if i change the contact owner ,the related account owner should also be changed .

I have written the following code and working fine , but every time Email error is throwing for me ,even if i change the owner of contact record. 

Trigger : 

trigger Contacttrigger on Contact (before insert,before update ,after update) {
    Contacttriggerhandler helper = new Contacttriggerhandler(); 
        if(trigger.isBefore) {
            if(trigger.isInsert || trigger.isUpdate) {
            helper.checkEmailfields(trigger.new);
            }  
        } 
   if(trigger.isAfter){
    if(trigger.isUpdate){
            helper.changeOwner(trigger.new);             
        }
    } 
}

Handler class :

public class Contacttriggerhandler {
    public void checkEmailfields(List<contact> contactEmailchecks){
        List<contact> contactEmails =  new list<contact>();
        contactEmails = [select email from contact];
        for(contact con :contactEmailchecks ){
            for(contact exconmail : contactEmails){
                if(con.Email == exconmail.Email){ 
                    con.Email.addError('email already exists with the given email id');
                }
            }
        }
public void changeOwner( List<contact>  contactRecords){
        set<Id> contactRelatedaccount = new set<Id>();
        List<Account> accountUpdate = new List<Account>();
        string contactOwner; 
        for(contact con : contactRecords){
            if(con.AccountId != null){
                contactOwner = con.ownerId;
                contactRelatedaccount.add(con.AccountId);
            }
        }
        for(Account linkedAccount : [select id from Account where id in : contactRelatedaccount]){
            linkedaccount.ownerId = contactOwner;
            accountUpdate.add(linkedAccount);
        } 
        update accountUpdate;
    }
    } 

 

Hi,
I need to change the owner of account Records (Mannually)

when I manually change the record owner ,owner field is not getting changed , I think Account Name Having some hierarchy issue, so i am not able to change the record. Can anyone suggest me how to remove the Hierarchy option ?  Orelse why my account owner is not getting changed . Check the below image ( why i am getting this view hierarchy option )

Hi ,

I have a senario in which 2 users are in same profile,I have enabled one visual force page in the profile level

My second user should not have the access permision in-order to view the vf page  where as my first user can have the permission to view the vf page.
If my second user clicks on preview an error message should be shown him(You have no access to view the page)

Can anyone suggest me to solve the problem without using permission sets ??

Hi,
I have created a custom tab that needs to be posted on vf page,I am getting the output but not in the correct way  
The below is my code 

Can anyone help me to solve the issue ?

<apex:tabPanel switchType="client" >
        <apex:tab label="Home">Home content</apex:tab>
        <apex:tab label="Contacts">Contacts content</apex:tab>
        <apex:tab label="Achievements">Achievements content</apex:tab>
    </apex:tabPanel>

I am not getting the default stylings of the custom tabs

The image shows my output for the above code

Hi ,
i have a task that when my vf page gets loads i should dispaly accounts and when i click on show contcats button ,the related contacts should dispaly and when i click on show oppournity ,the related oppournities should be displayed .
I wrote the following code and i have no problem on dispalying accounts and contacts.
when i click on show opppournities it is dispalying url doesnt exist
Can anyone help me to figure it out ??
VF-PAGE:
<apex:page controller="AccountContactOppournitydisplay" action="{!getContacts}">
  <apex:form >
      <apex:pageBlock >
        <apex:pageBlockTable value="{!listOfAccounts}" var="r">
            <apex:column value="{!r.Name}"/>
            <apex:column value="{!r.Rating}"/>
        </apex:pageBlockTable>
          <apex:commandButton value="Show contacts" action="/apex//clickactiondisplayContact"/>
        </apex:pageBlock>
   </apex:form>
</apex:page>

CLASS:

public class AccountContactOppournitydisplay
{
 public list<Account>listOfAccounts{get;set;}
 public list<Contact>listOfContacts{get;set;}
 public list<Opportunity>listOfoppournities{get;set;}
  
 public AccountContactOppournitydisplay()
 {
     try
      {
         listOfAccounts=new list<Account>();
        listOfAccounts=[select id,Name,Rating from Account order by Name limit 5];
        system.debug('list of accounts'+listOfAccounts);
       }catch(NullPointerException e)
         {system.debug('null exception');}
  }
      public void  getContacts()
        {
         try{
            listOfContacts=new list<Contact>();
            listOfContacts=[select id,Name from contact where AccountId IN :listOfAccounts];
            system.debug('contactlists'+listOfContacts);
          }
            catch(NullpointerException e)
            {system.debug('Exception raised');}
            }
    
        public void getOppournities()
        {
            try{
          listOfoppournities=new list<Opportunity>();
          listOfoppournities=[select id,Name from Opportunity where account.id IN:listOfAccounts limit 5];
            system.debug('oppournities '+listOfoppournities);
        }
            catch(nullpointerexception e)
            {
                system.debug('Exception raised');
            }
        }
   
}


VF PAGE 2: DISPLAYS CONTACTS

<apex:page controller="AccountContactOppournitydisplay" action="{!getcontacts}" >
  <apex:form >
    <apex:pageBlock >
        <apex:pageBlockTable value="{!listOfcontacts}" var="a">
            <apex:column value="{!a.Name}"/>
              <apex:column value="{!a.id}"/>
        </apex:pageBlockTable>
        <apex:commandButton value="Show oppournities" action="/apex//clickactiondisplayOppournity"/>
       </apex:pageBlock>
    </apex:form>
</apex:page>


VF-PAGE3:
<apex:page controller="AccountContactOppournitydisplay" action="{!getOppournities}" >
  <apex:form >
    <apex:pageBlock >
        <apex:pageBlockTable value="{!listOfoppournities}" var="k">
            <apex:column value="{!k.Name}"/>
              <apex:column value="{!k.id}"/>
        </apex:pageBlockTable>
        </apex:pageBlock>
    </apex:form>
</apex:page>

ERROR:URL DOES NO LONGER EXIST (ONLY WHEN I CLICK ON SHOW OPPOURNITIES"
Hi,
I have a custom field called Type of picklist (picklist values are same as off type values on account object).
I need to get all the contacts related to account and auto update the Type field on contact object with a value same as off to that account..

I tried the following code ,it is not showing any errors but my field on contact is not updating.

Can anyone hlepme to solve the issue ?
Apex Class:
public class UpdatingtypefieldonContact {
    public Map<list<Account>,list<Contact>> maplist{get;set;}// getting list of id(accounts) and values(contacts) //
    list<Contact> updatedlist{get;set;}
    public void updatetypefield()
    {
      maplist=new Map<list<Account>,list<Contact>>();
       list<Account> accountlist=new list<Account>();
       list<Contact> contactlist=new list<Contact>();
       list<Contact> updatedlist=new list<Contact>(); // list after updating type field//
       accountlist=[select id,name,Type from Account];
         contactlist=[select id,name,Accountid,Type__c from Contact where Accountid in:accountlist]; 
        maplist.put(accountlist,contactlist);
       // system.debug(maplist);//
           for(Account aa:accountlist)
           {
          for(Contact cc:contactlist)
          {
            if(cc.Type__c=='null')
             {
                  cc.Type__c=aa.Type;
                 updatedlist.add(cc);
              }
          }
        }
        update updatedlist;
        maplist.put(accountlist,updatedlist);
        system.debug(maplist);
     }
}

 
Hi,
I need to insert a record into account object by using lists.
I tried the following code but it is not working 
Can anyone help me to solve out the problem ?

Apex-class:
public class Listaccounts 
{
  public static  void accounts()
   {
    List<Account> myList = new List<Account>(); 
    Account a = new Account(Name='ramana'); 
    myList.add(a);                    
    }
}

Vf-page:
<apex:page Controller=" Listaccounts ">
</apex:page>
Hi
I need a test class for the below requirement 

At the time of contact insertion/updation, check with the email field, if email already exist in database then throw an error .
my Trigger name:contactDuplicatePreventer

Hi All,

I need to have a test class for the below requirement 

.Display list of accounts in a block with checkbox, if the user selects the accounts and click on "show selected Account " button the accounts should display in the pageBlocktable beside the accounts list block
My visaul force page is ready with me ,can anyone help me how to write test class for the above problem ?

Hi All,

I need to have a test class for the below task

At the time of contact insertion/updation, check with the email field, if email already exist in database then throw an error.

Can anyone help me how to figure out that ?

Hi,
I have a custom field called Type of picklist (picklist values are same as off type values on account object).
I need to get all the contacts related to account and auto update the Type field on contact object with a value same as off to that account..

I tried the following code ,it is not showing any errors but my field on contact is not updating.

Can anyone hlepme to solve the issue ?
Apex Class:
public class UpdatingtypefieldonContact {
    public Map<list<Account>,list<Contact>> maplist{get;set;}// getting list of id(accounts) and values(contacts) //
    list<Contact> updatedlist{get;set;}
    public void updatetypefield()
    {
      maplist=new Map<list<Account>,list<Contact>>();
       list<Account> accountlist=new list<Account>();
       list<Contact> contactlist=new list<Contact>();
       list<Contact> updatedlist=new list<Contact>(); // list after updating type field//
       accountlist=[select id,name,Type from Account];
         contactlist=[select id,name,Accountid,Type__c from Contact where Accountid in:accountlist]; 
        maplist.put(accountlist,contactlist);
       // system.debug(maplist);//
           for(Account aa:accountlist)
           {
          for(Contact cc:contactlist)
          {
            if(cc.Type__c=='null')
             {
                  cc.Type__c=aa.Type;
                 updatedlist.add(cc);
              }
          }
        }
        update updatedlist;
        maplist.put(accountlist,updatedlist);
        system.debug(maplist);
     }
}

 

Hi ,

I am new to aura components . I have field where project records are to be displayed .On click of field I should get project records. I have tried and able to display input field ,but for displaying project records , i have no idea on how to do .Can anyone help me to solve my requirement .

<aura:component >
<div class="slds-align_absolute-center">
<lightning:layoutItem size="4"> <table> <tr>
<td style="padding:20px;">
<lightning:input type="sObject" aura:id="test" name="Project" label="Project" value="" placeholder="search project" onClick="{!c.handleClick}"/>
</td></tr>
</table>
</lightning:layoutItem>
</div>
</aura:component>
**Controller :**
public class ListOfProjects{
@AuraEnabled
public static List<project__c> getProjectList() {
List<project__c> myProjects = [SELECT Name from project__c ]; return myProjects;
}
}
**.Js file :**
({
handleClick : function(component, event, helper) {
var action = component.get("c.getProjectList");
action.setCallback(this, function(response) { console.log(response.getReturnValue());
component.set("v.Projects" ,response.getReturnValue());
});
$A.enqueueAction(action);
} })

My required outputCurrent output

Hi ,

I am trying to prevent duplicate email and at the same time i am updating count field on lead when i give the same email ..

The count should update on the existing email lead record .I am getting count updated value in debug logs,but on the record .

Can anyone help me out ?..

Trigger :

trigger LeadTrigger on Lead (before insert, before update) {
    if(trigger.isInsert || trigger.isUpdate) { 
    Leaddupliacateemailpreventor dupEmail = new Leaddupliacateemailpreventor();
    dupEmail.duplicateEmail(trigger.new);
    }
    }
    
Helper class :
public class Leaddupliacateemailpreventor {
    public void duplicateEmail (List<Lead> Records) {
        Map<string,Lead> leadRecords = new Map<string,Lead>();
        List<Lead> myLeads = new List<Lead>();
        myLeads = [SELECT id,Email ,Email_count__c from Lead where Email != null];
        for(Lead ll :myLeads) {
            if(!(leadRecords.containsKey(ll.Email))) {
                leadRecords.put(ll.Email ,ll); 
            }
        }
        system.debug('ssssssssssss' + leadRecords.keySet());
        for(Lead newRecord : Records) {
            if(leadRecords.ContainsKey(newRecord.Email)) { 
                newRecord.Email.addError('Email exists'); 
                if( leadRecords.get(newRecord.Email).Email_count__c != null ) {
                    leadRecords.get(newRecord.Email).Email_count__c = leadRecords.get(newRecord.Email).Email_count__c +1;
                } 
                else {
                    leadRecords.get(newRecord.Email).Email_count__c = 1;
                }
            } 
            System.debug('hhhhhh   ' + leadRecords.get(newRecord.Email).Email_count__c );
        } 
    }
}

Hi ,
I have custom object called Campaignaccount__c ,with lokkup related to account called(Related account) ,when i creating new Record ,if account doesnt have oppournities with the related Campaigaccount record it should create a new oppournity record with the camapignaccount Record name , I nedd to perform this with bulk insertions .
I have the following code for only one Record and its working fine .
Can anyone help me how to perform this for bulk records  ?



Helper class : 
public class CampaignaccountTriggerhelper {
    string accountName ;
    public void insertUpdateRecords (List<Campaignaccount__c> campaignRecords ) {
        set<Id> camapignAccounts = new set<Id>();
        for(Campaignaccount__c cmp  : campaignRecords) {
            if(cmp.RelatedAccount__c != null) {
                accountName = cmp.Name;                
                camapignAccounts.add(cmp.RelatedAccount__c);
            } 
        }
        List<Opportunity> oppRecords = new List<Opportunity>([select Name,    Campaigncount__c,
                                                              AccountId from Opportunity
                                                              where AccountId in :camapignAccounts AND 
                                                              Name =: accountName  ] );
        if(oppRecords.size() >0 ) {
            for(Opportunity opp : oppRecords ) {
                 opp.Campaigncount__c = 0;
                opp.Campaigncount__c = opp.Campaigncount__c + 1; 
            }
update oppRecords ;
        } 
        if(oppRecords.size() == 0) {
            Opportunity a = new Opportunity(
                Name=accountName ,
                Campaigncount__c = 0,
                CloseDate = system.today() ,
                StageName = 'Closed Lost');
                 insert a;
        }   
    }  
}


Trigger :
Trigger CampaignaccountTrigger on Campaignaccount__c (after insert) {
CampaignaccountTriggerhelper myCamp = new CampaignaccountTriggerhelper();
    myCamp.insertUpdateRecords (Trigger.New); 

Hi i have a senario where i should write a batch class to add oppournities whose stage is need analysis and type is new oppournity and Age of oppurnity__c should be greater than 15 days ,My functionality is working fine but test class is not getting code coverage 100 percentage 

So can anyone helpme to find out the problem 

Batch class :

global class Batchforaddingoppournitytoaccount implements Database.Batchable<sobject>{
    global Database.QueryLocator start(Database.BatchableContext BC){
        string oppRecords = 'SELECT id, Name, StageName, Type, Age_of_oppournity__c FROM Opportunity';
        return Database.getQueryLocator(oppRecords);
    }
    global void execute(Database.BatchableContext BC , List<Opportunity> oppList){
        string addingRecords = Label.Account_Record; // holding my account id in custom label//
        List<Opportunity> oppournityListupdate = new List<Opportunity>(); 
        for(Opportunity eachoppournity : oppList){
            if(eachoppournity.Type == 'New Opportunity' && eachoppournity.StageName == 'Needs Analysis' && 
               eachoppournity.Age_of_oppournity__c >= 15){ 
                eachoppournity.AccountId = addingRecords;
                oppournityListupdate.add(eachoppournity);
            } 
        }
        if(oppournityListupdate.size() > 0){
            update oppournityListupdate;
        }
    }
    global void finish(DataBase.BatchableContext BC){ 
        
    }
}

 

Test Class :

@isTest
public class Testforbatchoppournityrecords_TC {
    public  static testMethod void oppournityRecordstest(){
        string accountRecordid = Label.Account_Record;
        List<Opportunity> updatingOppournities = new List<Opportunity>();
        Opportunity opp = new Opportunity ();
        opp.Name= 'smart mobiles';  
        opp.Type ='New Business';
        opp.StageName = 'Needs Analysis'; 
        opp.CloseDate=date.today().addMonths(3);
        insert opp;
        test.startTest();
        Batchforaddingoppournitytoaccount b = new Batchforaddingoppournitytoaccount();
        DataBase.executeBatch(b); 
        test.stopTest();
    }
}

Hi i have a senario where
1. if contact email is already existed , while inserting or updating the contact  ,it should throw an error (Email already exists with the name ) 
2. if i change the contact owner ,the related account owner should also be changed .

I have written the following code and working fine , but every time Email error is throwing for me ,even if i change the owner of contact record. 

Trigger : 

trigger Contacttrigger on Contact (before insert,before update ,after update) {
    Contacttriggerhandler helper = new Contacttriggerhandler(); 
        if(trigger.isBefore) {
            if(trigger.isInsert || trigger.isUpdate) {
            helper.checkEmailfields(trigger.new);
            }  
        } 
   if(trigger.isAfter){
    if(trigger.isUpdate){
            helper.changeOwner(trigger.new);             
        }
    } 
}

Handler class :

public class Contacttriggerhandler {
    public void checkEmailfields(List<contact> contactEmailchecks){
        List<contact> contactEmails =  new list<contact>();
        contactEmails = [select email from contact];
        for(contact con :contactEmailchecks ){
            for(contact exconmail : contactEmails){
                if(con.Email == exconmail.Email){ 
                    con.Email.addError('email already exists with the given email id');
                }
            }
        }
public void changeOwner( List<contact>  contactRecords){
        set<Id> contactRelatedaccount = new set<Id>();
        List<Account> accountUpdate = new List<Account>();
        string contactOwner; 
        for(contact con : contactRecords){
            if(con.AccountId != null){
                contactOwner = con.ownerId;
                contactRelatedaccount.add(con.AccountId);
            }
        }
        for(Account linkedAccount : [select id from Account where id in : contactRelatedaccount]){
            linkedaccount.ownerId = contactOwner;
            accountUpdate.add(linkedAccount);
        } 
        update accountUpdate;
    }
    } 

 

Hi,
I have created a custom tab that needs to be posted on vf page,I am getting the output but not in the correct way  
The below is my code 

Can anyone help me to solve the issue ?

<apex:tabPanel switchType="client" >
        <apex:tab label="Home">Home content</apex:tab>
        <apex:tab label="Contacts">Contacts content</apex:tab>
        <apex:tab label="Achievements">Achievements content</apex:tab>
    </apex:tabPanel>

I am not getting the default stylings of the custom tabs

The image shows my output for the above code

Hi ,
i have a task that when my vf page gets loads i should dispaly accounts and when i click on show contcats button ,the related contacts should dispaly and when i click on show oppournity ,the related oppournities should be displayed .
I wrote the following code and i have no problem on dispalying accounts and contacts.
when i click on show opppournities it is dispalying url doesnt exist
Can anyone help me to figure it out ??
VF-PAGE:
<apex:page controller="AccountContactOppournitydisplay" action="{!getContacts}">
  <apex:form >
      <apex:pageBlock >
        <apex:pageBlockTable value="{!listOfAccounts}" var="r">
            <apex:column value="{!r.Name}"/>
            <apex:column value="{!r.Rating}"/>
        </apex:pageBlockTable>
          <apex:commandButton value="Show contacts" action="/apex//clickactiondisplayContact"/>
        </apex:pageBlock>
   </apex:form>
</apex:page>

CLASS:

public class AccountContactOppournitydisplay
{
 public list<Account>listOfAccounts{get;set;}
 public list<Contact>listOfContacts{get;set;}
 public list<Opportunity>listOfoppournities{get;set;}
  
 public AccountContactOppournitydisplay()
 {
     try
      {
         listOfAccounts=new list<Account>();
        listOfAccounts=[select id,Name,Rating from Account order by Name limit 5];
        system.debug('list of accounts'+listOfAccounts);
       }catch(NullPointerException e)
         {system.debug('null exception');}
  }
      public void  getContacts()
        {
         try{
            listOfContacts=new list<Contact>();
            listOfContacts=[select id,Name from contact where AccountId IN :listOfAccounts];
            system.debug('contactlists'+listOfContacts);
          }
            catch(NullpointerException e)
            {system.debug('Exception raised');}
            }
    
        public void getOppournities()
        {
            try{
          listOfoppournities=new list<Opportunity>();
          listOfoppournities=[select id,Name from Opportunity where account.id IN:listOfAccounts limit 5];
            system.debug('oppournities '+listOfoppournities);
        }
            catch(nullpointerexception e)
            {
                system.debug('Exception raised');
            }
        }
   
}


VF PAGE 2: DISPLAYS CONTACTS

<apex:page controller="AccountContactOppournitydisplay" action="{!getcontacts}" >
  <apex:form >
    <apex:pageBlock >
        <apex:pageBlockTable value="{!listOfcontacts}" var="a">
            <apex:column value="{!a.Name}"/>
              <apex:column value="{!a.id}"/>
        </apex:pageBlockTable>
        <apex:commandButton value="Show oppournities" action="/apex//clickactiondisplayOppournity"/>
       </apex:pageBlock>
    </apex:form>
</apex:page>


VF-PAGE3:
<apex:page controller="AccountContactOppournitydisplay" action="{!getOppournities}" >
  <apex:form >
    <apex:pageBlock >
        <apex:pageBlockTable value="{!listOfoppournities}" var="k">
            <apex:column value="{!k.Name}"/>
              <apex:column value="{!k.id}"/>
        </apex:pageBlockTable>
        </apex:pageBlock>
    </apex:form>
</apex:page>

ERROR:URL DOES NO LONGER EXIST (ONLY WHEN I CLICK ON SHOW OPPOURNITIES"
Hi,
I need to insert a record into account object by using lists.
I tried the following code but it is not working 
Can anyone help me to solve out the problem ?

Apex-class:
public class Listaccounts 
{
  public static  void accounts()
   {
    List<Account> myList = new List<Account>(); 
    Account a = new Account(Name='ramana'); 
    myList.add(a);                    
    }
}

Vf-page:
<apex:page Controller=" Listaccounts ">
</apex:page>
Hi
I need a test class for the below requirement 

At the time of contact insertion/updation, check with the email field, if email already exist in database then throw an error .
my Trigger name:contactDuplicatePreventer
Hi,
I need to dispaly an apex:message in my center of my vf page 
how can i do that ?
Below are the code of both queueable apex and batch class.
public class sendEmailsExtended implements Queueable{
    
    private static List<Email_Log__c> emailDebugLogs = new List<Email_Log__c>();
    map<String,TimeEmailRules__c> allRules;
    private Boolean sendEmails = true;
    
    public sendEmailsExtended(map<String,TimeEmailRules__c> query){
        allRules=query;
    }
    public void execute(QueueableContext qc){
        Messaging.SingleEmailMessage mail1 = new Messaging.SingleEmailMessage();
        mail1.toAddresses=new List<String>{'abhishek.singh@yopmail.com','bkevat@yopmail.com','varun.singh@yopmail.com'};
        mail1.optOutPolicy='FILTER';
        mail1.subject='Subject Test Message';
        mail1.plainTextBody='This is the message body.';
        //Messaging.SingleEmailMessage mail2 = new Messaging.SingleEmailMessage(toAddresses='abc1@gmail.com',optOutPolicy='FILTER',subject='Subject Test Message',plainTextBody='This is the message body.');
        //Messaging.SingleEmailMessage mail3 = new Messaging.SingleEmailMessage(toAddresses='abc1@gmail.com',optOutPolicy='FILTER',subject='Subject Test Message',plainTextBody='This is the message body.');
            
        sendEmailsBatchExtended batch = new sendEmailsBatchExtended(new List<Messaging.SingleEmailMessage>{mail1});
        Id batchjobId =Database.executebatch(batch,1);
}
}

Batch class Code
global class sendEmailsBatchExtended implements Database.Batchable<sObject>,Database.Stateful{
    List<Messaging.SingleEmailMessage> mailtosend;
    String query;
    public sendEmailsBatchExtended(List<Messaging.SingleEmailMessage> maillist){
    mailtosend = maillist;   
    }
    global Iterable<sObject> start(Database.BatchableContext bc){
        return Database.getQueryLocator(query);
    }
    global void execute(Database.BatchableContext bc,List<sObject> scope){
    System.debug('value in mailtosend'+mailtosend);
    }
    global void finish(Database.BatchableContext bc){
    }
}
Hi All,
I am developing one visualforce page which render as word doc,but the footer is displayed twice in the last page.
=============================sample code=========================
<apex:page standardController="Case"   sidebar="false" showHeader="false"  contentType="application/msword" cache="true" >
    
<head>
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8" />
     <style type="text/css">
     
                
         p.MsoHeader, li.MsoHeader, div.MsoHeader{
                    margin:0in;
                    margin-top:.0001pt;
                    mso-pagination:widow-orphan;
                    tab-stops:center 3.0in right 6.0in;
                }
                p.MsoFooter, li.MsoFooter, div.MsoFooter{
                    margin:0in;
                    margin-bottom:.0001pt;
                    mso-pagination:widow-orphan;
                    tab-stops:center 3.0in right 6.0in;
                }
                @page Section1{
                    size:8.5in 11.0in; 
                    margin:0.5in 0.5in 0.5in 0.5in;
                    mso-header-margin:0.5in;
               
                    mso-footer:f1; 
                    mso-footer-margin:0.5in;
                    mso-paper-source:0;
                }
                div.Section1{
                    page:Section1;
                }
                table#hrdftrtbl{
                    margin:0in 0in 0in 9in;
                }
            </style>
</head> 
     <apex:form >
    
    <body>
     <br clear="all" style="page-break-before:always" />
        <div class="Section1">
           <table width="100%" border="1" >
                <tr>
                  <td width="40%" align="Center" style="margin-left: -20px;">
                           
                         
                       <apex:image  width="150" height="75"/>
                       
                   </td>
                    <td width="40%" align="center" >
                     <b><span style="font-size: 20px;">Test Report </span></b><br/>
                     <b><span style="font-size: 16px;padding-left: 5px;">Test Report</span></b> 
                  </td> 
                  
                     <td width="20%" align="center">
                    <span >Created Date:</span> <br/>
                    <apex:outputText value="{0,date,dd'.'MM'.'yyyy}">
                            <apex:param value="{!today()}"/>
                            </apex:outputText><br/>
                            <span style="font-size: 16px;padding-left: 5px;">Version 1</span>
                                               
                         </td>
                
                    
                    
                    
                    
                    </tr> 
                 
            </table><br/>
            
               
            
            </div>
            <div style='mso-element:footer' id="f1" >
                               
                                    <table width="100%" border="0" cellspacing="0" cellpadding="0" >
                                     <p class="MsoFooter">
                                        <tr>
                                            <td width="50%" word-spacing="5px">
                                                Constructed: SHEQ{!$User.FirstName} {!$User.LastName}<br/>
                                                VA 7.5.1 Steering documented information of conformity
                                            </td>
                                            <td align="center" width="20%">
                                           <apex:outputText value="{0,date,dd'.'MM'.'yyyy}">
                                            <apex:param value="{!Case.CreatedDate}"/>
                                            </apex:outputText>
                                            </td>
                                            <td align="center" width="30%">
                                                Page <span style='mso-field-code: PAGE '></span> of <span style='mso-field-code: NUMPAGES '></span>
                                                <br/>
                                                Print Date:<apex:outputText value="{0,date,dd'.'MM'.'yyyy}">
                                                <apex:param value="{!today()}"/>
                                                </apex:outputText>
                                            </td>
                                        </tr>
                                        </p>
                                    </table>
                                
                            </div>
                 
                          
        </body>
        
        </apex:form>
        
      
        </apex:page>
=================================================================
=====================sample output============================
User-added image
============================================================
Hi All,
I am trying to display case object content to word document,everything is successfull except two things.
1.Footer is displaying under the header information.
2.Image is not displayed when the word document is downloaded.

==============Sample Code and out put ===================================
<head>
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8" />
     <style type="text/css">
     
                
             p.MsoFooter, li.MsoFooter, div.MsoFooter{
                    margin:0in;
                    margin-bottom:.0001pt;
                    mso-pagination:widow-orphan;
                    tab-stops:center 3.0in right 6.0in;
                }
                @page Section1{
                    size:8.5in 11.0in; 
                    margin:0.5in 0.5in 0.5in 0.5in;
                    mso-footer:f1; 
                    mso-footer-margin:0.5in;
                    mso-paper-source:0;
                }
                div.Section1{
                    page:Section1;
                }
                /*Below is the style to prevent the repetition of header and Footer.. Cheers!!!*/
                table#hrdftrtbl{
                margin:0in 0in 0in 15in;
            } 
                
            </style>
</head> 
     <apex:form >
   
    <body>
    
        <div class="Section1">
           <table width="100%" border="1" id="hrdftrtbl">
             <td>
             <div>
              <!--Header-->
             <!--<div style='mso-element:header' id="h1" >
             <p class="MsoHeader">-->
                <tr >
                  <td width="40%" align="Center" style="margin-left: -20px;">
                           
                            <apex:image value="https://c.cs84.content.force.com/servlet/servlet.ImageServer?id=0155E0000001AK5QAM&oid=00D5E0000004byY&lastMod=1455786672000&contentType=image/png" width="150" height="75"/>
                   </td>
                    <td width="40%" align="center" >
                     <b><span style="font-size: 14.5px;">test </span></b><br/>
                     <b><span style="font-size: 16px;padding-left: 5px;">test</span></b> 
                  </td> 
                  
                     <td width="20%" align="center">
                    <span >Created Date:</span> <br/>
                    <apex:outputText value="{0,date,dd'-'MMM'-'yyyy}">
                            <apex:param value="{!Case.CreatedDate}"/>
                            </apex:outputText>
                    
                       </td>     
                    </tr> 
                <!--</p>-->
                 </div>
                 </td>
            </table>

                     <div style='mso-element:footer' id="f1" class="MsoFooter,Section1" >
                                <p class="MsoFooter">
                                    <table width="100%" border="0" cellspacing="0" cellpadding="0" >
                                        <tr>
                                            <td width="50%">
                                                Constructed: test{!case.Createdby.name}<br/>
                                                test
                                            </td>
                                            <td align="center" width="20%">
                                            <apex:outputText value="{0,date,dd'-'MMM'-'yyyy}">
                                            <apex:param value="{!Case.CreatedDate}"/>
                                            </apex:outputText>
                                            </td>
                                            <td align="center" width="30%">
                                                Page <span style='mso-field-code: PAGE '></span> of <span style='mso-field-code: NUMPAGES '></span>
                                                <br/>
                                                Print Date:<apex:outputText value="{0,date,dd'-'MMM'-'yyyy}">
                                                <apex:param value="{!today()}"/>
                                                </apex:outputText>
                                            </td>
                                        </tr>
                                    </table>
                                </p>
                            </div>
        
   </div>        
=================Sample Output========================User-added image
Hello,

I am facing issue in Trailhead : Queueable Apex
https://trailhead.salesforce.com/asynchronous_apex/async_apex_queueable

We have to write a class and test class for 100% code coverage.
But on Validating, I am getting error: 

Challenge Not yet complete... here's what's wrong: 
The 'AddPrimaryContactTest' test class doesn't appear to be using the 'AddPrimaryContact' class.


He are  my classes:
global class AddPrimaryContact implements Queueable {
    
    private Contact queueContact;
    private String contactState;
    
    public AddPrimaryContact(){}
    
    public AddPrimaryContact(Contact con, String state){
        queueContact = con;
        contactState = state;
    }
    
    public void execute(QueueableContext context){
        
        List<Account> accList = [select id,name from Account  where BillingState =: contactState limit 200];
        List<Contact>conList = new List<Contact>();
        for(account acl : accList){
            Contact cont = queueContact.clone(false);
            cont.AccountId=acl.id;
            conList.add(cont);
        }
        insert conList;
        
    }
}

Test class:
@isTest
public class AddPrimaryContactTest {
    
    @testSetup
    public static void setup(){
        
        List<Account> accList = new List<Account>();
        for(integer ing =0;ing<50; ing++){
            Account acc = new Account(Name='TEst Acc',BillingState ='NY');
            accList.add(acc);
        }    
        
        for(integer ing =0;ing<50; ing++){
            Account acc = new Account(Name='TEst Acc',BillingState ='CA');
            accList.add(acc);
        } 
        
        insert accList;
        
        Contact con = new Contact(LastName='TestContact');
        insert con;
    }
    
   static testmethod  void testAcount(){
        
        contact con = [select id,name,AccountId from contact where name='TestContact'];
         Test.startTest();
         
        AddPrimaryContact ad = new AddPrimaryContact ();
        AddPrimaryContact updater = new AddPrimaryContact (con, 'CA');
        // startTest/stopTest block to force async processes to run
               System.enqueueJob(ad);
        ID jobID = System.enqueueJob(updater);
        Test.stopTest();       
        
    }
}
I am getting 100% code coverage for my class.
I need to Query the Last notes and attachments that was added in a Quote, into a PDF, I dont now how to query that , any suggestions?
Hello All,
I have completed this challenge.

1-For this first you need to create a helper formula field(type-percent) 
Percent Completed :
(DATEVALUE( CreatedDate ) - CloseDate )/100


2- Then you need to create the actual formula field (type- text) by using the helper formula field.
Opportunity Progress :

IF( Percent_Completed__c <=25,"Early", 
IF(Percent_Completed__c <=75,"Middle", 
"Late"))

Thanks,
Nida



 
I need to move the text to right side by certain points on visualforce page:
<apex:outputText >At least one Reason is required</apex:outputText>
<apex:outputText >Use Ctrl+Click to select more than One Reason</apex:outputText> 

 

How can i set the defalut value for phone field?

 

I tried following options

1) 000-000-0000

2) (000)-000-0000

 

but i am getting the error.

 

Error: Formula result is data type (Number), incompatible with expected data type (Phone)