• sfg1
  • NEWBIE
  • 90 Points
  • Member since 2015

  • Chatter
    Feed
  • 0
    Best Answers
  • 1
    Likes Received
  • 0
    Likes Given
  • 52
    Questions
  • 39
    Replies
I have two picklist fields, Pick_Field1__c and Pick_Field2__c. I have created Field dependency, Pick_Field1__c as Controlling and Pick_Field2__c as dependent fields. But i need to make Pick_Field1__c (Controlling field) as Readonly field. How to achieve this in visualforce page.
  • December 27, 2018
  • Like
  • 0
I have Picklist field "Chart_Flex_Field_1_Datatype__c" with values 'Test1', 'Test2', 'Test3' and 'Test4'. When I select 'Test3', dynamically Multi-select Picklist field (Chart_Flex_Picklist_1__c) should display under "Chart_Flex_Field_1_Datatype__c" field. Please find my code.

<apex:outputField value="{!Project2__c.Chart_Flex_Field_1_Datatype__c}"> 
                        <apex:actionSupport event="onchange" rerender="t1" />
                    </apex:outputField>                    
 <apex:outputField value="{!Project2__c.Chart_Flex_Picklist_1__c}" rendered="{!IF(Project2__c.Chart_Flex_Field_1_Datatype__c == 'Test3', true, false )}" >
 <apex:actionSupport event="onchange" rerender="t1" />
 </apex:outputField>
  • November 08, 2018
  • Like
  • 0
I have 2 input fields in my visualforce page Logic__c(Data Type-Picklist) with values Text1 and Date2. and one more field Type__c(Text Data Type).
When I select Text1 in Logic__c dropdown  TEXT box should display for Type__c field. When I select  Date2 in Logic__c dropdown Date Picker should display for Type__c field. 
I am trying for onchange event using javascript. Please guide me in this. 
  • July 10, 2018
  • Like
  • 0
I have 2 Picklist (Multi-Select) fields Country__c and State__c. In Country__c field I have many country values and in State__c field I have many State names.Based on  Country__c field values I need to display respective states in State__c field dynamically. .If I select 5 countries in Country__c field it should display all states of respective countries in State__c field.
Example:
            AP                                Texas
INDIA   TN                           US Kansas
            KN                                 Florida


If I select INDIA and US in Country__c field it should display all 6 states in State__c. Please guide me in this. Thanks.
  • May 17, 2018
  • Like
  • 0
I have a Custom object Object__c with field  Paper_ID__c(Text datatype). I want to create another field  Paper2__c it should allow me to save the record only with any one of the Paper_ID__c field value. 

                 Paper_ID__c(Field name) 
Record1    123455
Record2    123456
Record3    123457
Record4    123458
Record5    123459

Paper2__c field should allow me to save only with 123455 OR 123456 OR 123457 OR 123458 OR 123459. 
If not it sholud through error. Please guide me in this.
  • May 06, 2018
  • Like
  • 0
I want to disable or hide commandbutton for users belong to two public groups "MMC: L1" and "MMC: L2". Please guide me.

VF page:
 <apex:pageBlockButtons >
   <apex:commandButton value="Save & Unlock"   action="{!saveAndUnlock}" styleClass="saveButton"/>
    </apex:pageBlockButtons>

Controller:
public PageReference saveAndUnlock() {
        
        if(!isNotAllwToSave())
            return null;

        if(!isOkToSave())
            return null;

        // update medical chart record...
        this.codingChart.Record_Lock__c = false;
        codingChart.Record_Lock_User__c = null;

        try {
            this.codingChart.Record_Lock__c = false;
            this.codingChart.Record_Lock_User__c = null;
            this.codingChart.Status__c = selectedStatusOption;
            this.codingChart.Saved_Record_Status_Check__c = false; 
            update this.codingChart;
            saveDxCodes();

        } catch(Exception ex) {
            Apexpages.addMessages(ex);
            return null;
        }
        deleteWorkingCodes();
       return new PageReference('/apex/MC_ChartsTab'); //Redirect to charts queue
    }
  • February 15, 2018
  • Like
  • 0
Onclicking button i want to redirect to custom tab from my visualforce page. My custom tab URL "https://cs68.salesforce.com/a23/o". Please guide me.
  • January 24, 2018
  • Like
  • 0
I have REST API class, i am trying to cover 100% code coverage. Currently i have 71 % code coverage. Code in bold are not covered. Can you please guide me.

Apex class:
@RestResource(urlMapping='/mrtValidateNonFSLUser/*')

