• PJaya
  • NEWBIE
  • 25 Points
  • Member since 2011

  • Chatter
    Feed
  • 1
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 9
    Questions
  • 18
    Replies
Dependent Picklist values when the picklist refereing to global picklist

I have tried to get the dependentfield.getPicklistValues();  everything is working fine
but now i have changed the dependent picklist field to look on the global picklist, so when i am refering to global picklist its failing

 
  • June 23, 2016
  • Like
  • 0

Hi All, can tell me how do i get the all the user details above me in the hirerarchy

 

example :

 

1--->>-- 2,3  ---4,5--4--6,5--7-----8--9--10

 

when ever  user 8 act's on account,  i need to get all the users details above him

 

in the above case all users are 1,2 3,4,5,6,7,

 

can any one help m on this .

 

Thanks in advance.

 

 

  • April 26, 2013
  • Like
  • 0

hi friends,

 

iam using  rerender to display  2 output panels <apex:page controller="ClusterVfController">

 

action support is calling the controller for first time coreectly.

 

when i try to change the data without selecting the data for mandat feils the controller is not called and the old data is populated only how can i overcome this.

 

here is my Vf page


<apex:form >
<apex:messages />
<apex:pageblock title="Company Movement">
 <apex:pageblockSection title="SME Logo1 ">
     <apex:outputLabel id="Logo1" value="Logo1:">
         <apex:inputField id="log" value="{!log.SME_Logo1__c}">
         <apex:actionSupport event="onchange" action="{!Accwrappermethod}" reRender="ParentChildDts,xyz"/>
         </apex:inputField>
      </apex:outputLabel>
  </apex:pageblockSection>  
 
    <apex:outputPanel id="ParentChildDts" >
    <apex:outputPanel rendered="{!isnotblank}">
    <apex:pageBlockTable value="{!accwrapperlist}" var="accwr" id="AccTable">       
                  <apex:column >
                      <apex:facet name="header">
                         <apex:inputCheckbox >
                            <apex:actionSupport event="onclick"  onsubmit="checkAll(this)" reRender=""/>
                         </apex:inputCheckbox>
                      </apex:facet>
                        <apex:inputCheckBox value="{!accwr.isSelected}" id="testchk"/>
                  </apex:column>                
                                   
                    <apex:column headerValue="Account ID" width="45%">
                        {!accwr.acc1.Id}
                    </apex:column>                   
                    <apex:column headerValue="Account Name" width="25%">
                        {!accwr.acc1.Name}
                   </apex:column>
     </apex:pageBlockTable>
     </apex:outputPanel>
     </apex:outputPanel> 
  
<apex:outputPanel id="xyz">   
       <apex:pageblockSection title="SME Logo2 " rendered="{!isnotblank}">
         <apex:outputLabel id="Logo2" value="Logo2:"> 
             <apex:inputField id="log2" required="true"  value="{!log2.SME_Logo1__c}"/>  
              </apex:outputLabel>
        <apex:commandButton value="Transfer" action="{!transferaccount}"/>
       </apex:pageblockSection>
   </apex:outputPanel>
  
     </apex:pageblock>
</apex:form>
<script>
        function checkAll(cb)
        {
            var inputElem = document.getElementsByTagName("input");
            for(var i=0; i<inputElem.length; i++)
            {
                if(inputElem[i].id.indexOf("testchk")!=-1)
                inputElem[i].checked = cb.checked;
            }
            return false;
        }
</script>
      
</apex:page>

 

Here is my controller on custom object

 

public class ClusterVfController{
       
        public boolean isnotblank{get;set;}
       
 //   Declare one wrapper class to maintain checkbox status
    public class accWrapper {
        public Account acc1{get;set;}
        public Boolean isSelected { get; set; }
        public accWrapper() {
              acc1= new Account();
              isSelected  = false;       
        }               
        public accWrapper(Account acc1, Boolean isSelected) {
             this.acc1=acc1;
             this.isSelected  = isSelected;
        }                      
    }


public ClusterVfController(){
  log = new Logo__c();
  log2 = new Logo__c();
  isnotblank=false; 
 system.debug('=====LogoController=========isnotblank==================='+isnotblank);


 }
public Map<Id, Account> SelctParentLogomap = new Map<Id, Account>();   
public Logo__c log{get;set;}
public Logo__c log2{get;set;}
      
 public List<accWrapper> accwrapperlist{get;set;}

 public String getLog() {
 system.debug('=======getLog=======isnotblank==================='+isnotblank);
   return null;
 }
 
    public void  accwrappermethod(){       
       accwrapperlist = new List<accWrapper>();
       system.debug('save===log======'+log);
       selctParentLogomap =new Map<Id, Account>([Select id,name from Account where ParentId=:log.SME_Logo1__c]);
      
       system.debug('+++++++++++SelctParentLogomap ++++++++:::::'+ SelctParentLogomap.size());
       for(Account acc1: SelctParentLogomap.values()){
          accwrapperlist.add(new accWrapper(acc1,false));
       } 
       if(accwrapperlist.size()>0){
              isnotblank=true;
       }else{
              isnotblank=false;
        }
      system.debug('===================isnotblank========='+isnotblank);


       //return accwrapperlist;
    }
public pageReference transferaccount (){
system.debug('save===log2======'+log2);
system.debug('&&&log2 ---------------------OwnerId&&&'+log2.ownerid);
Account acc2 =[select id,ownerid from account where id=:log2.SME_Logo1__c];
system.debug('save===acc2 id======'+acc2.id);

list<Account> acclist=new list<Account>();

for(accWrapper wrap1: accwrapperlist){
if(wrap1.isSelected==true){
wrap1.acc1.OwnerId=acc2.ownerid;
acclist.add(wrap1.acc1);
}
}
try{
system.debug('****acclist*****'+acclist);
update acclist;
}catch(Exception e){
ApexPages.addMessage(new ApexPages.Message(ApexPages.Severity.FATAL,e.getMessage()));
}
PageReference assignmentpage = ApexPages.currentPage();
assignmentpage.setRedirect(true);
return null;
}

}

 

 

Thanks in advance

  • April 02, 2013
  • Like
  • 0

<apex:inputField id="log" value="{!log.SME_Logo1__c}">
     <apex:actionSupport event="onselect" action="{!Accwrappermethod}" rerender="ParentChildDts"/>
</apex:inputField>

 

 

 

  • March 20, 2013
  • Like
  • 0

here is my Apex class

 

 

