• bheemudu neeli
  • NEWBIE
  • 90 Points
  • Member since 2015

  • Chatter
    Feed
  • 0
    Best Answers
  • 1
    Likes Received
  • 0
    Likes Given
  • 28
    Questions
  • 16
    Replies
Hi All,
Salesforce javascript button not working properly, code is as follows, but in the below code line if('records.Origin'==='EF New Issues'){ is failing, Need a help to complet it.

................................
{!REQUIRESCRIPT("/soap/ajax/35.0/connection.js")}

var url = parent.location.href;
var records = {!GETRECORDIDS($ObjectType.Case)};
var updateRecords = [];
records.id = "{!Case.Id}";
records.Origin= "{!Case.Origin}";

if (records[0] == null) {
alert("Please select at least one record to Update.");
}

else{

if('records.Origin'==='EF New Issues'){
console.log(records);
window.location = 'apex/MassCaseStatus_change?id='+records.join(',');

}
else{
alert("Please select All records as origin is EF new Issues.");
}
}
.................................

Thank you,
Bheem
Hello All,
I need a help on auto search functionality sample code  as input value, so that i can use that field value to assign to other field.

Thank you,
Bheem
 
Hi All,
Please help me to write a test class for the below apex trigger.
Thanks in advance.
here is the code 

trigger PreventFileConDoc on ContentDocument (before delete) {
   // for(ContentDocumentLink conl : trigger.old){
   //     conl.adderror('ContentDocumentLink Cannot be deleted');
   // }
      Id profileId = userinfo.getProfileId();
    String profileName = [Select Id,name from Profile where Id =: profileId].Name;
   if(Trigger.isBefore && Trigger.isDelete){
        Map<Id, ContentDocument> mapContentDocument = new Map<Id, ContentDocument>([Select Id from ContentDocument where Id in: trigger.oldMap.keyset()]);
        for(ContentDocument cd : Trigger.Old){
             if (profileName != 'System Administrator') {
            if(mapContentDocument.containsKey(cd.Id)){
                cd.adderror('ContentDocument Cannot be deleted');
                system.debug('testing inside loop'+cd);
            }
        } 
        }

}



Thank you,
Bheem
Hi All,
Need a help on code coverage for before delete apex trigger 
Thanks in Advance, can any one please help me to write a test class for the below trigger... I tried my known ways but failed.
here is my code....
trigger PreventFileDeleion on ContentDocumentLink (before delete) {
      Id profileId = userinfo.getProfileId();
   String profileName = [Select Id,name from Profile where Id =: profileId].Name;
    
   if(Trigger.isBefore && Trigger.isDelete){
        Map<Id, ContentDocumentLink> mapContentDocument = new Map<Id, ContentDocumentLink>([Select Id from ContentDocumentLink where Id in: trigger.oldMap.keyset()]);
        for(ContentDocumentLink cd : Trigger.Old){
            if (profileName != 'System Administrator') {
            if(mapContentDocument.containsKey(cd.Id)){
                cd.adderror('ContentDocumentLink Cannot be deleted');
                system.debug('testing inside loop'+cd);
            }
        } 
        }
}
}
 
Hi All,
I am unable to cover the code for Execute method for the below batch class.
can some can please help.
.......................
global class DuplicateContactsMergeProcess implements Database.Batchable<sobject>, Database.Stateful
{  
    
   
    //Execute method
    global void execute (Database.BatchableContext BC, List<Contact> scope)
    {
        List<Contact> target=[select id,FirstName,LastName,Active__c,FN__c,LN__c,ReportsToid,Description,Title__c,OwnerId,Extension__c,Swift__c,Team__c,External__c,Weblead__c,Can_be_contacted_for_Marketing_purposes__c,Preferred_Communication_Channel__c,Group_Phone_Number__c,Product_Families__c,Services__c,Subscriptions__c,Survey__c,DoNotCall,HasOptedOutOfEmail,AssistantName,AssistantPhone,Contact_for__c,Entity__c,LastProTime__c,AccountId,OtherCountry,FederationIdentifier__c,OtherLatitude,OtherLongitude,OtherGeocodeAccuracy,salutation,OtherStreet,OtherCity,OtherState,OtherPostalCode,MailingCountry,MailingLatitude,MailingLongitude,MailingGeocodeAccuracy,MailingStreet, MailingCity,MailingState,MailingPostalCode,Email,ApexBatchID__c, Title, Role__c, Function__c, Language__c, Group_email__c, Phone, MobilePhone, Fax, Switchboard__c  from Contact where   AccountId<>null  AND recordtype.name!=:RecName  AND LastProTime__c!=:BNow and createddate=today  limit 1 ];
        system.debug('## Preparing to merge '+target); 
        if(target.size()>0)
        {
            String sFN=(String)target[0].get('FN__c');   
            String sLN=(String)target[0].get('LN__c'); 
            String sEmail=(String)target[0].get('Email'); 
            Id accId=(ID)target[0].get('AccountId'); 
            Id conId=(ID)target[0].get('Id');
            try{
                Contact[] lstContact=[Select id,FirstName,LastName,FN__c,LN__c,ReportsToid,Description,Active__c,Title__c,OwnerId,LastProTime__c,Extension__c,Swift__c,Team__c,External__c,Weblead__c,Can_be_contacted_for_Marketing_purposes__c,Preferred_Communication_Channel__c,Group_Phone_Number__c,Product_Families__c,Services__c,Subscriptions__c,Survey__c,DoNotCall,HasOptedOutOfEmail,AssistantName,AssistantPhone,Contact_for__c,Entity__c,FederationIdentifier__c,ApexBatchID__c,AccountId,OtherCountry,OtherLatitude,OtherLongitude,OtherGeocodeAccuracy,salutation,OtherStreet,OtherCity,OtherState,OtherPostalCode,MailingCountry,MailingLatitude,MailingLongitude,MailingGeocodeAccuracy,MailingStreet, MailingCity,MailingState,MailingPostalCode,Email ,Title,Role__c,Function__c, Language__c, Group_email__c, Phone, MobilePhone, Fax, Switchboard__c  from Contact where  AccountId<>null  AND FN__c=:sFN and LN__c=:sLN and AccountId=:accId and Email=:sEmail and id!=:conId   limit 1];
                system.debug('## List of identified contacts '+lstContact); 
                system.debug('## '+lstContact.size()); 
                if(lstContact.size()>0)
                {
                    List<User> UserDup =[select id, contactid, isactive from user where contactid=:lstContact[0].ID limit 1];    
                    List<User> Usertarg =[select id, contactid, isactive from user where contactid=:target[0].ID limit 1];    
                    system.debug('## UserDup users '+UserDup);
                    system.debug('## Usertarg users '+Usertarg);
                    List<Contact> us1 = [Select id, Name, Createddate from Contact where Id=:target[0].Id];
                    List<Contact> use1 = [Select id, Name, Createddate from Contact where Id=:lstContact[0].Id];
                     Mdate=us1[0].Createddate; 
                     Cdate=use1[0].Createddate;
                    System.debug('master createddate'+Mdate);
                    System.debug('Child createddate'+Cdate);
                    if(Usertarg.size()>0 && UserDup.size()>0)
                    {
                        system.debug('## Portal User Size > Zero');
                        If((UserDup[0].IsActive==TRUE && Usertarg[0].IsActive==TRUE)||(UserDup[0].IsActive==False && Usertarg[0].IsActive==False))
                        {
                            system.debug('## Portal User Check');
                            IF(Mdate>Cdate)
                            {
                                MasterContact=lstContact[0];
                                finalmaster=lstContact[0].Id;
                                otherContact=target[0];
                                finalcontact=target[0].id;
                                system.debug('## MasterContact '+MasterContact);
                                system.debug('## otherContact '+otherContact);
                            }
                            IF(Mdate<Cdate)
                            {
                                otherContact=lstContact[0];
                                finalcontact=lstContact[0].Id;
                                MasterContact =target[0];
                                finalmaster =target[0].id;
                                system.debug('## MasterContact '+MasterContact);
                                system.debug('## otherContact '+otherContact);
                            }
                        }
                        If(UserDup[0].IsActive==TRUE && Usertarg[0].IsActive==FALSE){
                        MasterContact=lstContact[0];
                        finalcontact=target[0].id;
                        otherContact=target[0];
                        finalmaster=lstContact[0].Id;
                        system.debug('## Master Contact '+MasterContact); 
                        system.debug('## deprecated Contact '+otherContact); 
                            
                        }
                        If(UserDup[0].IsActive==FALSE && Usertarg[0].IsActive==TRUE){
                        otherContact=lstContact[0];
                        finalmaster=target[0].id;
                        MasterContact=target[0];
                        finalcontact=lstContact[0].Id;
                        system.debug('## Master Contact '+MasterContact); 
                        system.debug('## deprecated Contact '+otherContact);
                        }
                    }
                    if(Usertarg.size()==0 && UserDup.size()>0)
                    {
                        MasterContact=lstContact[0];
                        finalcontact=target[0].id;
                        otherContact=target[0];
                        finalmaster=lstContact[0].Id;
                        system.debug('## Master Contact '+MasterContact); 
                        system.debug('## deprecated Contact '+otherContact); 
                    }
                    if(Usertarg.size()>0 && UserDup.size()==0)
                    {
                        otherContact=lstContact[0];
                        finalmaster=target[0].id;
                        MasterContact=target[0];
                        finalcontact=lstContact[0].Id;
                        system.debug('## Master Contact '+MasterContact); 
                        system.debug('## deprecated Contact '+otherContact); 
                    }
                    if(Usertarg.size()==0 && UserDup.size()==0)
                    {
                        IF(Mdate>Cdate)
                        {
                            MasterContact=lstContact[0];
                            finalmaster=lstContact[0].Id;
                            otherContact=target[0];
                            finalcontact=target[0].id;
                            system.debug('## MasterContact '+MasterContact);
                            system.debug('## otherContact '+otherContact);
                        }
                        IF(Mdate<Cdate)
                        {
                            MasterContact=target[0];
                            finalmaster=target[0].id;
                            otherContact=lstContact[0];
                            finalcontact=lstContact[0].Id;
                            system.debug('## MasterContact '+MasterContact);
                            system.debug('## otherContact '+otherContact);
                        }
                    }
                    system.debug('## Master Contact '+MasterContact); 
                    system.debug('## deprecated Contact '+otherContact); 
                    
                    if(otherContact!=NULL && MasterContact!=NULL)
                    { 
                                                
                        if(otherContact.Function__c!=null)
                        {
                            MasterContact.Function__c =otherContact.Function__c;
                        }
                        if(otherContact.Title!=null)
                        {
                            MasterContact.Title =otherContact.Title;
                        }
                        
                        if(otherContact.Role__c!=null)
                        {
                            MasterContact.Role__c =otherContact.Role__c;
                        }
                        if(otherContact.Language__c!=null)
                        {
                            MasterContact.Language__c =otherContact.Language__c;
                        }
                        if(otherContact.Email!=null)
                        {
                            MasterContact.Email =otherContact.Email;
                        }
                        if(otherContact.Group_email__c!=null)
                        {
                            MasterContact.Group_email__c =otherContact.Group_email__c;
                        }
                        if(otherContact.Phone!=null)
                        {
                            MasterContact.Phone =otherContact.Phone;
                        }
                       
                         List<Contact> us = [Select id, Name,owner.isactive, Owner.Profile.Name from Contact where Id=:MasterContact.Id];
                         List<Contact> use = [Select id, Name,owner.isactive, Owner.Profile.Name from Contact where Id=:otherContact.Id];
                         system.debug('## MasterContact.Owner ##'+us[0].Owner.profile.name);
                         system.debug('## otherContact.Owner ##'+use[0].Owner.profile.name);
                         mergeprofile=Us[0].Owner.profile.name;
                         listprofile=use[0].Owner.profile.name;
                         system.debug('## MasterContact.Owner ##'+mergeprofile);
                         system.debug('## otherContact.Owner ##'+listprofile);   
                        system.debug('## Owner isactive##'+use[0].owner.isactive+'master own'+Us[0].owner.isactive);
                       // if(use[0].owner.isactive==true){
                        //     MasterContact.OwnerId =otherContact.OwnerId; 
                        //}
                                       
                if((listprofile=='External access' || listprofile=='PSS User' || listprofile=='Rollout profile' || listprofile=='Rollout profile EUI' || listprofile=='Rollout profile France' || listprofile=='Rollout profile Unit Head')
                && (mergeprofile!='External access' && mergeprofile!='PSS User' && mergeprofile!='Rollout profile' && mergeprofile!='Rollout profile EUI' && mergeprofile!='Rollout profile France' && mergeprofile!='Rollout profile Unit Head'))  
                 {  
                       if(use[0].owner.isactive==true){ 
                             MasterContact.OwnerId =otherContact.OwnerId; 
                        }
                   
               } 
                     MasterContact.ApexBatchID__c=BC.getJobId();
                        update MasterContact;
                        system.debug('Apex Batch ID Merge'+MasterContact.ApexBatchID__c);
                        system.debug('Before Merge');
                        merge MasterContact otherContact;
                        system.debug('After Merge');
                        system.debug('Excuted Master Contact'+MasterContact);
                    
                
                }
                
            }
                 else If(lstContact.size()==0){
                    target[0].LastProTime__c=BNow;
                    Update target;
                    system.debug('Duplicate not found'+target);
                
                }
            }
            catch(Exception ex)
            {
                system.debug('Exception'+ex);
            }
            
            
        }
    }
    
    //Finish Method
   }
.........................
 
Much appriciated if any help.
I want to convert plaintext body of email message's to attachment as html file, so that the stoge limit will reduce in inside SF.
try{ // try start
           if(email.plainTextBody == null || email.plainTextBody.Trim() == ''){//Creating the TextBody
               system.debug('>> Inside plain text body with null');
               pattern myPattern = pattern.compile('<.*?>');
               //email.plainTextBody = myPattern.matcher(email.HtmlBody.replaceAll('<br/>', '\n').replaceAll('&quot;','"').replaceAll('&lt;','<').replaceAll('&gt;','>').replaceAll('&nbsp;',' ').replaceAll('&amp;','&')).replaceAll('');
                String newStr = myPattern.matcher(email.HtmlBody.replaceAll('<br/>', '\n').replaceAll('&quot;','"').replaceAll('&gt;','>').replaceAll('&nbsp;',' ').replaceAll('&amp;','&')).replaceAll('');
                //modified the replace method since we are not able to replace '&lt;'
               // Need to uncomment if below method does not work for Regex exception               
               //String newStr = String.valueOf(myPattern.matcher(email.HtmlBody.stripHtmlTags()));
               String finalStr = newStr.replace('&lt;','<');
                            
               email.plainTextBody = finalStr; 
               system.debug('###>> New String value ##<<'+newStr);
                  
            }
            }
this is my code: getting regex error, in the below mention line please help.
String newStr = myPattern.matcher(email.HtmlBody.replaceAll('<br/>', '\n').replaceAll('&quot;','"').replaceAll('&gt;','>').replaceAll('&nbsp;',' ').replaceAll('&amp;','&')).replaceAll('');
 
Need a help on code coverage for Apexpages.addMassageUser-added image
Hi All,
How to pass the Auto_Number field on MAX aggregate to fetch the latest Transaction, hence by passing ID we are not getting latest Transaction, so, I'm trying with MAX(auto_num) as name of transaction, while trying this getting error on AfterUpdate trigger Issues.
please help me on how to convert Auto_Num to ID.

here is the logic..................

AggregateResult[] aggtransold = [SELECT MAX(Id) newestTransactionOnBond
                                         FROM Transaction__c
                                         WHERE Bond_ID__c IN :bondids
                                         AND Issued__c = true
                                         GROUP BY Bond_ID__c];
                                      
        for (AggregateResult agg : aggtransold) {
            System.debug('BTH: CloneTransactionSchedules: OLD TRANSACTION ' + agg.get('newestTransactionOnBond'));
            setoldtransids.add((String)agg.get('newestTransactionOnBond'));
        }
.......................

With Regards,
Bheem
Hi All,
Please Help me to add a Date on below screen, Date field need to select on same page, so that Invoice should be Approve.
It will be done on VF page or else on controllers? need a help on below, its urgent.
User-added image
 
Hi All,
Need a help on encrypted field identification, In my Org there are some Encrypted Fields on various objects.
Is there any ways to Identify All at once. see the below sample field for the same.
User-added image
With Regards,
Bheem
Hi 
I have a requirement as a report to send users Monitor Bulk Data Load Jobs for both Processed and failed once.
If this is possible then please help. if not then how can I send the Bulk data load job details to Users those are failed.

Regards
Bheem
Hi,
my code working properly but, does not entered into else block. what wrong in my code. please need help

 if (mapBRTotal.get(b.Id) != null  ){ 

            for (Bond_Reinsurance__c br :mapBRTotal.get(b.Id)){
                     If(br.Reinsurer__r.RecordType.id=='012b00000001700AAA' && br.Reinsurer__r.Trading_Partner__c==true && br.Reinsurer__r.Reinsurer_Type__c=='Facultative Out' && !(br.Reinsurer__r.Name.startsWith('OC') || br.Reinsurer__r.Name.startsWith('QS'))){
                    
                    riProportion+=br.Proportion__c;
                    grossOutstanding=b.ZGCS_Reduced_Bond_Amount__c-riProportion;
                   }
                   
             }
                   }  else
                   grossOutstanding=b.ZGCS_Reduced_Bond_Amount__c;



Thanks,
Bheem
Hello,
please help the below code

Underwriting_Opportunity_Owner__c  is lookup from opportunity to user.

public static void TaskFire(List<Opportunity> opps) { 
               if (opps == null) {
            return;
        }
        Set<Id> oppownerIds=new Set<Id>();
         for (Opportunity opp : opps) {
            if (opp.Underwriting_Opportunity_Owner__c != null) {    //we need to get under writing opportunity owner id here
                oppownerIds.add(opp.Underwriting_Opportunity_Owner__c);
            }
         }
            List<user> userlist = [select id, Renewal_Threshold__c from user where id in :oppownerIds]; 
            List<Task> Taskcreation = new list<task>();

            for(Opportunity opp : opps){
            if(userlist!=null && !userlist.isEmpty()) {
            for(User ur :userlist)
            if(opps!=null && !opps.isEmpty()) {
            system.debug('test1');
            If( opp.recordtypeid==CBRenewal && opp.Amount>ur.Renewal_Threshold__c && opp.RenewalDate__c >= System.TODAY()){ 
            system.debug('test2');
                                 Task accTask = new Task();                                                                
                                    accTask.WhatId = ur.Id;                                                    
                                    accTask.ActivityDate = system.today();
                                    accTask.Type = 'Follow Up';
                                    accTask.OwnerId = Underwriting_Opportunity_Owner__c.Id;
                                    accTask.Status = 'Not Started';
                                    accTask.Priority = 'Normal';
                                    accTask.Comments__c = 'test.';
                                    accTask.Subject = 'subjectTest';
                                   Taskcreation.add(accTask);
                                   system.debug('test3'+Taskcreation.Size()); 
                                   
                  }
              }
              }
           }
           Insert Taskcreation;
        }  


Thanks,
Bheem
Hi All, 
Please help to update the trigger for old value, please  where i'm doing wrong.
here is the code
trigger BulkifyTri1 on Account (before insert, before update){
       set<Id> accIds = new set<Id>();
       list<Account> UpdateAcc = new list<Account>();
       list<Account> accst = new list<Account>();
       list<Account> InsertAcc = new list<Account>();
     for ( Account a : trigger.new){
        if ( a.AccountNumber != NULL )
            a.Type = 'Other';
            InsertAcc.add(a);
            }
            insert InsertAcc;
        
    accst = [select id, name,AccountNumber,Type from account where Id in :accIds];  
    for(Account ac:accst )
    {
    if (ac.AccountNumber != NULL ){
    ac.Type = 'Prospect';
    UpdateAcc.add(ac);
    }
    }
    
    if(UpdateAcc.size()>0)
        {
            update UpdateAcc;
        }
      
  }
    

With Regards,
Bheemudu Neeli
Hi All,
Please bulkify my trigger it is working for Single record without any issue, could you please do it it for mass records.
 
trigger updateOrder on Master_Course__c (after insert) {
    
    List<Master_Course__c> coursegroup = new List<Master_Course__c>();
    List<Master_Course__c> coursesubgroup = new List<Master_Course__c>();
    List<Master_Course__c> coursename = new List<Master_Course__c>();
    string centrecode = trigger.new[0].Centre_Code__c;
    Map<String,Integer> coursegroupmap = new Map<String,Integer>();
    Integer num = 0;
    boolean coursegroupfound=false;
    boolean coursesubgroupfound=false;
    boolean crsnamefound = false;
    string coursegroupvar;
    
    Master_Course__c mcobj = new Master_Course__c();
   // mcobj=trigger.new[0];
    
    mcobj = [select id, name,Course_Group__c,Course_Sub_Group__c,Centre_Code__c,Course_Group_Order__c,Course_Sub_Group_Order__c,Course_Order__c from Master_Course__c WHERE Id IN: Trigger.newMap.keySet() limit 1];
    coursegroup = [select id, name,Course_Group__c,Course_Sub_Group__c,Centre_Code__c,Course_Group_Order__c,Course_Sub_Group_Order__c,Course_Order__c from Master_Course__c where Centre_Code__c =:centrecode and Id != :mcobj.id order by Course_Group__c ASC]; 
    
    system.debug('mcobj@@'+mcobj);
    for(Master_Course__c mc : coursegroup)
    {
        if(mc.Course_Group__c == mcobj.Course_Group__c)
        {
            system.debug('entered first loop');
            mcobj.Course_Group_Order__c = mc.Course_Group_Order__c;
            coursegroupfound = true;
            break;
        }   
    }
    
    if(coursegroupfound == true)
    {
        system.debug('entered coursegroupfound');
        coursesubgroup=[select id, name,Course_Group__c,Course_Sub_Group__c,Centre_Code__c,Course_Group_Order__c,Course_Sub_Group_Order__c,Course_Order__c from Master_Course__c where Centre_Code__c =:centrecode and Course_Group__c =:mcobj.Course_Group__c and Id != :mcobj.Id order by Course_Sub_Group__c ASC];
        
        for(Master_Course__c mc : coursesubgroup)
        {
            if(mc.Course_Sub_Group__c == mcobj.Course_Sub_Group__c)
            {
                mcobj.Course_Sub_Group_Order__c = mc.Course_Sub_Group_Order__c;
                coursesubgroupfound = true;
                break;
            }   
        }
        update mcobj;
    }
    
    if(coursesubgroupfound == true)
    {
        system.debug('entered coursesubgroupfound');
        coursename =[select id, name,Course_Group__c,Course_Sub_Group__c,Centre_Code__c,Course_Group_Order__c,Course_Sub_Group_Order__c,Course_Order__c from Master_Course__c where Centre_Code__c =:centrecode and Course_Group__c =:mcobj.Course_Group__c and Course_Sub_Group__c =:mcobj.Course_Sub_Group__c and Id != :mcobj.Id order by name ASC];
        for(Master_Course__c mc : coursename)
        {
            if(mc.Name == mcobj.Name)
            {
                mcobj.Course_Order__c = mc.Course_Order__c;
                crsnamefound = true;
                break;
            }   
        }
    update mcobj;
    
    }

    
    //system.debug('@@@@crsgrpmap@@@'+coursegroupmap);
    if(coursegroupfound == false)
    {
        coursegroup = [select id, name,Course_Group__c,Course_Sub_Group__c,Centre_Code__c,Course_Group_Order__c,Course_Sub_Group_Order__c,Course_Order__c from Master_Course__c where Centre_Code__c =:centrecode order by Course_Group__c ASC];
        system.debug('entered line 69');
        for(Master_Course__c mc : coursegroup)
        {
            if(coursegroupmap.isEmpty())
            {
                mc.Course_Group_Order__c=1;
                mc.Course_Sub_Group_Order__c = 1;
                mc.Course_Order__c=1;
                num=mc.Course_Group_Order__c.intValue();
                coursegroupmap.put(mc.Course_Group__c,mc.Course_Group_Order__c.intValue());
            }
            
            else if(!coursegroupmap.isEmpty())
            {
                if(coursegroupmap.containskey(mc.Course_Group__c))
                {
                    mc.Course_Group_Order__c = coursegroupmap.get(mc.Course_Group__c);
                    num=mc.Course_Group_Order__c.intValue();
                    //search for sub group
                }
                else
                {
                    num++;
                    mc.Course_Group_Order__c = num;
                    mc.Course_Sub_Group_Order__c = 1;
                    mc.Course_Order__c=1;
                    coursegroupmap.put(mc.Course_Group__c,mc.Course_Group_Order__c.intValue());
                }
            }
        }
    update coursegroup;
    }
    
    
    if(coursesubgroupfound == false)
    {
        coursesubgroup=[select id, name,Course_Group__c,Course_Sub_Group__c,Centre_Code__c,Course_Group_Order__c,Course_Sub_Group_Order__c,Course_Order__c from Master_Course__c where Centre_Code__c =:centrecode and Course_Group__c =:mcobj.Course_Group__c order by Course_Sub_Group__c ASC];
        Map<String,Integer> coursesubgroupmap = new Map<String,Integer>();
        system.debug('entered line 69');
        for(Master_Course__c mc : coursesubgroup)
        {
            if(coursesubgroupmap.isEmpty())
            {
                mc.Course_Sub_Group_Order__c = 1;
                mc.Course_Order__c=1;
                num=mc.Course_Sub_Group_Order__c.intValue();
                coursesubgroupmap.put(mc.Course_Sub_Group__c,mc.Course_Sub_Group_Order__c.intValue());
            }
            
            else if(!coursesubgroupmap.isEmpty())
            {
                if(coursesubgroupmap.containskey(mc.Course_Sub_Group__c))
                {
                    mc.Course_Sub_Group_Order__c = coursesubgroupmap.get(mc.Course_Sub_Group__c);
                    num=mc.Course_Sub_Group_Order__c.intValue();
                    //search for sub group
                }
                else
                {
                    num++;
                    mc.Course_Sub_Group_Order__c = num;
                    mc.Course_Order__c=1;
                    coursesubgroupmap.put(mc.Course_Sub_Group__c,mc.Course_Sub_Group_Order__c.intValue());
                }
            }
        }
    update coursesubgroup;
    }
    
    
    if(crsnamefound == false)
    {
        coursename=[select id, name,Course_Group__c,Course_Sub_Group__c,Centre_Code__c,Course_Group_Order__c,Course_Sub_Group_Order__c,Course_Order__c from Master_Course__c where Centre_Code__c =:centrecode and Course_Group__c =:mcobj.Course_Group__c and Course_Sub_Group__c =:mcobj.Course_Sub_Group__c order by name ASC];
        Map<String,Integer> coursenamemap = new Map<String,Integer>();
        system.debug('entered line 69');
        for(Master_Course__c mc : coursename)
        {
            if(coursenamemap.isEmpty())
            {
                mc.Course_Order__c=1;
                num=mc.Course_Order__c.intValue();
                coursenamemap.put(mc.name,mc.Course_Order__c.intValue());
            }
            
            else if(!coursenamemap.isEmpty())
            {
                if(coursenamemap.containskey(mc.name))
                {
                    mc.Course_Order__c = coursenamemap.get(mc.name);
                    num=mc.Course_Order__c.intValue();
                    
                }
                else
                {
                    num++;
                    mc.Course_Order__c=num;
                    coursenamemap.put(mc.name,mc.Course_Order__c.intValue());
                }
            }
        }
    update coursename;
    }
    
}

 
Hi All,
Can any one help me for ANT setup and configuration step by step process 
It is urgent to our end, I have to deploy through the ANT tool only.

Thanks 
Bheem
Hi
I have a issue with Test class while deploying from sandbox to production.
The same test class running pass in sandbox. but failing in production. 
System.DmlException: Insert failed. First exception on row 0; first error: CANNOT_INSERT_UPDATE_ACTIVATE_ENTITY, 
User-added image
H
ere is the calss and test classes.
@IsTest
private with sharing class ApprovalProcessFactoryTests {
	
	private static TestMethod void testTDNewBusinessApproval() {
		
		Account supplier = new Account();
       	supplier.Name = 'Test Supplier';
        supplier.Type = 'Supplier';
        insert supplier;
		
		Case cas = new Case();
		cas.AccountId = supplier.Id;
		cas.Type = 'Trust Deed';
		cas.Insolvency_Practitioner__c = System.UserInfo.getUserId();
		insert cas;
		
		ApprovalProcessFactory.ApprovalProcessWrapper wrapper = ApprovalProcessFactory.createApprovalProcess(cas.Id);
		wrapper.canApproveReject();
		
		wrapper.canSubmitForApproval();
		wrapper.SubmitForApproval('TD New Business');
		
		wrapper.getReasonCodes();
		// Approve as IP
		wrapper.canApproveReject();
		wrapper.approve(false);
		
		// Approve as Mark Hamill
		/*List<User> users = [Select Id From User Where Name = 'Mark Hamill' and IsActive = true Limit 1];
		System.runAs(users[0]) {
			wrapper.canApproveReject();
			wrapper.reject();
		}*/
	}
	
	private static TestMethod void testBegbiesTDNewBusinessApproval() {
		
		
		list<Account> supplier = [select Id from Account where Id = :system.label.Account_Begbies_Traynor limit 1];
		
		Case cas = new Case();
		cas.AccountId = supplier[0].Id;
		cas.Type = 'Trust Deed';
		cas.Insolvency_Practitioner__c = System.UserInfo.getUserId();
		insert cas;
		
		ApprovalProcessFactory.ApprovalProcessWrapper wrapper = ApprovalProcessFactory.createApprovalProcess(cas.Id);
		wrapper.canApproveReject();
		
		wrapper.canSubmitForApproval();
		wrapper.SubmitForApproval('TD New Business');
		
		wrapper.getReasonCodes();
		// Approve as IP
		wrapper.canApproveReject();
		wrapper.approve(false);
		
		// Approve as Mark Hamill
		/*List<User> users = [Select Id From User Where Name = 'Mark Hamill' and IsActive = true Limit 1];
		System.runAs(users[0]) {
			wrapper.canApproveReject();
			wrapper.reject();
		}*/
	}
	
	private static TestMethod void testIVANewBusinessApproval() {
		
		Account supplier = new Account();
        supplier.Name = 'Test Supplier';
        supplier.Type = 'Supplier';
        insert supplier;
		
		QResponse__c qr = new QResponse__c();
		qr.Status__c = 'Completed';
		qr.All_fields_complete__c = true;
		insert qr;
		
		Case cas = new Case();
		cas.AccountId = supplier.Id;
		cas.Type = 'IVA';
		cas.Insolvency_Practitioner__c = System.UserInfo.getUserId();
		insert cas;
		
		Case cas2 = new Case();
		cas2.AccountId = supplier.Id;
		cas2.Type = 'Trust Deed';
		cas2.Insolvency_Practitioner__c = System.UserInfo.getUserId();
		cas2.Money_Laundering_Q__c = qr.Id;
		
		insert cas2;
		
		Case_Approval_Step__c appr = new Case_Approval_Step__c();
		appr.Case__c = cas2.Id;
		appr.Step_Number__c = 1;
		appr.Status__c = 'Waiting for approver';
		appr.Approval_Type__c = 'Money Laundering';
		insert appr;
		
		ApprovalProcessFactory.ApprovalProcessWrapper wrapper = ApprovalProcessFactory.createApprovalProcess(cas.Id);
		wrapper.canApproveReject();
		wrapper.canSubmitForApproval();
		wrapper.SubmitForApproval('New Business');
		wrapper.getReasonCodes();
		// Approve first stage approval
		system.assertEquals(true, wrapper.canApproveReject());
		wrapper.approve(false);
		// Approve as IP
		system.assertEquals(true, wrapper.canApproveReject());
		wrapper.approve(false);
		
		//Money laundering on Case
		ApprovalProcessFactory.ApprovalProcessWrapper wrapper2 = ApprovalProcessFactory.createApprovalProcess(cas2.Id);
		wrapper2.SubmitForApproval('Money Laundering');
		wrapper2.getReasonCodes();
		wrapper2.canApproveReject();
		wrapper2.approve(false);
		
		//Money Laundering on custom case
		cas.Money_Laundering_Q__c=qr.Id;
		update cas;
		appr.Case__c = cas.Id;
		update appr;
		ApprovalProcessFactory.ApprovalProcessWrapper wrapper3 = ApprovalProcessFactory.createApprovalProcess(cas.Id);
		wrapper3.canApproveReject();
		wrapper3.canSubmitForApproval();
		wrapper3.SubmitForApproval('Money Laundering');
		wrapper3.getReasonCodes();
		// Approve first stage approval
		wrapper3.canApproveReject();
		wrapper3.approve(false); 		
	}
	
		
	private static TestMethod void testCustomCaseIVANewBusinessApproval() {
		
		Account supplier = new Account();
        supplier.Name = 'Test Supplier';
        supplier.Type = 'Supplier';
        insert supplier;
		
		QResponse__c qr = new QResponse__c();
		qr.Status__c = 'Completed';
		qr.All_fields_complete__c = true;
		insert qr;
		
		CustomCase__c cc = new CustomCase__c();
    	cc.Partner__c=System.Label.Account_Invocas;
    	cc.Product__c='IVA';
    	cc.Case_Type__c='IVA';
    	cc.Status__c='IVA MOC';
    	cc.Process_Step__c='Arranging MOC';
    	cc.Bond_Level__c=1500;
    	cc.Date_of_Nominee_Appointment__c=date.today();
    	cc.Date_Signed_IVA_Proposal_Received__c=date.today();
    	cc.Money_Laundering_Q__c = qr.Id;
    	insert cc;
    	
    	CustomCase__c cc2 = new CustomCase__c();
    	cc2.Partner__c=System.Label.Account_Invocas;
    	cc2.Product__c='Trust Deed';
    	cc2.Case_Type__c='Trust Deed';
    	cc2.Status__c='IVA MOC';
    	cc2.Process_Step__c='Arranging MOC';
    	cc2.Bond_Level__c=1500;
    	cc2.Date_of_Nominee_Appointment__c=date.today();
    	cc2.Date_Signed_IVA_Proposal_Received__c=date.today();
    	cc2.Money_Laundering_Q__c = qr.Id;
    	insert cc2;
    	
		Case_Approval_Step__c appr = new Case_Approval_Step__c();
		appr.CustomCase__c = cc.Id;
		appr.Step_Number__c = 1;
		appr.Status__c = 'Waiting for approver';
		appr.Approval_Type__c = 'Money Laundering';
		insert appr;
		
		//ApprovalProcessFactory.ApprovalProcessWrapper wrapper = ApprovalProcessFactory.createApprovalProcess(cc.Id);
		ApprovalProcessFactory.ApprovalProcessWrapper wrapper = ApprovalProcessFactory.createApprovalProcess(cc.Id, 'Money Laundering');
		
		
		wrapper.getApprovalType();
		wrapper.canApproveReject();
		wrapper.getCurrentStep();
		wrapper.getSObject();
		wrapper.getSObjectName();
		wrapper.getCurrentStep();
		wrapper.getReasonCodes();
		wrapper.canSubmitForApproval();
		//wrapper.SubmitForApproval('New Business');
		wrapper.SubmitForApproval('Money Laundering');
		wrapper.canApproveReject();
		wrapper.approve(false);
		
		
		ApprovalProcessFactory.ApprovalProcessWrapper wrapper1 = ApprovalProcessFactory.createApprovalProcess(cc.Id, 'IVA New Business');
		wrapper1.SubmitForApproval('IVA New Business');
		wrapper1.getReasonCodes();
		wrapper1.canApproveReject();
		wrapper1.approve(false);
		
		
		ApprovalProcessFactory.ApprovalProcessWrapper wrapper2 = ApprovalProcessFactory.createApprovalProcess(cc2.Id, 'Money Laundering');
		wrapper2.SubmitForApproval('Money Laundering');
		wrapper2.getReasonCodes();
		wrapper2.canApproveReject();
				
	}
	
	private static TestMethod void testAnnualReviewApproval() {
		
		Account supplier = new Account();
        supplier.Name = 'Test Supplier';
        supplier.Type = 'Supplier';
        insert supplier;
        
        list<Account> supplier1 = [select Id from Account where id = :System.Label.Account_Mazars];
		
		Case cas = new Case();
		cas.AccountId = supplier.Id;
		cas.Insolvency_Practitioner__c = System.UserInfo.getUserId();
		insert cas;
		
		Case cas1 = new Case();
		cas1.AccountId = supplier1[0].Id;
		cas1.Insolvency_Practitioner__c = System.UserInfo.getUserId();
		insert cas1;
		
		
		Annual_Review__c ar = new Annual_Review__c();
		ar.Case__c = cas.Id;
		ar.Insolvency_Practitioner__c = System.UserInfo.getUserId();
		ar.Increase_Case_Budget__c = 100;
		insert ar;
		
		Annual_Review__c ar1 = new Annual_Review__c();
		ar1.Case__c = cas1.Id;
		ar1.Insolvency_Practitioner__c = System.UserInfo.getUserId();
		insert ar1;
		
		ApprovalProcessFactory.ApprovalProcessWrapper wrapper = ApprovalProcessFactory.createApprovalProcess(ar.Id);
		wrapper.canSubmitForApproval();
		wrapper.SubmitForApproval('Annual Review');
		
		wrapper.getReasonCodes();
		// Attempt to approve - should result in error
		wrapper.approve(false);
		
		// Approve as Jill Glen//Now Sam Mcginness
		List<User> users = [Select Id, Bypass_VR__c From User Where Id =:System.Label.User_AR_First_Approver];
		users[0].Bypass_VR__c=true;
		update users;
		System.runAs(users[0]) {
			wrapper.canApproveReject();
			wrapper.approve(false);
		}
		
		// Approve as IP
		wrapper.canApproveReject();
		wrapper.approve(true);
		
		
		
		ApprovalProcessFactory.ApprovalProcessWrapper wrapper1 = ApprovalProcessFactory.createApprovalProcess(ar1.Id);
		wrapper1.canSubmitForApproval();
		wrapper1.SubmitForApproval('Annual Review');
		
		wrapper1.getReasonCodes();
		// Attempt to approve - should result in error
		wrapper1.approve(false);
		
		// Approve as Jill Glen//Now Sam Mcginness
		System.runAs(users[0]) {
			wrapper1.canApproveReject();
			wrapper1.approve(false);
		}
		
		// Approve as IP
		wrapper1.canApproveReject();
		wrapper1.approve(true);
		
	}
	
	private static TestMethod void testGenericApproval() {
		
		Account supplier = new Account();
        supplier.Name = 'Test Supplier';
        supplier.Type = 'Supplier';
        insert supplier;
		
		Case cas = new Case();
		cas.AccountId = supplier.Id;
		cas.Insolvency_Practitioner__c = System.UserInfo.getUserId();
		insert cas;
		
		ApprovalProcessFactory.ApprovalProcessWrapper wrapper = ApprovalProcessFactory.createApprovalProcess(cas.Id);
		wrapper.canSubmitForApproval();
		wrapper.SubmitForApproval('Generic');
		
		wrapper.getReasonCodes();
		// Approve as IP
		wrapper.canApproveReject();
		wrapper.approve(false);
		wrapper.reject();
		wrapper.getReasonCodes();
		wrapper.getSObjectType();
		wrapper.getRecordType();
		
		ApprovalProcessFactory.ApprovalProcessWrapper wrapper2 = ApprovalProcessFactory.createApprovalProcess(cas.Id);
		wrapper2.SubmitForApproval('Money Laundering');
		wrapper2.getReasonCodes();
		
		
	}

	private static TestMethod void testEthicsApprovals() {
		
		Account supplier = new Account();
        supplier.Name = 'Test Supplier';
        supplier.Type = 'Supplier';
        insert supplier;
		
		QResponse__c qr1 = new QResponse__c();
		qr1.Status__c = 'Completed';
		qr1.All_fields_complete__c = true;
		insert qr1;
		
		QResponse__c qr2 = new QResponse__c();
		qr2.Status__c = 'Completed';
		qr2.All_fields_complete__c = true;
		insert qr2;
		
		CustomCase__c cc = new CustomCase__c();
    	cc.Partner__c=System.Label.Account_Invocas;
    	cc.Product__c='IVA';
    	cc.Case_Type__c='IVA';
    	cc.Status__c='IVA MOC';
    	cc.Process_Step__c='Arranging MOC';
    	cc.Bond_Level__c=1500;
    	cc.Date_of_Nominee_Appointment__c=date.today();
    	cc.Date_Signed_IVA_Proposal_Received__c=date.today();
    	cc.Ethics_Q__c = qr1.Id;
    	insert cc;
    	
    	Case_Approval_Step__c appr1 = new Case_Approval_Step__c();
		appr1.CustomCase__c = cc.Id;
		appr1.Step_Number__c = 1;
		appr1.Status__c = 'Waiting for approver';
		appr1.Approval_Type__c = 'Ethics Checklist';
		insert appr1;
    	
		Case cas = new Case();
		cas.AccountId = supplier.Id;
		cas.Insolvency_Practitioner__c = System.UserInfo.getUserId();
		cas.Ethics_Q__c = qr2.Id;
		insert cas;
		
    	Case_Approval_Step__c appr2 = new Case_Approval_Step__c();
		appr2.Case__c = cas.Id;
		appr2.Step_Number__c = 1;
		appr2.Status__c = 'Waiting for approver';
		appr2.Approval_Type__c = 'Ethics Checklist';
		insert appr2;
	
		ApprovalProcessFactory.ApprovalProcessWrapper wrapper = ApprovalProcessFactory.createApprovalProcess(cc.Id);
		wrapper.SubmitForApproval('Ethics Checklist');
		wrapper.getReasonCodes();
		wrapper.canApproveReject();
		wrapper.approve(false);

		
		ApprovalProcessFactory.ApprovalProcessWrapper wrapper2 = ApprovalProcessFactory.createApprovalProcess(cas.Id);
		wrapper2.SubmitForApproval('Ethics Checklist');
		wrapper2.getReasonCodes();
		wrapper2.canApproveReject();
		wrapper2.approve(false);
		
	}

	private static TestMethod void testFailureApproval() {
		
		Account supplier = new Account();
        supplier.Name = 'Test Supplier';
        supplier.Type = 'Supplier';
        insert supplier;
		
		Case cas = new Case();
		cas.AccountId = supplier.Id;
		cas.Insolvency_Practitioner__c = System.UserInfo.getUserId();
		insert cas;
		
		ApprovalProcessFactory.ApprovalProcessWrapper wrapper = ApprovalProcessFactory.createApprovalProcess(cas.Id);
		wrapper.SubmitForApproval('Failure');
		wrapper.getReasonCodes();
		wrapper.approve(false);
		//wrapper.reject();
		
		List<User> testUser = [Select Id From User Where ProfileId=:System.Label.ProfId_Services_Team_Leader and IsActive = true Limit 1];
		System.runAs(testUser[0]) {
			wrapper.canApproveReject();
			wrapper.approve(false);
		}		
	}

	private static TestMethod void testSEQNewBusinessApproval() {
		
		Account supplier = new Account();
        supplier.Name = 'Test Supplier';
        supplier.Type = 'Supplier';
        insert supplier;
		
		QResponse__c qr = new QResponse__c();
		qr.Status__c = 'Completed';
		qr.All_fields_complete__c = true;
		insert qr;
		
		CustomCase__c cc = new CustomCase__c();
    	cc.Partner__c=System.Label.Account_Invocas;
    	cc.Product__c='Sequestration';
    	cc.Case_Type__c='Sequestration';    	
    	insert cc;
    	
		Case_Approval_Step__c appr = new Case_Approval_Step__c();
		appr.CustomCase__c = cc.Id;
		appr.Step_Number__c = 1;
		appr.Status__c = 'Waiting for approver';
		appr.Approval_Type__c = 'Sequestration New Business';
		insert appr;
		
		//ApprovalProcessFactory.ApprovalProcessWrapper wrapper = ApprovalProcessFactory.createApprovalProcess(cc.Id);
		ApprovalProcessFactory.ApprovalProcessWrapper wrapper = ApprovalProcessFactory.createApprovalProcess(cc.Id, 'Sequestration New Business');
				
		wrapper.getApprovalType();
		wrapper.canApproveReject();
		wrapper.getCurrentStep();
		wrapper.getReasonCodes();
		wrapper.SubmitForApproval('Sequestration New Business');
		wrapper.approve(false);
	}
	
	private static TestMethod void testSEQCasefileChecklist() {
		
		Account supplier = new Account();
        supplier.Name = 'Test Supplier';
        supplier.Type = 'Supplier';
        insert supplier;
		
		QResponse__c qr = new QResponse__c();
		qr.Status__c = 'Completed';
		qr.All_fields_complete__c = true;
		insert qr;
		
		CustomCase__c cc = new CustomCase__c();
    	cc.Partner__c=System.Label.Account_Invocas;
    	cc.Product__c='Sequestration';
    	cc.Case_Type__c='Sequestration';
    	cc.SEQ_Case_File_CL__c = qr.Id;
    	insert cc;
    	
		Case_Approval_Step__c appr = new Case_Approval_Step__c();
		appr.CustomCase__c = cc.Id;
		appr.Step_Number__c = 1;
		appr.Status__c = 'Waiting for approver';
		appr.Approval_Type__c = 'Sequestration Casefile Checklist';
		insert appr;
		
		//ApprovalProcessFactory.ApprovalProcessWrapper wrapper = ApprovalProcessFactory.createApprovalProcess(cc.Id);
		ApprovalProcessFactory.ApprovalProcessWrapper wrapper = ApprovalProcessFactory.createApprovalProcess(cc.Id, 'Sequestration Casefile Checklist');
				
		wrapper.getApprovalType();
		List<User> testUser = [Select Id From User Where ProfileId=:System.Label.ProfId_Services_Team_Leader and IsActive = true Limit 1];
		System.runAs(testUser[0]) {
			wrapper.canApproveReject();
		}
		wrapper.canApproveReject();
		wrapper.getCurrentStep();
		wrapper.getReasonCodes();
		wrapper.SubmitForApproval('Sequestration Casefile Checklist');
		//wrapper.finaliseApproval(1);
		wrapper.approve(false);
	}	

	private static TestMethod void testQualityOfWorkApproval() {
		
		Account supplier = new Account();
        supplier.Name = 'Test Supplier';
        supplier.Type = 'Supplier';
        insert supplier;
		
		QResponse__c qr = new QResponse__c();
		qr.Status__c = 'Completed';
		qr.All_fields_complete__c = true;
		insert qr;
				
		Case cas = new Case();
		cas.AccountId = supplier.Id;
		cas.Type = 'Trust Deed';
		cas.Insolvency_Practitioner__c = System.UserInfo.getUserId();
		cas.PTD_Quality_Of_Work_CL__c = qr.Id;
		
		insert cas;
		
		Case_Approval_Step__c appr = new Case_Approval_Step__c();
		appr.Case__c = cas.Id;
		appr.Step_Number__c = 1;
		appr.Status__c = 'Waiting for approver';
		appr.Approval_Type__c = 'Quality Of Work';
		insert appr;
	
		
		ApprovalProcessFactory.ApprovalProcessWrapper wrapper = ApprovalProcessFactory.createApprovalProcess(cas.Id);
		wrapper.canApproveReject();
		
		wrapper.canSubmitForApproval();
		wrapper.SubmitForApproval('Quality Of Work');
		
		wrapper.getReasonCodes();
		// Approve first stage approval
		List<User> testUser = [Select Id From User Where Id=:System.Label.Quality_Of_Work_Approver];
		System.runAs(testUser[0]) {
			wrapper.canApproveReject();
			wrapper.approve(false);
		}

		// Approve as IP
		//system.assertEquals(true, wrapper.canApproveReject());
		//wrapper.approve(false);		
	}
	
	private static TestMethod void testccQualityOfWorkApproval() {
		
		QResponse__c qr = new QResponse__c();
		qr.Status__c = 'Completed';
		qr.All_fields_complete__c = true;
		insert qr;
		
		CustomCase__c cc = new CustomCase__c();
    	cc.Partner__c=System.Label.Account_Invocas;
    	cc.Product__c='IVA';
    	cc.Case_Type__c='IVA';
    	cc.IVA_Quality_Of_Work_CL__c = qr.Id;
    	insert cc;
    			
		
		Case_Approval_Step__c appr = new Case_Approval_Step__c();
		appr.CustomCase__c = cc.Id;
		appr.Step_Number__c = 1;
		appr.Status__c = 'Waiting for approver';
		appr.Approval_Type__c = 'Quality Of Work';
		insert appr;
	
		
		ApprovalProcessFactory.ApprovalProcessWrapper wrapper = ApprovalProcessFactory.createApprovalProcess(cc.Id);
		wrapper.canApproveReject();		
		wrapper.canSubmitForApproval();
		wrapper.SubmitForApproval('Quality Of Work');		
		wrapper.getReasonCodes();
		// Approve first stage approval
		List<User> testUser = [Select Id From User Where Id=:System.Label.Quality_Of_Work_Approver];
		System.runAs(testUser[0]) {
			wrapper.canApproveReject();
			wrapper.approve(false); 
		}
	}

}

With Regards,
Bheemudu Neeli
Hello All,
I have a doubt on Apex:include and apex:tab compontes, I can include one vf page inside to other, while same time Apex:tabs are not worlking?, so we can't use the both components in a single vf page?.
if I use the below code my Apex:tabs are not working, I need help.

<apex:page standardController="Account" showHeader="true" 
      tabStyle="account" >
  <style>
      .activeTab {background-color: #236FBD; color:white; 
         background-image:none}
      .inactiveTab { background-color: lightgrey; color:black; 
         background-image:none}
   </style>
   
   <apex:include pageName="FieldSetTest" id="xyz"/>
   <apex:tabPanel switchType="client" selectedTab="tabdetails" 
                  id="AccountTabPanel" tabClass="activeTab" 
                  inactiveTabClass="inactiveTab">   
      <apex:tab label="Details" name="AccDetails" id="tabdetails">
         <apex:detail relatedList="false" title="true"/>
                 
      </apex:tab>
      <apex:tab label="Contacts" name="Contacts" id="tabContact">
         <apex:relatedList subject="{!account}" list="contacts" />
      </apex:tab>
      
      <apex:tab label="NewSec" name="NewDetails" id="tabdetails1">
                    <apex:dataTable value="{!account}" var="a">
         <apex:column value="{!a.name}" />
         <apex:column value="{!a.name}" />

         </apex:dataTable>         
      </apex:tab>
      
      <apex:tab label="Opportunities" name="Opportunities" 
                id="tabOpp">
         <apex:relatedList subject="{!account}" 
                           list="opportunities" />
      </apex:tab>
      <apex:tab label="Open Activities" name="OpenActivities" 
                id="tabOpenAct">
                <apex:dataTable value="{!account}" var="a">
         <apex:column value="{!a.name}" />
         </apex:dataTable>
         <apex:relatedList subject="{!account}" 
                           list="OpenActivities" />
      </apex:tab>
      <apex:tab label="Notes and Attachments" 
                name="NotesAndAttachments" id="tabNoteAtt">
         <apex:relatedList subject="{!account}" 
                           list="CombinedAttachments" />
      </apex:tab>
   </apex:tabPanel>
</apex:page>
....................................................

Thanks 
Bheemudu 
Hi All,
Can any one help me for ANT setup and configuration step by step process 
It is urgent to our end, I have to deploy through the ANT tool only.

Thanks 
Bheem
Hi All,
Please help me to write a test class for the below apex trigger.
Thanks in advance.
here is the code 

trigger PreventFileConDoc on ContentDocument (before delete) {
   // for(ContentDocumentLink conl : trigger.old){
   //     conl.adderror('ContentDocumentLink Cannot be deleted');
   // }
      Id profileId = userinfo.getProfileId();
    String profileName = [Select Id,name from Profile where Id =: profileId].Name;
   if(Trigger.isBefore && Trigger.isDelete){
        Map<Id, ContentDocument> mapContentDocument = new Map<Id, ContentDocument>([Select Id from ContentDocument where Id in: trigger.oldMap.keyset()]);
        for(ContentDocument cd : Trigger.Old){
             if (profileName != 'System Administrator') {
            if(mapContentDocument.containsKey(cd.Id)){
                cd.adderror('ContentDocument Cannot be deleted');
                system.debug('testing inside loop'+cd);
            }
        } 
        }

}



Thank you,
Bheem
Hi All,
Need a help on code coverage for before delete apex trigger 
Thanks in Advance, can any one please help me to write a test class for the below trigger... I tried my known ways but failed.
here is my code....
trigger PreventFileDeleion on ContentDocumentLink (before delete) {
      Id profileId = userinfo.getProfileId();
   String profileName = [Select Id,name from Profile where Id =: profileId].Name;
    
   if(Trigger.isBefore && Trigger.isDelete){
        Map<Id, ContentDocumentLink> mapContentDocument = new Map<Id, ContentDocumentLink>([Select Id from ContentDocumentLink where Id in: trigger.oldMap.keyset()]);
        for(ContentDocumentLink cd : Trigger.Old){
            if (profileName != 'System Administrator') {
            if(mapContentDocument.containsKey(cd.Id)){
                cd.adderror('ContentDocumentLink Cannot be deleted');
                system.debug('testing inside loop'+cd);
            }
        } 
        }
}
}
 
Hi All,
Please Help me to add a Date on below screen, Date field need to select on same page, so that Invoice should be Approve.
It will be done on VF page or else on controllers? need a help on below, its urgent.
User-added image
 
Hi All,
Need a help on encrypted field identification, In my Org there are some Encrypted Fields on various objects.
Is there any ways to Identify All at once. see the below sample field for the same.
User-added image
With Regards,
Bheem
Hi 
I have a requirement as a report to send users Monitor Bulk Data Load Jobs for both Processed and failed once.
If this is possible then please help. if not then how can I send the Bulk data load job details to Users those are failed.

Regards
Bheem
I am stuc on this challenge and its very frustrating. 

For some reason I cannot save the component code, i get an error message when trying to save:

Failed to save undefined: No EVENT named markup://c:addItemEvent found : [markup://c:campinglist]: Source


Here is the code im trying to save. anyone know why it wont allow me to save it?

<aura:component controller="CampingListController">
    
    <aura:handler name="init" action="{!c.doInit}" value="{!this}"/>
    <aura:handler name="addItem" event="c:addItemEvent" action="{!c.handleAddItem}"/>
    
    <div class="slds-page-header" role="banner">

      <div class="slds-grid">

        <div class="slds-col">

          <p class="slds-text-heading--label">Camping Items</p>

          <h1 class="slds-text-heading--medium">My Camping Items</h1>

        </div>

      </div>

    </div>

      
  <div aria-labelledby="newitemform">

      <fieldset class="slds-box slds-theme--default slds-container--small">
    
        <c:campingListForm />
    
      </fieldset>

    </div>
    
    
     <aura:attribute name="items" type="Camping_Item__c[]"/>

    <div class="slds-card slds-p-top--medium">
        <header class="slds-card__header">
            <h3 class="slds-text-heading--small">Camping List Items</h3>
        </header>
        
        <section class="slds-card__body">
            <div id="list" class="row">
                <aura:iteration items="{!v.items}" var="item">
                    <c:campingListItem item="{!item}"/>
                </aura:iteration>
            </div>
        </section>
    </div>

</aura:component>
Hi All, 
Please help to update the trigger for old value, please  where i'm doing wrong.
here is the code
trigger BulkifyTri1 on Account (before insert, before update){
       set<Id> accIds = new set<Id>();
       list<Account> UpdateAcc = new list<Account>();
       list<Account> accst = new list<Account>();
       list<Account> InsertAcc = new list<Account>();
     for ( Account a : trigger.new){
        if ( a.AccountNumber != NULL )
            a.Type = 'Other';
            InsertAcc.add(a);
            }
            insert InsertAcc;
        
    accst = [select id, name,AccountNumber,Type from account where Id in :accIds];  
    for(Account ac:accst )
    {
    if (ac.AccountNumber != NULL ){
    ac.Type = 'Prospect';
    UpdateAcc.add(ac);
    }
    }
    
    if(UpdateAcc.size()>0)
        {
            update UpdateAcc;
        }
      
  }
    

With Regards,
Bheemudu Neeli
The campingList JavaScript controller isn't setting the 'item' as a parameter or saving the record correctly.

My code is as follows:

1---Camping List Component
<aura:component controller="CampingListController">
	
    <aura:handler name="init" action="{!c.doInit}" value="{!this}"/>
    
    <aura:handler name="addItem" event="c:addItemEvent"
   	action="{!c.handleAddItem }"/>
    
    <aura:attribute name="newItem" type="Camping_Item__c"
     default="{ 'sobjectType': 'Camping_Item__c',
                    'Name': '',
                    'Quantity__c': 0,
                    'Price__c': 0,
                    'Packed__c': false }"/>
    
    <aura:attribute name="items" type="Camping_Item__c[]"/>
    
    <ol>
    <li>Bug Spray</li>
    <li>Bear Repellant</li>
    <li>Goat Food</li>
    </ol>
    
       <!-- NEW EXPENSE FORM -->
    <div class="slds-col slds-col--padded slds-p-top--large">

        <c:campingListForm/>

    </div>
    <!-- / NEW EXPENSE FORM -->    
   

    <div class="slds-card slds-p-top--medium">
        <header class="slds-card__header">
            <h3 class="slds-text-heading--small">Items</h3>
        </header>
        
        <section class="slds-card__body">
            <div id="list" class="row">
                <aura:iteration items="{!v.items}" var="items">
                    <c:campingListItem item="{!item}"/>
                </aura:iteration>
            </div>
        </section>
    </div>

</aura:component>

2---Camping List Controller
 
({
    // Load items from Salesforce
	doInit: function(component, event, helper) {

    // Create the action
    var action = component.get("c.getItems");

    // Add callback behavior for when response is received
    action.setCallback(this, function(response) {
        var state = response.getState();
        if (component.isValid() && state === "SUCCESS") {
            component.set("v.items", response.getReturnValue());
        }
        else {
            console.log("Failed with state: " + state);
        }
    });

    // Send action off to be executed
    $A.enqueueAction(action);
},

    
    handleAddItem: function(component, event, helper) {
    var newItem = event.getParam("item");
    //helper.createItem(component, newItem);
        this.saveItem(component, item, function(response){
        var state = response.getState();
        if (component.isValid() && state === "SUCCESS") {
            var items = component.get("v.items");
            items.push(response.getReturnValue());
            component.set("v.items", items);
        }
    }
          
}
                      
})

3---Camping List Helper

Empty

4---Camping List Form
 
<aura:component >
	
    <aura:registerEvent name="addItem" type="c:addItemEvent"/>
        <!-- CREATE NEW ITEM FORM -->
    <form class="slds-form--stacked">

      <div class="slds-form-element slds-is-required">
          <div class="slds-form-element__control">
              <ui:inputText aura:id="itemname" label="Name"
                  class="slds-input"
                  labelClass="slds-form-element__label"
                  value="{!v.newItem.Name}"
                  required="true"/>

          </div>
     </div>

     <div class="slds-form-element slds-is-required">
          <div class="slds-form-element__control">
              <ui:inputNumber aura:id="quantity" label="Quantity"
                  class="slds-input"
                  labelClass="slds-form-element__label"
                  value="{!v.newItem.Quantity__c}"
                  required="true"/>

          </div>
      </div>

      <div class="slds-form-element">
          <div class="slds-form-element__control">
              <ui:inputCurrency aura:id="price" label="Price"
                  class="slds-input"
                  labelClass="slds-form-element__label"
                  value="{!v.newItem.Price__c}"
                  />
          </div>
      </div>

      <div class="slds-form-element">
          <ui:inputCheckbox aura:id="packed" label="Packed?"
              class="slds-checkbox"
              labelClass="slds-form-element__label"
              value="{!v.newItem.Packed__c}"/>
      </div>

      <div class="slds-form-element">
          <ui:button label="Create Camping Item"
              class="slds-button slds-button--brand"
              press="{!c.clickCreateItem}"/>
      </div>

    </form>
    <!-- / CREATE NEW ITEM FORM -->
</aura:component>

5---CampingListFormController
 
({
    
    clickCreateItem: function(component, event, helper) {    
    if(helper.validateItemForm(component)){
        // Create the new item
        var newItem = component.get("v.newItem");
        helper.createItem(component, newItem);
    }
        
        }

})

6---CampingListFormHelper
 
({
 createItem: function(component, newItem) {
    var createItem = component.getItem("createItem");
    createItem.setParams({ "item": item });
    createItem.fire();
             component.set("v.newItem",{ 'sobjectType': 'Camping_Item__c',
                    'Name': '',
                    'Quantity__c': 0,
                    'Price__c': 0,
                    'Packed__c': false }/>);
},
    

		validateItemForm: function(component) {
		
              // Simplistic error checking
        var validItem = true;

        // Name must not be blank
        var nameField = component.find("itemname");
        var itemname = nameField.get("v.value");
        if ($A.util.isEmpty(itemname)){
            validItem = false;
            nameField.set("v.errors", [{message:"Item name can't be blank."}]);
        }
        else {
            nameField.set("v.errors", null);
        }
        
        // Quantity must not be blank
        var quantityField = component.find("quantity");
        var quantity = nameField.get("v.value");
        if ($A.util.isEmpty(quantity)){
            validItem = false;
            quantityField.set("v.errors", [{message:"Quantity can't be blank."}]);
        }
        else {
            quantityField.set("v.errors", null);
        }
		// Price must not be blank
        var priceField = component.find("price");
        var price = priceField.get("v.value");
        if ($A.util.isEmpty(price)){
            validItem = false;
            priceField.set("v.errors", [{message:"Price can't be blank."}]);
        }
        else {
            quantityField.set("v.errors", null);
        }
            return validItem;

	}
})

I am still getting this error:

User-added image

Any help would be appreciated.
 
Hello All,
Please give some suggestions to me,I way is solve my issue, by trigger, workflow and validation etc..
I have a requiremnet to add an error popup when creating a Event. this when account have some checkbox is true, then only I need display some error popup, why beacuse the account have some checkbox is true.


Thanks
Bheemudu Neeli
It is urgent requiremnet,
count the number of accounts at account owner level.
 I mean the accounts they are the ownerof. the requiremnet is only count of accouts not a name.
for example: account, contain 100 records on same account owner. then this count of 100 sholud be display on that Users custom field.

Here is the code,

global class NumberOfBPsClass implements Database.Batchable<sObject> {
   
    List<Account> acc= new List<Account>();
   //String query;
    Set<Id> userIds =new Set<Id>();
   User currentUser=new User();
     //currentUserId = UserInfo.getUserId();
    //List<User> currentUser=[SELECT Number_of_Business_Partners__c,Number_of_BPs_in_Team__c FROM User WHERE Id=:currentUserId];
    
    
    global Database.QueryLocator start(Database.BatchableContext BC) {
        
        return Database.getQueryLocator([SELECT Number_of_Business_Partners__c,Number_of_BPs_in_Team__c FROM User]);
    }
   
    global void execute(Database.BatchableContext BC, List<sObject> scope)
      {
          List<Account> accns = new List<Account>();
       List<user> lstcon= new List<user>();
         for(sObject s : scope)
         {
                 Account a = (Account)s;
                 user c = new user();
        c.Number_of_Business_Partners__c=accns.size();
                  lstcon.add(c);
                  }
          
      insert lstcon;
      }
    global void finish(Database.BatchableContext BC) {
    }
}


thnaks in advance
It is very urgent,
I have to Update a custom field on User object,requiremnt is when one user contains 10 account records, then this 10 should be display on user custom field. so how to achive this ?
for example: account, acount contain 100 records on same account owner. then this 100 sholud be display on that User custom field for reporting purpose. 


Thanks In Advance
acutally i am getting Unexpected identifier error. I found the resone, In my text data have the (`), so that I'm getting, I can't change the data in Production, so I want to solve it by java script. first is it possible? 
advance thanks,