// This rest service is used by Web-application in order to
// MRT user who are non-FSL.
// Retrieves username and password as post validates against "MRT__c" Table  
// Sample Data
// {
//   "sUsername": "me@4richie.com",
//   "sPassword": "Epirc1961"
//}
global class mrtValidateNonFSLUser {
    //Input Class
    public class mrtCredintials{
        public String sUsername;
        public String sPassword;
    }    
    
    @HttpPost
    global static Boolean mrtValidateNonFSLUser () {
        //Variables declaration.        
        List<MRT__c> lstCKSWUser;
        mrtCredintials objCred;        
        RestRequest objReq = RestContext.request;
        RestResponse objRes = RestContext.response;   
        objRes.addHeader('Content-Type','applicatin/json');
        
        try{            
            objCred  = (mrtCredintials) JSON.deserialize(objReq.requestBody.toString(), mrtCredintials.class);
        }
        Catch(Exception objExp){
           return false; //Logging and possible alert to tech team along with exception message.???
        }
         if(objCred != NULL){
            lstCKSWUser = [SELECT Email__c From MRT__c WHERE Email__c =: objCred.sUsername AND Password__c =: objCred.sPassword AND Active__c = true];
            return lstCKSWUser.size() > 0 ? true : false;
            }
        return false;
    }       
}


TEST class:
@IsTest
public class Test_mrtValidateNonFSLUser {
     static testMethod void Method1() {
      MRT__c mrt1 = new MRT__c(
      Name = 'MRT One',
      City__c = 'city', 
      State__c = 'cp', 
      Zipcode__c = '123456',
      MRTLocation__Latitude__s = 33.9153,
      MRTLocation__Longitude__s =-118.351309,
               Email__c = 'test@epi.com',
               password__c = 'test1234'
      );
    insert mrt1; 
        RestRequest req = new RestRequest(); 
        RestResponse res = new RestResponse();
        
        req.requestURI = '/services/apexrest/mrtValidateNonFSLUser';  
        req.httpMethod = 'POST';
        RestContext.request = req;
        RestContext.response = res;
       test.startTest();
         mrtValidateNonFSLUser.mrtValidateNonFSLUser();
          test.stopTest();
     }
      }
    


 
  • January 07, 2018
  • Like
  • 0
ProductTable (Custom object)

Prod no        - 1000
Prod name    - 1001
startdate    - 01/02/2018
end date        - 25/06/2018
TotalAmount     - 50000

Forecast table (Custom Object)

Forcastno     prodno      Date            Amount

2001        1000        01/02/2018    10000
2002        1000        01/03/2018    10000
2003        1000        01/04/2018    10000
2004        1000        01/05/2018      10000
2005        1000        01/06/2018      10000

Visualforce view (Rows and Columns View in pageblock table & also need inline edit and save option) 

Prodno Prodname Jan18 Feb18 Mar18 Apr18 May18 Jun18 Jul18 Aug18 sep18 Oct18 Nov18 Dec18
  • December 12, 2017
  • Like
  • 0
Hi All,

I need to freeze row and column in page block table. (Not in  jquery data table).

Thanks
Azar
  • December 08, 2017
  • Like
  • 0
I have a requeirement to delete the Inactive projects data from salesforce and take a backup. Whenever client request for the deleted data we need to restore in Salesforce. Is this possible in salesforce. Can any one suggest me the best approach.
  • November 29, 2017
  • Like
  • 0
 decimal Lowval = math.round(42.5);
 system.debug('Lowval '+Lowval ); 

 O/p - Lowval 42
     
 But correct result is 43.. what is the issue? Please help me
  • October 16, 2017
  • Like
  • 0
I am trying to display only selected fields based on selected object dynamically, Now i am able to display all fields but i need to display only seleted fields. Can anyone please guide me in this. Please find my below code.
Visualforce page:

<apex:page controller="Sample" >
<apex:form >
    <apex:pageBlock >
        <apex:pageBlockSection >
            <apex:pageBlockSectionItem >
                <apex:outputLabel value="Objects"/>
            </apex:pageBlockSectionItem>        
            <apex:pageBlockSectionItem >
                <apex:selectList size="1" value="{!obj}" >
                    <apex:selectOptions value="{!objs}"/>
                </apex:selectList>
            </apex:pageBlockSectionItem>                      
        </apex:pageBlockSection>
        <apex:pageblockButtons >
            <apex:commandButton value="Fetch Fields" action="{!fetchFields}" reRender="flds"/>
        </apex:pageblockButtons>
    </apex:pageBlock>
    <apex:pageblock id="flds" title="Fields">
        <apex:pageblockTable value="{!objFields}" var="f">
            <apex:column value="{!f}" />
        </apex:pageblockTable>
    </apex:pageblock>    
</apex:form>    
</apex:page> 

Apex controller:

public class Sample 

    public String obj;
    public List<String> objFields {get;set;}
    
    public Sample() 
    {    
    }
    public String getobj()
    {
        return obj;
    }
     public void setobj(String obj)
    {
        this.obj = obj;
    }   
    
    public List<SelectOption> getobjs()
    {
        List<Schema.SObjectType> gd = Schema.getGlobalDescribe().Values();    
        List<SelectOption> options = new List<SelectOption>();
               
        for(Schema.SObjectType f : gd)
        {
            options.add(new SelectOption(f.getDescribe().getName(),f.getDescribe().getName()));
        }
        return options;
    }
  
    public void fetchFields()
    { 
        List<String> fields = new List<String>();
        Map<String , Schema.SObjectType> globalDescription = Schema.getGlobalDescribe();
        System.debug('Selected Object is ' + obj);
        Schema.sObjectType objType = globalDescription.get(obj); 
        System.debug('Object Type is ' + objType);
        Schema.DescribeSObjectResult r1 = objType.getDescribe(); 
        
        Map<String , Schema.SObjectField> mapFieldList = r1.fields.getMap();  

        for(Schema.SObjectField field : mapFieldList.values())  
        {  
            Schema.DescribeFieldResult fieldResult = field.getDescribe();  
            
            if(fieldResult.isAccessible())  
            {  
                System.debug('Field Name is ' + fieldResult.getName());
                fields.add(fieldResult.getName());
            }  
        }
        List<String> so = new List<String>();
        for(String f : fields)
        {
            so.add(f);
        } 
        objFields = so;       
    }   
}
 
  • October 04, 2017
  • Like
  • 0
I want to align fields in visuaforce page left and right .If i use below code it is moving completly to right


<apex:panelGrid columns="2">
<apex:outputlabel value="Available charts" id="first" style="float:right;"/>
<apex:outputlabel value="Samples" id="sec" style="text-align:right"/>
</apex:panelGrid>
I want to design visuaflorce page based below attachment.Please guide me.Attachement
 
  • August 20, 2017
  • Like
  • 0