global class Lead_Conversion {

   WebService static String convertLead(Id leadId){
       system.debug('++++++++++LEAD ID***********'+leadId);
       Account  acc;
       String status;
       String errorIndication='';
       try{
           Lead lead1=[SELECT OwnerId,Account_Owner_SFDC_Id__c,Opportunity__c,Sfdc_Account_BackendId__c,Company,Email,Circle__c,City,Account__c,Product_Type__c,SME_TTL_Product__c,Product_Quantity__c,Proposed_Order_value_In_Rs_Lakh__c From Lead where Id=:leadId];
        
        
           /*Lead lead1=[Select Account__c,Account_Owner_SFDC_Id__c,Opportunity__c,Website,TotalNumberofDisconnections__c,TotalLeadsReassigned__c,TotalLeadsGenerated__c,TotalLeadsAssigned__c,Title,
                       SystemModstamp,Street,Status,State,Sfdc_Account_BackendId__c,Salutation,SME_TTL_Product__c,SME_SemiAdminIDMID__c,SLALeads__c,
                        SFDC_Lead_ID__c,Retail_Lead_Value__c,Remarks__c,RecordTypeId,Rating,Proposed_Order_value_In_Rs_Lakh__c,Product__c,Product_Type__c,
                        Product_Quantity__c,PostalCode,Phone,OwnerId,OpenCases__c,NumberOfEmployees,No_of_Del_Active__c,Name,Mode_of_Entry__c,MasterRecordId,
                        LeadsGenerated__c,LeadsActedOn__c,Lead_Type__c,Lead_Region__c,Lead_Priority__c,Lead_Closure_Reason__c,Lead_Classification__c,
                        Lead_Captured_By_IDM_ID__c,LeadSource,LeadRecType__c,LeadClosedDate__c,LastName,LastModifiedDate,LastModifiedById,LastActivityDate,
                        LPMS_Lead_ID__c,LPMS_ID_from_ePOS__c,LPMS_ID_Discrepancy__c,IsUnreadByOwner,IsDeleted,IsConverted,Industry,Id,Generated_Date_and_Time__c,
                        Follow_Up_date_time__c,FirstName,EmailBouncedReason,EmailBouncedDate,Email,Description,Del_No__c,Del_Activation_Status__c,Del_Activation_State__c,
                        DateLeadActedOn__c,CustomerName__c,CreatedDate,CreatedById,Country,ConvertedOpportunityId,ConvertedDate,ConvertedContactId,
                        ConvertedAccountId,Conversion_Field_Update__c,Company_segment__c,Company_Type__c,Company,City,Circle__c,Area_Name__c,AnnualRevenue,
                        Account_Trigger__c,Account_Number__c From Lead where Id=:leadId];*/
                        
          system.debug('=========lead1.OwnerId========'+lead1.OwnerId+'++++++++++Account Owner ID***********'+lead1.Account_Owner_SFDC_Id__c+'+++++++++++++++lead1.Opportunity__c++++++++++++++'+lead1.Opportunity__c+'++++lead1.Sfdc_Account_BackendId__c++++++++'+lead1.Sfdc_Account_BackendId__c); 
           map<Id,SME_Product__c> smettlproductmap=new Map<Id,SME_Product__c>([select ID,Name,List_Price__c,Product_Family__c,Product_Group__c from SME_Product__c]);
             system.debug('smettlproductmap=====>>>>'+smettlproductmap);
                 
           Schema.RecordTypeInfo TtlOppRecordtype= Schema.SObjectType.Opportunity.getRecordTypeInfosByName().get('SME New/Upgrade TTL Product Opportunity');
           Id TtlOpprecordtypeId=TtlOppRecordtype.getRecordTypeId();
            system.debug('=====TtlOpprecordtypeId========='+TtlOpprecordtypeId);
           Schema.RecordTypeInfo TclOppRecordtype= Schema.SObjectType.Opportunity.getRecordTypeInfosByName().get('SME New/Upgrade TCL Product Opportunity');
           Id TclOpprecordtypeId=TclOppRecordtype.getRecordTypeId();
               system.debug('============='+TclOpprecordtypeId);
               system.debug('==LeadConversion=====Sfdc_Account_BackendId__c=============='+lead1.Sfdc_Account_BackendId__c);
           boolean accExist=true;
           boolean accInserted=false;
           if(lead1.Sfdc_Account_BackendId__c==null){
           try{
            Schema.RecordTypeInfo SmeAccountrecordtype= Schema.SObjectType.Account.getRecordTypeInfosByName().get('SME Account');
            Id AccountRecTypeId=SmeAccountrecordtype.getRecordTypeId();          
            system.debug('========AccountRecTypeId========='+AccountRecTypeId);

                User usrs=[select Name,IDM_Id__c,IDM_ID_of_USer__c from User where Id=:lead1.OwnerId];
                Integer AccchkExists=[select count() from Account where Name=:lead1.Company];
                
                if(AccchkExists>0){                
                    system.debug('Account already exists with the name: '+lead1.Company+' so new account cannot be created with same name');
                }else{
                    acc = new Account();               
                        acc.Name = lead1.Company;
                        acc.Type_Of_Corporate__c = 'SME A';
                        acc.OwnerId =lead1.OwnerId;
                        acc.OwnerEmail__c =lead1.Email;
                        acc.RecordtypeId = AccountRecTypeId;
                        acc.Vertical_Segment__c='SME';
                        acc.TTL_Status__c='Non-Verified';
                        acc.TCL_Status__c='Non-Verified';
                        acc.Share_to_SalesCoordinator__c='YES';
                        acc.Circle__c=lead1.Circle__c;
                        acc.City__c=lead1.City;
                        acc.OwnerIDMId__c=usrs.IDM_Id__c;
                    Insert acc; 
                    accInserted=true;
                }               
            }catch(Exception e){
                status='Failure';
                accExist=false;              
                errorIndication=' Failed while creating account ';
                system.debug(e);            
            }
           }           
           boolean currentLeadUpdated=true;              
           if(accInserted){
             try{
                system.debug('====accName===='+acc.Name+'=====accID====='+acc.Id);
                lead1.Sfdc_Account_BackendId__c=acc.Id;
                lead1.Account__c=acc.Id;
                update lead1;
                currentLeadUpdated=true;
            }catch(Exception e){
                currentLeadUpdated=false;
                system.debug('Exception while updatating lead');
                system.debug(e);
            } 
           }
           if(currentLeadUpdated){
               system.debug('======into loop currentLeadUpdated--==========');
                lead1=null;
                lead1=[SELECT OwnerId,Account_Owner_SFDC_Id__c,Opportunity__c,Sfdc_Account_BackendId__c,Company,Email,Circle__c,City,Account__c,Product_Type__c,SME_TTL_Product__c,Product_Quantity__c,Proposed_Order_value_In_Rs_Lakh__c From Lead where Id=:leadId];

              (here the base on the id query is fetched but while executing the query its raising this error plz help me out)
               /* lead1=[Select Account__c,Account_Owner_SFDC_Id__c,Opportunity__c,Website,TotalNumberofDisconnections__c,TotalLeadsReassigned__c,TotalLeadsGenerated__c,TotalLeadsAssigned__c,Title,
                        SystemModstamp,Street,Status,State,Sfdc_Account_BackendId__c,Salutation,SME_TTL_Product__c,SME_SemiAdminIDMID__c,SLALeads__c,
                        SFDC_Lead_ID__c,Retail_Lead_Value__c,Remarks__c,RecordTypeId,Rating,Proposed_Order_value_In_Rs_Lakh__c,Product__c,Product_Type__c,
                        Product_Quantity__c,PostalCode,Phone,OwnerId,OpenCases__c,NumberOfEmployees,No_of_Del_Active__c,Name,Mode_of_Entry__c,MasterRecordId,
                        LeadsGenerated__c,LeadsActedOn__c,Lead_Type__c,Lead_Region__c,Lead_Priority__c,Lead_Closure_Reason__c,Lead_Classification__c,
                        Lead_Captured_By_IDM_ID__c,LeadSource,LeadRecType__c,LeadClosedDate__c,LastName,LastModifiedDate,LastModifiedById,LastActivityDate,
                        LPMS_Lead_ID__c,LPMS_ID_from_ePOS__c,LPMS_ID_Discrepancy__c,IsUnreadByOwner,IsDeleted,IsConverted,Industry,Id,Generated_Date_and_Time__c,
                        Follow_Up_date_time__c,FirstName,EmailBouncedReason,EmailBouncedDate,Email,Description,Del_No__c,Del_Activation_Status__c,Del_Activation_State__c,
                        DateLeadActedOn__c,CustomerName__c,CreatedDate,CreatedById,Country,ConvertedOpportunityId,ConvertedDate,ConvertedContactId,
                        ConvertedAccountId,Conversion_Field_Update__c,Company_segment__c,Company_Type__c,Company,City,Circle__c,Area_Name__c,AnnualRevenue,
                        Account_Trigger__c,Account_Number__c From Lead where Id=:leadId]; */
           }
           system.debug('==lead again querying========lead1.Account_Owner_SFDC_Id__c;==========='+lead1.Account_Owner_SFDC_Id__c);
           system.debug('====lead1.Opportunity__c===='+lead1.Opportunity__c+'====accExist==='+accExist);
           If(lead1.Opportunity__c==null && accExist){
            system.debug('=========If==lead1.Opportunity__c==null  accExist=================');
            boolean toinsertOpp=true;
               Opportunity opp1=new Opportunity();
               Products_Services__c tclpro = new Products_Services__c();
               opp1.Name='ConvertedLead';
                //opp1.AccountId=lead1.Account__c;
               if(lead1.Sfdc_Account_BackendId__c==null && accExist){
                  system.debug('====AccountExistd===lead1.Account__c=========='+lead1.Account__c);
                  opp1.AccountId=lead1.Account__c;                
               }else if(lead1.Sfdc_Account_BackendId__c==null && !accExist){
                  system.debug('==AccountNotExists===acc.Id====='+acc.Id);
                  opp1.AccountId=acc.Id;
               }else{
                  system.debug('==Account===lead1.Account__c====='+lead1.Account__c);
                  opp1.AccountId=lead1.Account__c;
               }
               //opp1.OwnerId=lead1.Account_Owner_SFDC_Id__c;
               //opp1.OwnerId=acc.OwnerId;
               opp1.OwnerId=lead1.OwnerId;
               opp1.Type='New';
               Date dt1=Date.today();
               opp1.CloseDate=dt1;
               opp1.Opportunity_source__c='LEAD CONVERT';
               opp1.StageName='Identified Opportunity';
               system.debug('====lead1.Product_Type__c======'+lead1.Product_Type__c);
               if(lead1.Product_Type__c=='TTL'){
                system.debug('================lead1.Product_Type__c==TTL==============');
                   opp1.RecordTypeId=TtlOpprecordtypeId;
                   system.debug('============smettlproductmap.get(lead1.SME_TTL_Product__c).List_Price__c======================');
                   Integer smetlmapVal=null;
                   try{
                    smetlmapVal=Integer.valueOf(smettlproductmap.get(lead1.SME_TTL_Product__c).List_Price__c);
                   }catch(Exception e){
                    status='Failure';
                    errorIndication='Unable to find the product id for this lead';
                    system.debug(e);
                   }
                   system.debug('================smetlmapVal================='+smetlmapVal);                   
                   if(smetlmapVal!=null){
                         if(smetlmapVal > 0){
                           opp1.SME_Product__c=lead1.SME_TTL_Product__c;
                           opp1.TotalOpportunityQuantity=lead1.Product_Quantity__c;
                          }else if(smetlmapVal==null ||smetlmapVal==0){
                           opp1.SME_Product__c=lead1.SME_TTL_Product__c;
                           opp1.TotalOpportunityQuantity=lead1.Product_Quantity__c;
                           opp1.Annual_Recurring_Charges__c=lead1.Proposed_Order_value_In_Rs_Lakh__c;
                           opp1.Manage_Service_Rentals__c=0;
                           opp1.One_Time_Charges__c=0;
                        }
                   } 
                }else if(lead1.Product_Type__c=='TCL'){
                   system.debug('================lead1.Product_Type__c==TL==============');
                   opp1.RecordTypeId=TclOpprecordtypeId;
                   opp1.ForecastCategoryName='Pipeline';
                   opp1.Is_Standard_NonStandard__c='Standard';
               }else{
                 system.debug('================lead1.Product_Type__c==false==============');
                 toinsertOpp=false;
                 status='Failure';
                 errorIndication='Product selected is not correct';
                 system.debug('0000000   status======'+status+' errorIndication========'+errorIndication);                 
               }
               system.debug('111111  status======'+status+' errorIndication========'+errorIndication);
               system.debug('================toinsertOpp=============='+toinsertOpp);
                   if(toinsertOpp){
                       try{                    
                           insert opp1;
                           status='Success'; 
                           errorIndication='success';
                           lead1.Opportunity__c=opp1.Id;
                           update lead1;                       
                       }catch(Exception e){
                            status='Failure';
                            if(errorIndication.length()==0)errorIndication='Opportunity not created due to data mismatch';
                            system.debug('2222222   status======'+status+' errorIndication========'+errorIndication);
                            system.debug('Exception while trying to insertion/updataion of the oppurtunity');
                            system.debug(e);                
                       } 
                   }else{
                      status='Failure';
                      errorIndication='opportunity exists for this lead';
                      system.debug('333333   status======'+status+' errorIndication========'+errorIndication);
                   }
           }
       }catch(Exception e){
            status='Failure';
            errorIndication=' ServerError';
            system.debug('Exception=========Occured=====');
            system.debug('=======ExcepDetails=============='+e.getMessage());
        }
        status=status+'**'+errorIndication;
        system.debug('===status===================='+status);
        system.debug('==errorIndication============='+errorIndication);
        return status;
    }
    
    
}

 

 

 

My Test Class is

===============

 

@isTest (SeeAllData = true)  
global class LeadConversionTestCase{ 
          Static testmethod void testManage_bulklead() {
          
        //Get Show Manager profile Id.
        Profile p1 = [SELECT Id FROM Profile WHERE Name ='SME Semi_Admin'];
        system.debug('============Profile======p1=========='+p1);
        Profile p2 = [SELECT Id FROM Profile WHERE Name ='SME_Supervisor'];
        system.debug('============Profile======p2=========='+p2);
        User semiAdmin = new User(Alias = 'uc1233', Email='uc123@sfdc.com', EmailEncodingKey='UTF-8', LastName='Testing User2', 
                                    LanguageLocaleKey='en_US', LocaleSidKey='en_US', ProfileId = p1.Id, 
                                    TimeZoneSidKey='America/Los_Angeles', UserName='nU123@test.com');
           insert semiAdmin;
           User brm1 = new User(Alias = 'uc1233', Email='uc1234@sfdc.com', EmailEncodingKey='UTF-8',FirstName ='TTL', LastName='TestingUser', 
                                    LanguageLocaleKey='en_US', LocaleSidKey='en_US', ProfileId = p2.Id,
                                    TimeZoneSidKey='America/Los_Angeles', UserName='nU1234@test.com',SME_User_Region__c='AP',SME_RoleName__c='SALESHEAD');  
            insert brm1;
            Schema.RecordTypeInfo SmeLeadrecordtype= Schema.SObjectType.Lead.getRecordTypeInfosByName().get('Company Lead');
            system.debug('==========SmeLeadrecordtype================================='+SmeLeadrecordtype);
            
            Id SmeLeadrecordtypeId=SmeLeadrecordtype.getRecordTypeId();
          try{
             Test.StartTest();
          
            //Run test as user whose profile is show Manager                        
            System.runas(semiAdmin) {
            
              
            RecordType rc = [SELECT Id FROM RecordType WHERE Name='SME TTL Products'];
            system.debug('==================rc============='+rc);
            
            SME_Product__c prdSME= new SME_Product__c();
                prdSME.Name='TESTPRO';
                prdSME.Product_Group__c='CDMA Mobile';
                prdSME.RecordTypeID=rc.id;
                prdSME.Product_Manager__c=semiAdmin.id;//SME Product
                prdSME.Product_Family__c='Fixed Voice';
                prdSME.List_Price__c=500;
                prdSME.Active__c=TRUE;
            insert prdSME;     
                prdSME.Lock__c='NO';
            update prdSME;
            system.debug('=============jjjjj====semiAdmin.Id=============='+semiAdmin.Id);
            Lead testleadobj=new Lead(LastName='jakc',Company='jakc',Status='Qualified',Company_segment__c='SME A',Lead_Type__c='Company',Lead_Region__c='AP',Product_Type__c='TTL',Product__c=prdSME.Id,SME_TTL_Product__c=prdSME.Id,OwnerId=semiAdmin.Id,RecordTypeId=SmeLeadrecordtype.getRecordTypeId());
            insert testleadobj;
            system.debug('=============jjjj====testleadobj.OwnerId============='+testleadobj.OwnerId+'====testleadobj.Id=='+testleadobj.Id);
           // testleadobj.Status='Closed-Sold';
            //update testleadobj;
           // system.debug('===============testleadobj============'+testleadobj);
           // Lead fetId=[select Name,Id from Lead where Id=:testleadobj.Id];
           // system.debug('=========fetId========'+fetId.Id);
            Lead_Conversion.convertLead(testleadobj.Id);    (here the id is passed to the apex class)

 

 

 

 

 

 

 

 

 

 

  • January 08, 2013
  • Like
  • 0
Hi, Can anyone post a sample code for executing the test method for approval Process.My actual requirement is Whenever a record is created and a particular field is updated it goes for the manager approval.So first i want to create a record and i should unlock the record from approval process and then edit it. Mainly i need the code to achieve the approval process where the record should be approved in the test method. Thanks in Advance!!
  • December 26, 2012
  • Like
  • 0

developed an visual force page and renderas PDF in which dispaying the Related list NotesandAttcahments

 

 

when i save that PDF iam unable to read the notesandattachments related list data on click on the view its asking for sales force login

 

 

 

here is my code can u plz help me out

 

<apex:page standardController="Account" renderAs="PDF">
<apex:pageBlock >
You're looking at some related lists for {!account.name}:
</apex:pageBlock>
<apex:relatedList list="NotesandAttachments"/>

<apex:relatedList list="Opportunities" />
<apex:relatedList list="Contacts">
<apex:facet name="header">Titles can be overriden with facets</apex:facet>
</apex:relatedList>
<apex:relatedList list="Cases" title="Or you can keep the image, but change the text"/>
</apex:page>

 

 

  • April 16, 2012
  • Like
  • 0

how to write trigger on Oppurtunity related list Sales team object

 

 

  • October 13, 2011
  • Like
  • 0

Hi All, can tell me how do i get the all the user details above me in the hirerarchy

 

example :

 

1--->>-- 2,3  ---4,5--4--6,5--7-----8--9--10

 

when ever  user 8 act's on account,  i need to get all the users details above him

 

in the above case all users are 1,2 3,4,5,6,7,

 

can any one help m on this .

 

Thanks in advance.

 

 

  • April 26, 2013
  • Like
  • 0

hi friends,

 

iam using  rerender to display  2 output panels <apex:page controller="ClusterVfController">

 

action support is calling the controller for first time coreectly.

 

when i try to change the data without selecting the data for mandat feils the controller is not called and the old data is populated only how can i overcome this.

 

here is my Vf page


<apex:form >
<apex:messages />
<apex:pageblock title="Company Movement">
 <apex:pageblockSection title="SME Logo1 ">
     <apex:outputLabel id="Logo1" value="Logo1:">
         <apex:inputField id="log" value="{!log.SME_Logo1__c}">
         <apex:actionSupport event="onchange" action="{!Accwrappermethod}" reRender="ParentChildDts,xyz"/>
         </apex:inputField>
      </apex:outputLabel>
  </apex:pageblockSection>  
 
    <apex:outputPanel id="ParentChildDts" >
    <apex:outputPanel rendered="{!isnotblank}">
    <apex:pageBlockTable value="{!accwrapperlist}" var="accwr" id="AccTable">       
                  <apex:column >
                      <apex:facet name="header">
                         <apex:inputCheckbox >
                            <apex:actionSupport event="onclick"  onsubmit="checkAll(this)" reRender=""/>
                         </apex:inputCheckbox>
                      </apex:facet>
                        <apex:inputCheckBox value="{!accwr.isSelected}" id="testchk"/>
                  </apex:column>                
                                   
                    <apex:column headerValue="Account ID" width="45%">
                        {!accwr.acc1.Id}
                    </apex:column>                   
                    <apex:column headerValue="Account Name" width="25%">
                        {!accwr.acc1.Name}
                   </apex:column>
     </apex:pageBlockTable>
     </apex:outputPanel>
     </apex:outputPanel> 
  
<apex:outputPanel id="xyz">   
       <apex:pageblockSection title="SME Logo2 " rendered="{!isnotblank}">
         <apex:outputLabel id="Logo2" value="Logo2:"> 
             <apex:inputField id="log2" required="true"  value="{!log2.SME_Logo1__c}"/>  
              </apex:outputLabel>
        <apex:commandButton value="Transfer" action="{!transferaccount}"/>
       </apex:pageblockSection>
   </apex:outputPanel>
  
     </apex:pageblock>
</apex:form>
<script>
        function checkAll(cb)
        {
            var inputElem = document.getElementsByTagName("input");
            for(var i=0; i<inputElem.length; i++)
            {
                if(inputElem[i].id.indexOf("testchk")!=-1)
                inputElem[i].checked = cb.checked;
            }
            return false;
        }
</script>
      
</apex:page>

 

Here is my controller on custom object

 

public class ClusterVfController{
       
        public boolean isnotblank{get;set;}
       
 //   Declare one wrapper class to maintain checkbox status
    public class accWrapper {
        public Account acc1{get;set;}
        public Boolean isSelected { get; set; }
        public accWrapper() {
              acc1= new Account();
              isSelected  = false;       
        }               
        public accWrapper(Account acc1, Boolean isSelected) {
             this.acc1=acc1;
             this.isSelected  = isSelected;
        }                      
    }


public ClusterVfController(){
  log = new Logo__c();
  log2 = new Logo__c();
  isnotblank=false; 
 system.debug('=====LogoController=========isnotblank==================='+isnotblank);


 }
public Map<Id, Account> SelctParentLogomap = new Map<Id, Account>();   
public Logo__c log{get;set;}
public Logo__c log2{get;set;}
      
 public List<accWrapper> accwrapperlist{get;set;}

 public String getLog() {
 system.debug('=======getLog=======isnotblank==================='+isnotblank);
   return null;
 }
 
    public void  accwrappermethod(){       
       accwrapperlist = new List<accWrapper>();
       system.debug('save===log======'+log);
       selctParentLogomap =new Map<Id, Account>([Select id,name from Account where ParentId=:log.SME_Logo1__c]);
      
       system.debug('+++++++++++SelctParentLogomap ++++++++:::::'+ SelctParentLogomap.size());
       for(Account acc1: SelctParentLogomap.values()){
          accwrapperlist.add(new accWrapper(acc1,false));
       } 
       if(accwrapperlist.size()>0){
              isnotblank=true;
       }else{
              isnotblank=false;
        }
      system.debug('===================isnotblank========='+isnotblank);


       //return accwrapperlist;
    }
public pageReference transferaccount (){
system.debug('save===log2======'+log2);
system.debug('&&&log2 ---------------------OwnerId&&&'+log2.ownerid);
Account acc2 =[select id,ownerid from account where id=:log2.SME_Logo1__c];
system.debug('save===acc2 id======'+acc2.id);

list<Account> acclist=new list<Account>();

for(accWrapper wrap1: accwrapperlist){
if(wrap1.isSelected==true){
wrap1.acc1.OwnerId=acc2.ownerid;
acclist.add(wrap1.acc1);
}
}
try{
system.debug('****acclist*****'+acclist);
update acclist;
}catch(Exception e){
ApexPages.addMessage(new ApexPages.Message(ApexPages.Severity.FATAL,e.getMessage()));
}
PageReference assignmentpage = ApexPages.currentPage();
assignmentpage.setRedirect(true);
return null;
}

}

 

 

Thanks in advance

  • April 02, 2013
  • Like
  • 0

This table is not appearing when I render the vfpage. What do I need to change in my vf page?

 

<apex:page standardcontroller="PCN_s__c" extensions="pcntable" >
<apex:form >
 <apex:pageBlock >
 <apex:repeat value="{!pcnlist}" var="pcn" >   
   <table> 
        <tr> 
            <td> <apex:outputlabel value="Project Impact"/> </td>
            <td> <apex:outputlabel value="Current Project"/> </td>
            <td> <apex:outputlabel value="Revised Project"/> </td>
            <td> <apex:outputlabel value="Change"/> </td>
            <td> <apex:outputlabel value="Approved"/> </td>
       </tr>
       <tr> 
            <td> <apex:outputlabel value="PROD. LABOR HOURS & COST:"/> </td>
            <td> <apex:inputfield value="{!pcn.Current_PROD_LABOR_HOURS__c}"/> <apex:inputfield value="{!pcn.Current_PROD_LABOR_COST__c}"/> </td>
            <td> <apex:inputfield value="{!pcn.Revised_PROD_LABOR_HOURS__c}"/> <apex:inputfield value="{!pcn.Revised_PROD_LABOR_COST__c}"/> </td>
       </tr>
       <tr>
            <td> <apex:outputlabel value="ENG. LABOR HOURS & COST:"/> </td>
            <td> <apex:inputfield value="{!pcn.Current_ENG_LABOR_HOURS__c}"/> <apex:inputfield value="{!pcn.Current_ENG_LABOR_COST__c}"/> </td>
            <td> <apex:inputfield value="{!pcn.Revised_ENG_LABOR_HOURS__c}"/> <apex:inputfield value="{!pcn.Revised_ENG_LABOR_COST__c}"/> </td>
      </tr>
       <tr>
            <td> <apex:outputlabel value="MATERIAL COST:"/> </td>
            <td> <apex:inputfield value="{!pcn.Current_MATERIAL_COST__c}"/> </td>
            <td> <apex:inputfield value="{!pcn.Revised_MATERIAL_COST__c}"/> </td>
      </tr>
       <tr>
            <td> <apex:outputlabel value="PRINT RELEASE DATE:"/> </td>
            <td> <apex:inputfield value="{!pcn.Current_PRINT_RELEASE_DATE__c}"/> </td>
            <td> <apex:inputfield value="{!pcn.Revised_PRINT_RELEASE_DATE__c}"/> </td>
      </tr>
       <tr>
            <td> <apex:outputlabel value="SCHED. SHIP DATE:"/> </td>
            <td> <apex:inputfield value="{!pcn.Current_SCHED_SHIP_DATE__c}"/> </td>
            <td> <apex:inputfield value="{!pcn.Revised_SCHED_SHIP_DATE__c}"/> </td>
      </tr>
       <tr>
            <td> <apex:outputlabel value="ADDITIONAL COMPONENTS:"/> </td>
            <td> <apex:inputfield value="{!pcn.Current_ADDITIONAL_COMPONENTS__c}"/> </td>
            <td> <apex:inputfield value="{!pcn.Revised_ADDITIONAL_COMPONENTS__c}"/> </td>
      </tr>
       <tr>
            <td> <apex:outputlabel value="TOTAL COST:"/> </td>
            <td> <apex:inputfield value="{!pcn.Current_TOTAL_COST__c}"/> </td>
            <td> <apex:inputfield value="{!pcn.Revised_TOTAL_COST__c}"/> </td>
      </tr>
       <tr>
            <td> <apex:outputlabel value="SELLING PRICE:"/> </td>
            <td> <apex:inputfield value="{!pcn.Current_SELLING_PRICE__c}"/> </td>
            <td> <apex:inputfield value="{!pcn.RevisedSELLING_PRICE__c}"/> </td>
      </tr>
  </table>
</apex:repeat>
</apex:pageBlock>
</apex:form>
</apex:page>

<apex:inputField id="log" value="{!log.SME_Logo1__c}">
     <apex:actionSupport event="onselect" action="{!Accwrappermethod}" rerender="ParentChildDts"/>
</apex:inputField>

 

 

 

  • March 20, 2013
  • Like
  • 0

here is my Apex class

 

 

global class Lead_Conversion {

   WebService static String convertLead(Id leadId){
       system.debug('++++++++++LEAD ID***********'+leadId);
       Account  acc;
       String status;
       String errorIndication='';
       try{
           Lead lead1=[SELECT OwnerId,Account_Owner_SFDC_Id__c,Opportunity__c,Sfdc_Account_BackendId__c,Company,Email,Circle__c,City,Account__c,Product_Type__c,SME_TTL_Product__c,Product_Quantity__c,Proposed_Order_value_In_Rs_Lakh__c From Lead where Id=:leadId];
        
        
           /*Lead lead1=[Select Account__c,Account_Owner_SFDC_Id__c,Opportunity__c,Website,TotalNumberofDisconnections__c,TotalLeadsReassigned__c,TotalLeadsGenerated__c,TotalLeadsAssigned__c,Title,
                       SystemModstamp,Street,Status,State,Sfdc_Account_BackendId__c,Salutation,SME_TTL_Product__c,SME_SemiAdminIDMID__c,SLALeads__c,
                        SFDC_Lead_ID__c,Retail_Lead_Value__c,Remarks__c,RecordTypeId,Rating,Proposed_Order_value_In_Rs_Lakh__c,Product__c,Product_Type__c,
                        Product_Quantity__c,PostalCode,Phone,OwnerId,OpenCases__c,NumberOfEmployees,No_of_Del_Active__c,Name,Mode_of_Entry__c,MasterRecordId,
                        LeadsGenerated__c,LeadsActedOn__c,Lead_Type__c,Lead_Region__c,Lead_Priority__c,Lead_Closure_Reason__c,Lead_Classification__c,
                        Lead_Captured_By_IDM_ID__c,LeadSource,LeadRecType__c,LeadClosedDate__c,LastName,LastModifiedDate,LastModifiedById,LastActivityDate,
                        LPMS_Lead_ID__c,LPMS_ID_from_ePOS__c,LPMS_ID_Discrepancy__c,IsUnreadByOwner,IsDeleted,IsConverted,Industry,Id,Generated_Date_and_Time__c,
                        Follow_Up_date_time__c,FirstName,EmailBouncedReason,EmailBouncedDate,Email,Description,Del_No__c,Del_Activation_Status__c,Del_Activation_State__c,
                        DateLeadActedOn__c,CustomerName__c,CreatedDate,CreatedById,Country,ConvertedOpportunityId,ConvertedDate,ConvertedContactId,
                        ConvertedAccountId,Conversion_Field_Update__c,Company_segment__c,Company_Type__c,Company,City,Circle__c,Area_Name__c,AnnualRevenue,
                        Account_Trigger__c,Account_Number__c From Lead where Id=:leadId];*/
                        
          system.debug('=========lead1.OwnerId========'+lead1.OwnerId+'++++++++++Account Owner ID***********'+lead1.Account_Owner_SFDC_Id__c+'+++++++++++++++lead1.Opportunity__c++++++++++++++'+lead1.Opportunity__c+'++++lead1.Sfdc_Account_BackendId__c++++++++'+lead1.Sfdc_Account_BackendId__c); 
           map<Id,SME_Product__c> smettlproductmap=new Map<Id,SME_Product__c>([select ID,Name,List_Price__c,Product_Family__c,Product_Group__c from SME_Product__c]);
             system.debug('smettlproductmap=====>>>>'+smettlproductmap);
                 
           Schema.RecordTypeInfo TtlOppRecordtype= Schema.SObjectType.Opportunity.getRecordTypeInfosByName().get('SME New/Upgrade TTL Product Opportunity');
           Id TtlOpprecordtypeId=TtlOppRecordtype.getRecordTypeId();
            system.debug('=====TtlOpprecordtypeId========='+TtlOpprecordtypeId);
           Schema.RecordTypeInfo TclOppRecordtype= Schema.SObjectType.Opportunity.getRecordTypeInfosByName().get('SME New/Upgrade TCL Product Opportunity');
           Id TclOpprecordtypeId=TclOppRecordtype.getRecordTypeId();
               system.debug('============='+TclOpprecordtypeId);
               system.debug('==LeadConversion=====Sfdc_Account_BackendId__c=============='+lead1.Sfdc_Account_BackendId__c);
           boolean accExist=true;
           boolean accInserted=false;
           if(lead1.Sfdc_Account_BackendId__c==null){
           try{
            Schema.RecordTypeInfo SmeAccountrecordtype= Schema.SObjectType.Account.getRecordTypeInfosByName().get('SME Account');
            Id AccountRecTypeId=SmeAccountrecordtype.getRecordTypeId();          
            system.debug('========AccountRecTypeId========='+AccountRecTypeId);

                User usrs=[select Name,IDM_Id__c,IDM_ID_of_USer__c from User where Id=:lead1.OwnerId];
                Integer AccchkExists=[select count() from Account where Name=:lead1.Company];
                
                if(AccchkExists>0){                
                    system.debug('Account already exists with the name: '+lead1.Company+' so new account cannot be created with same name');
                }else{
                    acc = new Account();               
                        acc.Name = lead1.Company;
                        acc.Type_Of_Corporate__c = 'SME A';
                        acc.OwnerId =lead1.OwnerId;
                        acc.OwnerEmail__c =lead1.Email;
                        acc.RecordtypeId = AccountRecTypeId;
                        acc.Vertical_Segment__c='SME';
                        acc.TTL_Status__c='Non-Verified';
                        acc.TCL_Status__c='Non-Verified';
                        acc.Share_to_SalesCoordinator__c='YES';
                        acc.Circle__c=lead1.Circle__c;
                        acc.City__c=lead1.City;
                        acc.OwnerIDMId__c=usrs.IDM_Id__c;
                    Insert acc; 
                    accInserted=true;
                }               
            }catch(Exception e){
                status='Failure';
                accExist=false;              
                errorIndication=' Failed while creating account ';
                system.debug(e);            
            }
           }           
           boolean currentLeadUpdated=true;              
           if(accInserted){
             try{
                system.debug('====accName===='+acc.Name+'=====accID====='+acc.Id);
                lead1.Sfdc_Account_BackendId__c=acc.Id;
                lead1.Account__c=acc.Id;
                update lead1;
                currentLeadUpdated=true;
            }catch(Exception e){
                currentLeadUpdated=false;
                system.debug('Exception while updatating lead');
                system.debug(e);
            } 
           }
           if(currentLeadUpdated){
               system.debug('======into loop currentLeadUpdated--==========');
                lead1=null;
                lead1=[SELECT OwnerId,Account_Owner_SFDC_Id__c,Opportunity__c,Sfdc_Account_BackendId__c,Company,Email,Circle__c,City,Account__c,Product_Type__c,SME_TTL_Product__c,Product_Quantity__c,Proposed_Order_value_In_Rs_Lakh__c From Lead where Id=:leadId];

              (here the base on the id query is fetched but while executing the query its raising this error plz help me out)
               /* lead1=[Select Account__c,Account_Owner_SFDC_Id__c,Opportunity__c,Website,TotalNumberofDisconnections__c,TotalLeadsReassigned__c,TotalLeadsGenerated__c,TotalLeadsAssigned__c,Title,
                        SystemModstamp,Street,Status,State,Sfdc_Account_BackendId__c,Salutation,SME_TTL_Product__c,SME_SemiAdminIDMID__c,SLALeads__c,
                        SFDC_Lead_ID__c,Retail_Lead_Value__c,Remarks__c,RecordTypeId,Rating,Proposed_Order_value_In_Rs_Lakh__c,Product__c,Product_Type__c,
                        Product_Quantity__c,PostalCode,Phone,OwnerId,OpenCases__c,NumberOfEmployees,No_of_Del_Active__c,Name,Mode_of_Entry__c,MasterRecordId,
                        LeadsGenerated__c,LeadsActedOn__c,Lead_Type__c,Lead_Region__c,Lead_Priority__c,Lead_Closure_Reason__c,Lead_Classification__c,
                        Lead_Captured_By_IDM_ID__c,LeadSource,LeadRecType__c,LeadClosedDate__c,LastName,LastModifiedDate,LastModifiedById,LastActivityDate,
                        LPMS_Lead_ID__c,LPMS_ID_from_ePOS__c,LPMS_ID_Discrepancy__c,IsUnreadByOwner,IsDeleted,IsConverted,Industry,Id,Generated_Date_and_Time__c,
                        Follow_Up_date_time__c,FirstName,EmailBouncedReason,EmailBouncedDate,Email,Description,Del_No__c,Del_Activation_Status__c,Del_Activation_State__c,
                        DateLeadActedOn__c,CustomerName__c,CreatedDate,CreatedById,Country,ConvertedOpportunityId,ConvertedDate,ConvertedContactId,
                        ConvertedAccountId,Conversion_Field_Update__c,Company_segment__c,Company_Type__c,Company,City,Circle__c,Area_Name__c,AnnualRevenue,
                        Account_Trigger__c,Account_Number__c From Lead where Id=:leadId]; */
           }
           system.debug('==lead again querying========lead1.Account_Owner_SFDC_Id__c;==========='+lead1.Account_Owner_SFDC_Id__c);
           system.debug('====lead1.Opportunity__c===='+lead1.Opportunity__c+'====accExist==='+accExist);
           If(lead1.Opportunity__c==null && accExist){
            system.debug('=========If==lead1.Opportunity__c==null  accExist=================');
            boolean toinsertOpp=true;
               Opportunity opp1=new Opportunity();
               Products_Services__c tclpro = new Products_Services__c();
               opp1.Name='ConvertedLead';
                //opp1.AccountId=lead1.Account__c;
               if(lead1.Sfdc_Account_BackendId__c==null && accExist){
                  system.debug('====AccountExistd===lead1.Account__c=========='+lead1.Account__c);
                  opp1.AccountId=lead1.Account__c;                
               }else if(lead1.Sfdc_Account_BackendId__c==null && !accExist){
                  system.debug('==AccountNotExists===acc.Id====='+acc.Id);
                  opp1.AccountId=acc.Id;
               }else{
                  system.debug('==Account===lead1.Account__c====='+lead1.Account__c);
                  opp1.AccountId=lead1.Account__c;
               }
               //opp1.OwnerId=lead1.Account_Owner_SFDC_Id__c;
               //opp1.OwnerId=acc.OwnerId;
               opp1.OwnerId=lead1.OwnerId;
               opp1.Type='New';
               Date dt1=Date.today();
               opp1.CloseDate=dt1;
               opp1.Opportunity_source__c='LEAD CONVERT';
               opp1.StageName='Identified Opportunity';
               system.debug('====lead1.Product_Type__c======'+lead1.Product_Type__c);
               if(lead1.Product_Type__c=='TTL'){
                system.debug('================lead1.Product_Type__c==TTL==============');
                   opp1.RecordTypeId=TtlOpprecordtypeId;
                   system.debug('============smettlproductmap.get(lead1.SME_TTL_Product__c).List_Price__c======================');
                   Integer smetlmapVal=null;
                   try{
                    smetlmapVal=Integer.valueOf(smettlproductmap.get(lead1.SME_TTL_Product__c).List_Price__c);
                   }catch(Exception e){
                    status='Failure';
                    errorIndication='Unable to find the product id for this lead';
                    system.debug(e);
                   }
                   system.debug('================smetlmapVal================='+smetlmapVal);                   
                   if(smetlmapVal!=null){
                         if(smetlmapVal > 0){
                           opp1.SME_Product__c=lead1.SME_TTL_Product__c;
                           opp1.TotalOpportunityQuantity=lead1.Product_Quantity__c;
                          }else if(smetlmapVal==null ||smetlmapVal==0){
                           opp1.SME_Product__c=lead1.SME_TTL_Product__c;
                           opp1.TotalOpportunityQuantity=lead1.Product_Quantity__c;
                           opp1.Annual_Recurring_Charges__c=lead1.Proposed_Order_value_In_Rs_Lakh__c;
                           opp1.Manage_Service_Rentals__c=0;
                           opp1.One_Time_Charges__c=0;
                        }
                   } 
                }else if(lead1.Product_Type__c=='TCL'){
                   system.debug('================lead1.Product_Type__c==TL==============');
                   opp1.RecordTypeId=TclOpprecordtypeId;
                   opp1.ForecastCategoryName='Pipeline';
                   opp1.Is_Standard_NonStandard__c='Standard';
               }else{
                 system.debug('================lead1.Product_Type__c==false==============');
                 toinsertOpp=false;
                 status='Failure';
                 errorIndication='Product selected is not correct';
                 system.debug('0000000   status======'+status+' errorIndication========'+errorIndication);                 
               }
               system.debug('111111  status======'+status+' errorIndication========'+errorIndication);
               system.debug('================toinsertOpp=============='+toinsertOpp);
                   if(toinsertOpp){
                       try{                    
                           insert opp1;
                           status='Success'; 
                           errorIndication='success';
                           lead1.Opportunity__c=opp1.Id;
                           update lead1;                       
                       }catch(Exception e){
                            status='Failure';
                            if(errorIndication.length()==0)errorIndication='Opportunity not created due to data mismatch';
                            system.debug('2222222   status======'+status+' errorIndication========'+errorIndication);
                            system.debug('Exception while trying to insertion/updataion of the oppurtunity');
                            system.debug(e);                
                       } 
                   }else{
                      status='Failure';
                      errorIndication='opportunity exists for this lead';
                      system.debug('333333   status======'+status+' errorIndication========'+errorIndication);
                   }
           }
       }catch(Exception e){
            status='Failure';
            errorIndication=' ServerError';
            system.debug('Exception=========Occured=====');
            system.debug('=======ExcepDetails=============='+e.getMessage());
        }
        status=status+'**'+errorIndication;
        system.debug('===status===================='+status);
        system.debug('==errorIndication============='+errorIndication);
        return status;
    }
    
    
}

 

 

 

My Test Class is

===============

 

@isTest (SeeAllData = true)  
global class LeadConversionTestCase{ 
          Static testmethod void testManage_bulklead() {
          
        //Get Show Manager profile Id.
        Profile p1 = [SELECT Id FROM Profile WHERE Name ='SME Semi_Admin'];
        system.debug('============Profile======p1=========='+p1);
        Profile p2 = [SELECT Id FROM Profile WHERE Name ='SME_Supervisor'];
        system.debug('============Profile======p2=========='+p2);
        User semiAdmin = new User(Alias = 'uc1233', Email='uc123@sfdc.com', EmailEncodingKey='UTF-8', LastName='Testing User2', 
                                    LanguageLocaleKey='en_US', LocaleSidKey='en_US', ProfileId = p1.Id, 
                                    TimeZoneSidKey='America/Los_Angeles', UserName='nU123@test.com');
           insert semiAdmin;
           User brm1 = new User(Alias = 'uc1233', Email='uc1234@sfdc.com', EmailEncodingKey='UTF-8',FirstName ='TTL', LastName='TestingUser', 
                                    LanguageLocaleKey='en_US', LocaleSidKey='en_US', ProfileId = p2.Id,
                                    TimeZoneSidKey='America/Los_Angeles', UserName='nU1234@test.com',SME_User_Region__c='AP',SME_RoleName__c='SALESHEAD');  
            insert brm1;
            Schema.RecordTypeInfo SmeLeadrecordtype= Schema.SObjectType.Lead.getRecordTypeInfosByName().get('Company Lead');
            system.debug('==========SmeLeadrecordtype================================='+SmeLeadrecordtype);
            
            Id SmeLeadrecordtypeId=SmeLeadrecordtype.getRecordTypeId();
          try{
             Test.StartTest();
          
            //Run test as user whose profile is show Manager                        
            System.runas(semiAdmin) {
            
              
            RecordType rc = [SELECT Id FROM RecordType WHERE Name='SME TTL Products'];
            system.debug('==================rc============='+rc);
            
            SME_Product__c prdSME= new SME_Product__c();
                prdSME.Name='TESTPRO';
                prdSME.Product_Group__c='CDMA Mobile';
                prdSME.RecordTypeID=rc.id;
                prdSME.Product_Manager__c=semiAdmin.id;//SME Product
                prdSME.Product_Family__c='Fixed Voice';
                prdSME.List_Price__c=500;
                prdSME.Active__c=TRUE;
            insert prdSME;     
                prdSME.Lock__c='NO';
            update prdSME;
            system.debug('=============jjjjj====semiAdmin.Id=============='+semiAdmin.Id);
            Lead testleadobj=new Lead(LastName='jakc',Company='jakc',Status='Qualified',Company_segment__c='SME A',Lead_Type__c='Company',Lead_Region__c='AP',Product_Type__c='TTL',Product__c=prdSME.Id,SME_TTL_Product__c=prdSME.Id,OwnerId=semiAdmin.Id,RecordTypeId=SmeLeadrecordtype.getRecordTypeId());
            insert testleadobj;
            system.debug('=============jjjj====testleadobj.OwnerId============='+testleadobj.OwnerId+'====testleadobj.Id=='+testleadobj.Id);
           // testleadobj.Status='Closed-Sold';
            //update testleadobj;
           // system.debug('===============testleadobj============'+testleadobj);
           // Lead fetId=[select Name,Id from Lead where Id=:testleadobj.Id];
           // system.debug('=========fetId========'+fetId.Id);
            Lead_Conversion.convertLead(testleadobj.Id);    (here the id is passed to the apex class)

 

 

 

 

 

 

 

 

 

 

  • January 08, 2013
  • Like
  • 0

developed an visual force page and renderas PDF in which dispaying the Related list NotesandAttcahments

 

 

when i save that PDF iam unable to read the notesandattachments related list data on click on the view its asking for sales force login

 

 

 

here is my code can u plz help me out

 

<apex:page standardController="Account" renderAs="PDF">
<apex:pageBlock >
You're looking at some related lists for {!account.name}:
</apex:pageBlock>
<apex:relatedList list="NotesandAttachments"/>

<apex:relatedList list="Opportunities" />
<apex:relatedList list="Contacts">
<apex:facet name="header">Titles can be overriden with facets</apex:facet>
</apex:relatedList>
<apex:relatedList list="Cases" title="Or you can keep the image, but change the text"/>
</apex:page>

 

 

  • April 16, 2012
  • Like
  • 0

Hi,

 

I displayed all records of an object in visualforce page.

 

 

I kept commandlink for a column in VF page.

I wrote a action support on mouseover that means a panel will get displayed with the details of a record, when i place mouse on particular record.

 

I have tried but i was unable to get it.

 

Can any one help me out?

Thanks & Regards,

 

Raju.b