I have muliple records in dxCodes. I am trying to display output format,  based on dxCodes.I have a custom field  "DOS__c" i need to display latest date in "DOS__c". And  for "DOS_End__c" i need to display old date. Somoe one please guide me in this. thanks.
 
        // Get charts and dxcodes to work on        
        List<MC_Chart__c> charts = (List<MC_Chart__c>) scope;         Map<Id, List<mc_Chart_DxCode__c>> chartIdToDxCodeMap = buildChartIdToDxcodeMap(charts);         // Get project details         Project2__c theProject = [SELECT Name FROM Project2__c WHERE Name = :projectKey Limit 1];         // Get mcMember details details         Set<Id> members = new Set<Id>();        
       for(MC_Chart__c c : charts) {          
          members.add(c.Member__c);         }    
      Map<ID, mc_Member__c> theMembers = new Map<ID, mc_Member__c([SELECT Id, Name, Recapture_V12__c FROM mc_Member__c 
  WHERE Id IN :members]);       
  // Build Output
  // For each chart   
      for(MC_Chart__c c : charts) {           
  // Get the list of DxCodes for this Chart from our map         
    List<mc_Chart_DxCode__c> dxCodes = new List<mc_Chart_DxCode__c>();        
     if(chartIdToDxCodeMap.containsKey(c.Id)) { // It's possible for a chart to have no DxCodes                 dxCodes = chartIdToDxCodeMap.get(c.Id);                 // the Dx Codes need to be grouped on DOS_Start / DOS_End for this format                 Map<String, List<MC_Chart_DxCode__c>> dxGroupMap = new Map<String, List<MC_Chart_DxCode__c>>();
 for(mc_Chart_DxCode__c dx : dxCodes) {

                    String providerFirstName = '';
                    String providerLastName = '';
                   
                     String dob = '';
                     String dos = '';
                 
                     if (dx.DOS__c != null){
                       dos = GetFormat(dx.DOS__c, 'MM/dd/yyyy');
                       }
                    String dosTo = '';
                    if (dx.DOS_End__c != null) {
                        dosTo = GetFormat(dx.DOS_End__c, 'MM/dd/yyyy');
                    }    
  • July 20, 2017
  • Like
  • 0
I have many batch jobs in my organization, i need to remove the unused batch jobs in my organization. I am checking Schedule Apex and Scheduled jobs. But it is taking more time. Is their any way to query Batch jobs which are not scheduled. PLease guide me. 
  • July 11, 2017
  • Like
  • 0
I am getting error "Error MessageSystem.QueryException: List has no rows for assignment to SObject" in Test class.
Please guide me in this.

@ISTest
public class Email_TEST {
  public static testmethod void testmethod1() {
         Location2__c lc= new Location2__c();
         lc.Workout_Status__c= 'Past Due 1 Backlog';
         lc.Workout_Status_Updated__c= 'test';
         insert LC;
        Task t = new Task();
        t.Subject = 'Fax Packet Successful';
        t.Description = 'testdata';
        t.Status = 'Completed';
        t.Priority = 'Low';
        t.WhatId = lc.Id;
        lc.Fax_Failed__c = False;
        lc.Fax_Verified__c = True;
        insert t;
        Messaging.InboundEmail email = new Messaging.InboundEmail() ;
        Messaging.InboundEnvelope env = new Messaging.InboundEnvelope();

        email.subject = 'Test' ;
        email.fromname = 'Test Test';
        env.fromAddress = 'Test@email.com';
        email.plainTextBody = 'Test';
        
        EpiEmailBlast emailProcess = new EpiEmailBlast();
        emailProcess.handleInboundEmail(email,env);
        System.debug('Email is: ' + Email);
        System.debug('Env is: ' + Env);
}
}

        
     
  • July 01, 2017
  • Like
  • 0
how to find field value whether it is numeric or Alphnumeric in apex.
I have requirements like if FIELD1 = 123, FIELD2=456, display FIELD1 value in OUTPUTFIELD=123, if FIELD1=A123 or 123A, FIELD2=456 then display FIELD2 value in OUTPUTFIELD=456. 
Please guide me.
  • June 13, 2017
  • Like
  • 0
I have long text area Text field 'comments__c', after entering data in comments__c text box and click on save, comment field should be read only I tried below code, but it is not working as expected. I need to display that page in SITE.please guide me.

Controller:
public class CampaignRecordIdController{
    public String campaignRecordId {get;set;}
    public String parameterValue {get;set;}
    public Campaign cam{get;set;}
    public boolean rend{get;set;}
    public boolean rend1{get;set;}
    public Campaign Campaign{get;set;}
    
    public CampaignRecordIdController() 
    {
       campaignRecordId =ApexPages.currentPage().getParameters().get('id');
       system.debug('=====campaignRecordId ===='+campaignRecordId);
       cam = [select name,Promotion_Details__c,parentid,Comments__C from Campaign member where id =: campaignRecordId ];
       rend=true;
       rend1=false;
      
        }
         public PageReference save() {
        update cam;
        rend=false;
        rend1=true;
        return null;
    }
}

Page:
<apex:page Controller="CampaignRecordIdController"  sidebar="false" showheader="false">
   <apex:form >
   <apex:pageBlock>
    
   <apex:pageBlockSection title="Current Campaign record Id is : {!campaignRecordId}" collapsible="false" columns="1" rendered="{!rend}">
   <apex:outputField value="{!cam.name}"/>
   <apex:outputField value="{!cam.Promotion_Details__c}"/>  
   <apex:outputField value="{!cam.Parentid}"/>  
   <apex:inputtext value="{!cam.Comments__c}" style="width: 360px; height: 40px"/>  
   </apex:pageBlockSection> 
   
    <apex:pageBlockSection title="Current Campaign record Id is : {!campaignRecordId}" collapsible="false" columns="1" rendered="{!rend1}">
   <apex:outputField value="{!cam.name}"/>
   <apex:outputField value="{!cam.Promotion_Details__c}"/>  
   <apex:outputField value="{!cam.Parentid}"/>  
   <apex:outputfield value="{!cam.Comments__c}" style="width: 360px; height: 40px"/>  
   </apex:pageBlockSection> 
   
     <apex:pageBlockButtons >
      <apex:commandButton action="{!save}" value="save"/>
     </apex:pageBlockButtons>
    </apex:pageBlock>
   </apex:form>
   </apex:page>

 
  • March 16, 2017
  • Like
  • 0
I tried to display campaign id in site using visulforce page, but i am not able to display.My code is not working fine. Can i use standard controller? if not please let me know. Whether i need to try different code for SITES. please guide me.

class:
public class CampaignRecordIdController{
public String campaignRecordId {get;set;}
public String parameterValue {get;set;}
public Campaign cam{get;set;}
  public CampaignRecordIdController(ApexPages.StandardController controller) {
        campaignRecordId  = ApexPages.CurrentPage().getparameters().get('id');
        cam = [select name,Promotion_Details__c from Campaign where id =: campaignRecordId ];
        parameterValue = ApexPages.CurrentPage().getparameters().get('nameParam');      
}
}
Page:
public class CampaignRecordIdController{
public String campaignRecordId {get;set;}
public String parameterValue {get;set;}
public Campaign cam{get;set;}
   public CampaignRecordIdController(ApexPages.StandardController controller) {
       campaignRecordId  = ApexPages.CurrentPage().getparameters().get('id');
       cam = [select name,Promotion_Details__c from Campaign where id =: campaignRecordId ];
       parameterValue = ApexPages.CurrentPage().getparameters().get('nameParam');
         }
}
  • March 14, 2017
  • Like
  • 0
Need help in code coverage for constructor with parameters(controller).
PScRMAExtension is EXTENSION
PScRMAExtension_v1  is CONTROLLER

/*
    *Class constructor
    */
    public PScRMAExtension(PScRMAExtension_v1 objext)
    {
        system.debug('$$$ <PScRMAExtension::PScRMAExtension>');
        parent_case_id = ApexPages.currentPage().getParameters().get('id');
        //parent_case_id = '50011000008KcEV';
        //currentInstance = this;
        //case_list = (Case)controller.getRecord();
        RMALineItemCnt = 0;
        show_RMA_list = FALSE;
        showAdvanceExchange = FALSE;
        show_flash_alert = FALSE;
        show_expired_contract_alert = FALSE;
        accept_expired_contact = FALSE;
        show_case_detail = FALSE;
        show_fru_detail = FALSE;
        asset_exists = FALSE;
        show_cli_grid = FALSE;
        show_asset_grid = TRUE;
        disable_save_btn = FALSE;
        show_add_line_item = FALSE;
        show_expired_Asset_alert =FALSE;
        isRMASLASameDay = false;
        isshowassetExipre=FALSE;
        isshowRMAexits =FALSE;
       
        //show_replacement_part_confirmation = FALSE;
        //accept_replacement_part = FALSE;

        RMA_line_item_wrapper_list = new List<PScRMALineItemsWrapper>();
        new_line_item_obj = new RMA_Line_Items__c();
        RMA_line_item_list = new List<RMA_Line_Items__c>();
        view_line_item_obj = new RMA_Line_Items__c();
        line_save_text = 'Add Line Item';
        obj_line_item_tosave = new List<RMA_Line_Items__c>();

        rmaAssignedRtName = '';
        primaryOwnerFld = '';
        secondaryOwnerFld = '';
        default_country = 'United States';

        //replacement_part_error_msg = '';
        system.debug('show_add_line_item1' + show_add_line_item);

        //stateList = new List<selectOption>();
        //stateList.add(new selectOption('', '--None--'));

        //system.debug('$$$ parent_case_id: ' + parent_case_id);
        if(parent_case_list == null)
        {
            parent_case_list = [ SELECT Account.Name, Account.Company_Name__c, Account.ShippingStreet, Account.ShippingCity, Account.ShippingState, Account.ShippingCountry, Account.ShippingPostalCode, Account.Phone, Account.Email__c, Contact.Name, Contact.MailingStreet, Contact.MailingCity, Contact.MailingState, Contact.MailingCountry, Contact.MailingPostalCode, Contact.Phone, Contact.Email, AccountId, ContactId, AssetId, CaseNumber, Subject, Description, Status, Priority, Severity__c, Serial_No__c, Platform__c, Product_Series__c, Ship_To_Account__c FROM Case WHERE Id = :parent_case_id ];
            account_id = parent_case_list.AccountId;
            asset_serial_no = parent_case_list.Serial_No__c;

            if(parent_case_list.Account.Company_Name__c != null)
            {
                account_name = parent_case_list.Account.Company_Name__c;
            }
            else
            {
                account_name = parent_case_list.Account.Name;
            }

            populateIB();
        }
        system.debug('$$$ parent_case_list: ' + parent_case_list);

        List<CreateCaseRT__c> ccRtList = CreateCaseRT__c.getAll().values();
        if(ccRtList.size() > 0)
        {
            for(CreateCaseRT__c t : ccRtList)
            {
                if(t.Case_Trans_Type__c == system.label.RMA_Transaction_Type)
                {
                    rmaAssignedRtName = t.Name;
                }
            }
        }

        getFlashAlerts();
        RMALineItemDetails();
        getReplacementPart();
        getRMALineItemCnt();
        
        system.debug('in PScRMAExtension show_cli_grid ' + show_cli_grid);
        system.debug('in PScRMAExtension show_asset_grid ' + show_asset_grid);
    }
  • March 11, 2016
  • Like
  • 1
I have Picklist field "Chart_Flex_Field_1_Datatype__c" with values 'Test1', 'Test2', 'Test3' and 'Test4'. When I select 'Test3', dynamically Multi-select Picklist field (Chart_Flex_Picklist_1__c) should display under "Chart_Flex_Field_1_Datatype__c" field. Please find my code.

<apex:outputField value="{!Project2__c.Chart_Flex_Field_1_Datatype__c}"> 
                        <apex:actionSupport event="onchange" rerender="t1" />
                    </apex:outputField>                    
 <apex:outputField value="{!Project2__c.Chart_Flex_Picklist_1__c}" rendered="{!IF(Project2__c.Chart_Flex_Field_1_Datatype__c == 'Test3', true, false )}" >
 <apex:actionSupport event="onchange" rerender="t1" />
 </apex:outputField>
  • November 08, 2018
  • Like
  • 0
I have a Custom object Object__c with field  Paper_ID__c(Text datatype). I want to create another field  Paper2__c it should allow me to save the record only with any one of the Paper_ID__c field value. 

                 Paper_ID__c(Field name) 
Record1    123455
Record2    123456
Record3    123457
Record4    123458
Record5    123459

Paper2__c field should allow me to save only with 123455 OR 123456 OR 123457 OR 123458 OR 123459. 
If not it sholud through error. Please guide me in this.
  • May 06, 2018
  • Like
  • 0
I want to disable or hide commandbutton for users belong to two public groups "MMC: L1" and "MMC: L2". Please guide me.

VF page:
 <apex:pageBlockButtons >
   <apex:commandButton value="Save & Unlock"   action="{!saveAndUnlock}" styleClass="saveButton"/>
    </apex:pageBlockButtons>

Controller:
public PageReference saveAndUnlock() {
        
        if(!isNotAllwToSave())
            return null;

        if(!isOkToSave())
            return null;

        // update medical chart record...
        this.codingChart.Record_Lock__c = false;
        codingChart.Record_Lock_User__c = null;

        try {
            this.codingChart.Record_Lock__c = false;
            this.codingChart.Record_Lock_User__c = null;
            this.codingChart.Status__c = selectedStatusOption;
            this.codingChart.Saved_Record_Status_Check__c = false; 
            update this.codingChart;
            saveDxCodes();

        } catch(Exception ex) {
            Apexpages.addMessages(ex);
            return null;
        }
        deleteWorkingCodes();
       return new PageReference('/apex/MC_ChartsTab'); //Redirect to charts queue
    }
  • February 15, 2018
  • Like
  • 0
Onclicking button i want to redirect to custom tab from my visualforce page. My custom tab URL "https://cs68.salesforce.com/a23/o". Please guide me.
  • January 24, 2018
  • Like
  • 0
I have a requeirement to delete the Inactive projects data from salesforce and take a backup. Whenever client request for the deleted data we need to restore in Salesforce. Is this possible in salesforce. Can any one suggest me the best approach.
  • November 29, 2017
  • Like
  • 0
I have muliple records in dxCodes. I am trying to display output format,  based on dxCodes.I have a custom field  "DOS__c" i need to display latest date in "DOS__c". And  for "DOS_End__c" i need to display old date. Somoe one please guide me in this. thanks.
 
        // Get charts and dxcodes to work on        
        List<MC_Chart__c> charts = (List<MC_Chart__c>) scope;         Map<Id, List<mc_Chart_DxCode__c>> chartIdToDxCodeMap = buildChartIdToDxcodeMap(charts);         // Get project details         Project2__c theProject = [SELECT Name FROM Project2__c WHERE Name = :projectKey Limit 1];         // Get mcMember details details         Set<Id> members = new Set<Id>();        
       for(MC_Chart__c c : charts) {          
          members.add(c.Member__c);         }    
      Map<ID, mc_Member__c> theMembers = new Map<ID, mc_Member__c([SELECT Id, Name, Recapture_V12__c FROM mc_Member__c 
  WHERE Id IN :members]);       
  // Build Output
  // For each chart   
      for(MC_Chart__c c : charts) {           
  // Get the list of DxCodes for this Chart from our map         
    List<mc_Chart_DxCode__c> dxCodes = new List<mc_Chart_DxCode__c>();        
     if(chartIdToDxCodeMap.containsKey(c.Id)) { // It's possible for a chart to have no DxCodes                 dxCodes = chartIdToDxCodeMap.get(c.Id);                 // the Dx Codes need to be grouped on DOS_Start / DOS_End for this format                 Map<String, List<MC_Chart_DxCode__c>> dxGroupMap = new Map<String, List<MC_Chart_DxCode__c>>();
 for(mc_Chart_DxCode__c dx : dxCodes) {

                    String providerFirstName = '';
                    String providerLastName = '';
                   
                     String dob = '';
                     String dos = '';
                 
                     if (dx.DOS__c != null){
                       dos = GetFormat(dx.DOS__c, 'MM/dd/yyyy');
                       }
                    String dosTo = '';
                    if (dx.DOS_End__c != null) {
                        dosTo = GetFormat(dx.DOS_End__c, 'MM/dd/yyyy');
                    }    
  • July 20, 2017
  • Like
  • 0
I have many batch jobs in my organization, i need to remove the unused batch jobs in my organization. I am checking Schedule Apex and Scheduled jobs. But it is taking more time. Is their any way to query Batch jobs which are not scheduled. PLease guide me. 
  • July 11, 2017
  • Like
  • 0
I have long text area Text field 'comments__c', after entering data in comments__c text box and click on save, comment field should be read only I tried below code, but it is not working as expected. I need to display that page in SITE.please guide me.

Controller:
public class CampaignRecordIdController{
    public String campaignRecordId {get;set;}
    public String parameterValue {get;set;}
    public Campaign cam{get;set;}
    public boolean rend{get;set;}
    public boolean rend1{get;set;}
    public Campaign Campaign{get;set;}
    
    public CampaignRecordIdController() 
    {
       campaignRecordId =ApexPages.currentPage().getParameters().get('id');
       system.debug('=====campaignRecordId ===='+campaignRecordId);
       cam = [select name,Promotion_Details__c,parentid,Comments__C from Campaign member where id =: campaignRecordId ];
       rend=true;
       rend1=false;
      
        }
         public PageReference save() {
        update cam;
        rend=false;
        rend1=true;
        return null;
    }
}

Page:
<apex:page Controller="CampaignRecordIdController"  sidebar="false" showheader="false">
   <apex:form >
   <apex:pageBlock>
    
   <apex:pageBlockSection title="Current Campaign record Id is : {!campaignRecordId}" collapsible="false" columns="1" rendered="{!rend}">
   <apex:outputField value="{!cam.name}"/>
   <apex:outputField value="{!cam.Promotion_Details__c}"/>  
   <apex:outputField value="{!cam.Parentid}"/>  
   <apex:inputtext value="{!cam.Comments__c}" style="width: 360px; height: 40px"/>  
   </apex:pageBlockSection> 
   
    <apex:pageBlockSection title="Current Campaign record Id is : {!campaignRecordId}" collapsible="false" columns="1" rendered="{!rend1}">
   <apex:outputField value="{!cam.name}"/>
   <apex:outputField value="{!cam.Promotion_Details__c}"/>  
   <apex:outputField value="{!cam.Parentid}"/>  
   <apex:outputfield value="{!cam.Comments__c}" style="width: 360px; height: 40px"/>  
   </apex:pageBlockSection> 
   
     <apex:pageBlockButtons >
      <apex:commandButton action="{!save}" value="save"/>
     </apex:pageBlockButtons>
    </apex:pageBlock>
   </apex:form>
   </apex:page>

 
  • March 16, 2017
  • Like
  • 0
I tried to display campaign id in site using visulforce page, but i am not able to display.My code is not working fine. Can i use standard controller? if not please let me know. Whether i need to try different code for SITES. please guide me.

class:
public class CampaignRecordIdController{
public String campaignRecordId {get;set;}
public String parameterValue {get;set;}
public Campaign cam{get;set;}
  public CampaignRecordIdController(ApexPages.StandardController controller) {
        campaignRecordId  = ApexPages.CurrentPage().getparameters().get('id');
        cam = [select name,Promotion_Details__c from Campaign where id =: campaignRecordId ];
        parameterValue = ApexPages.CurrentPage().getparameters().get('nameParam');      
}
}
Page:
public class CampaignRecordIdController{
public String campaignRecordId {get;set;}
public String parameterValue {get;set;}
public Campaign cam{get;set;}
   public CampaignRecordIdController(ApexPages.StandardController controller) {
       campaignRecordId  = ApexPages.CurrentPage().getparameters().get('id');
       cam = [select name,Promotion_Details__c from Campaign where id =: campaignRecordId ];
       parameterValue = ApexPages.CurrentPage().getparameters().get('nameParam');
         }
}
  • March 14, 2017
  • Like
  • 0
In my class i have below constructor, i am not able to cover code coverage.can some pls guide me, thanks. 
Constructor: takes an Opporutnity action, color index and associate file
*/
    public OpportunityAction(Opportunity_Action__c oppAction, Integer colorIndex, Files__c file) {
        this.oppAction = oppAction;
        this.oppPlan = oppAction.Opportunity_Plan__r;
        this.colorIndex = colorIndex;
        this.associatedFile = file;
        planHeader = false;
    }
  • March 06, 2017
  • Like
  • 0
I have Amendment(master) and Amendment_Role__c(child). IN my test class i am trying to create test data for  Amendment & Amendment_Role__c. I have created test data for Amendment using test factory, i am getting error while creating data for Amendment_Role__c. please guide me.
//Insert Amendment Record
  Amendment__c amendmentRecord=PRLDE_DataFactory_Test_Utility.insertAmendment(false,contactRecord.Id,opportunityAssistanceRecord.Id,opportunityRecord.Id,amendmentRecordType);
             //Insert File record
            Files__c fileRecord=PRLDE_DataFactory_Test_Utility.insertAmendmentsFiles(amendmentRecord.Id,'Amendment Documents',System.today(),'Amendments');    
          
  //Insert Amendment_role__c reocord
   Amendment_Role__c ARC = new Amendment_Role__c();   
   ARC.id = 'amendmentRecord.id';
   ARC.Name = 'testname';
   ARC.User__c = 'TESTuser';
   ARC.Role_Name__c = 'testrle'; 
   ARC.amendmentRecord = 'TEST'; 
   Insert ARC; 
  • March 03, 2017
  • Like
  • 0
how to retrieve list of standard objects used in my organization, is their any way? please guide me.
  • February 15, 2017
  • Like
  • 0
I have controller(PScRMAExtension_v1) with 3 extensions PScRMAExtension,PScRMATypeLTExtension and PScRMATypeStockedPARExtension declared in Constructors. please guide me in writing test class.

public class PScRMAExtension_v1 {
    public string RMAType{get;set;}
    public string type{get;set;}
    public string type1{get;set;}
    public PScRMAExtension objAdv {get;set;}
    public list<PScRMAExtWrapper> objWrap{get;set;}
    public PScRMATypeLTExtension objLT {get;set;}
    public PScRMATypeStockedPARExtension objSP {get;set;}
    public List<selectOption> typeList
    {
        get
        {
            typeList = new List<selectOption>();
            typeList.add(new selectOption('', '--None--'));
            typeList.add(new selectOption('Advance Exchange', 'Advance Exchange'));
            typeList.add(new selectOption('Depot Repair', 'Depot Repair'));
            typeList.add(new selectOption('License Transfer', 'License Transfer'));
            typeList.add(new selectOption('Receive Only', 'Receive Only'));
            typeList.add(new selectOption('Ship Only', 'Ship Only'));
            typeList.add(new selectOption('Stocked At PAR', 'Stocked At PAR'));
            return typeList;
        }
        set;
    }
    public PScRMAExtension_v1(){
        system.debug('I m calling const1');
        type1 = 'Being Null';
    }
        public PScRMAExtension_v1(PScRMAExtension objAdext){
       objAdv = new PScRMAExtension(this);
    }
        public PScRMAExtension_v1(PScRMATypeLTExtension objLText){
       objLT = new PScRMATypeLTExtension(this);
    }
        public PScRMAExtension_v1(PScRMATypeStockedPARExtension objSPPext){
        objSP = new PScRMATypeStockedPARExtension(this);
    }
        public PScRMAExtension_v1(ApexPages.StandardController controller)
    {
    }
        public void viewLineItem_SP()
    {
        system.debug('$$$ <PScRMAExtension::viewLineItem_SP>');
        if(objSP.view_line_item_id_SP != null)
        {
            system.debug('$$$ view_line_item_id_SP: ' + objSP.view_line_item_id_SP);
            system.debug('$$$ RMA Wrapper: ' + objSP.RMA_line_item_wrapper_list.size());
            if(objSP.RMA_line_item_wrapper_list != null && objSP.RMA_line_item_wrapper_list.size()>0){
              objSP.view_line_item_obj_SP = objSP.RMA_line_item_wrapper_list.get(objSP.view_line_item_id_SP).RMA_line_items;
              system.debug('$$$ view_line_item_obj_SP: ' + objSP.view_line_item_obj_SP);
            }
        }
    }
    public void viewLineItem_LT()
    {
        system.debug('$$$ <PScRMAExtension::viewLineItem_LT>:'+objLT.view_line_item_id);
        system.debug('$$$ RMA Wrapper: ' + objLT.RMA_line_item_wrapper_list.size());
        if(objLT.view_line_item_id != null)
        {
            objLT.view_line_item_obj = objLT.RMA_line_item_wrapper_list.get(objLT.view_line_item_id).RMA_line_items;
            system.debug('$$$ view_line_item_obj_LT: ' + objLT.view_line_item_obj);
        }
    }
   public void viewLineItem_AE()
    {
        system.debug('$$$ <PScRMAExtension::viewLineItem_AE>');
        if(objAdv.view_line_item_id != null)
        {
            objAdv.view_line_item_obj = objAdv.RMA_line_item_wrapper_list.get(objAdv.view_line_item_id).RMA_line_items;
            system.debug('$$$ view_line_item_obj_Adv: ' + objAdv.view_line_item_obj);
        }
    }
    public void switchPanel(){
        if(RMAtype == 'Advance Exchange'){
          objAdv = new PScRMAExtension(new PScRMAExtension_v1());
        }else if(RMAtype == 'License Transfer'){
            objLT = new PScRMATypeLTExtension(new PScRMAExtension_v1());
        }else if(RMAtype == 'Stocked At PAR'){
            objSP = new PScRMATypeStockedPARExtension(new PScRMAExtension_v1());
        }
    } 
    public class PScRMAExtWrapper
    {
        //Wrapper class variable initialization
        public RMA_Line_Items__c RMA_line_items { get; set; }    //public variable for rma line item
        public Integer line_item_no { get; set; }
        /*
        *Wrapper class constructor
        */
        public PScRMAExtWrapper()
        {
        }
    }
        public void saveMainClass (List<PScRMATypeStockedPARExtension.PScRMALineItemsWrapper> objRM){
        system.debug('Main Class:'+objRM);
        type1 = 'Being Null by me';
        list<PScRMAExtWrapper> objWrap = new list<PScRMAExtWrapper>();
        PScRMAExtWrapper objW = new PScRMAExtWrapper();
        if(objRM != null && objRM.size()>0){
            for(PScRMATypeStockedPARExtension.PScRMALineItemsWrapper RM: objRM){
              objW.line_item_no = RM.line_item_no;
              objW.RMA_line_items = RM.RMA_line_items;
                objWrap.add(objW);
            }
        }
        system.debug('Main class wrapper:'+objWrap);
    }

}
  • March 08, 2016
  • Like
  • 0