• Lokesh Kumar
  • SMARTIE
  • 1553 Points
  • Member since 2016
  • Salesforce Developer
  • Informatica


  • Chatter
    Feed
  • 49
    Best Answers
  • 3
    Likes Received
  • 0
    Likes Given
  • 13
    Questions
  • 414
    Replies
I have inline VF page on Account page layout. This inline page may or maynot have records and even if records are present, it can be very low in number. When the number of records are none/less, it is showing white space at the botton of this inline page which doesnt look good. How to remove this white space below the inline page?
Hi Expert,

I have a sendbox details, i want to create a new object in salesforce , but "New Custom Object" button is not available on my version. 


User-added image

Please suggest , how to create a new Custom object button
Thanks 
Mukesh
Hello Everyone,

I am trying to create pdf file in salesforce. But I have image and need to put this image with zero margin in the left side . 

 @page {
            margin-left:  0cm;
            margin-right: 2.54cm;
}

I wrote this css style , it doesn't work.

Thank you .
I created a field that is dependent on a picklist. How do I make it required and show an error message when it is enabled but left blank? 
...and it sure looks like it's there to me.

I'm doing the tutorial on REST callouts, and the exit test calls for making a class called "AnimalLocator." I created the class, wrote the code for it per the instructions, and ran the tests. When check the challenge, though, I get an error message "Challenge Not yet complete... here's what's wrong: 
No Apex class named 'AnimalLocator' was found."

I've double checked my spelling and capitalization. What rookie mistake might I be making here?

Thanks.
 
Hi all, 

I made few changes to the  one of the Apex classes in UAT, I want to move same class into Production( already same class exist in Production) by useing change sets.

is it like same process adding classes and testclasses into change sets then validation and deploy?? 
why because same test class already exist in prodcution, so do i need to add again test class to the chang set??
which option is suitable during deployment to run test classes among four?? ..i dont want to run all the test classes in prodcution at this case  
Is it going to overwrite the exist class?? 
is there any possible errors can occur during deployment in this case?? 

Thanks in advance.
Hi Team,

I want to get opportunities that are related to case as a related list using VF page.

Can anyone help to fix this?

Thanks & Regards,
Karthikeyan Chandran
I have a trigger on the Opportunity that creates records on a custom object called the Opportunity_Revenue__c. It takes the revenue from the Opportunity and spreads it out over the quarters during the length of the deal. It works fine for insert triggers, I need to have the ability to let users re-create based on a changing contract length / deal length. 

So when the record is updated I want to delete all the records in the custom object Opportunity_Revenue__c that are related to the Opportunity and then run the insert code to create the new records for the Opportunity_Revenue__c object. But it is doubling the records because once it deletes the old records it see trigger as an update and an insert.

Can you help or suggest what I might do?

Here is the code:
 
public class OpportunityRevenueTrigger2 {

    
    public static void updateOpportuntityRev(List<Opportunity> trig){
         List<ID> opprtnyId = new List<ID>();
         Decimal totRev;
         Decimal totAllottedRev;
         Decimal mRev;
         
         for(Opportunity opp4: trig){
            if(Opp4.Auto_Generate_Quarterly_Forecast__c == 'Yes'){
                opprtnyId.add(opp4.id);
            }
         List<Opportunity_Revenue__c> deleteOR = [SELECT id
                                                 FROM Opportunity_Revenue__c 
                                                 WHERE Opportunity__c in: opprtnyID];
         
        if(deleteOR.size() != 0){
           Delete deleteOR;
         }
        
        List<Opportunity_Revenue__c> oppr = new List<Opportunity_Revenue__c>();
        for(Opportunity opp : trig){
             
             if(opp.amount > 0 && opp.contract_length_Months__c > 0 
               && opp.Auto_Generate_Quarterly_Forecast__c == 'Yes' ){
                   Date sDate = opp.CloseDate;
                   Integer period = opp.Contract_Length_Months__c.intValue();
                   Integer period2 = period / 3;
                   totRev = opp.Amount;
                   mRev = totRev.divide(period2, 2);
                   for(Integer i = 1; i <= period2; i++) {
                   Opportunity_Revenue__c oppr2 = new Opportunity_Revenue__c();
                   oppr2.Account__c = opp.AccountId;
                   oppr2.Opportunity__c = opp.id;
                   System.debug('i '+ i);
                   oppr2.ProjectedRevenue__c = mRev;
                   oppr2.Month__c = sDate;
                       if(sDate.Month()== 1 || sDate.month()==2 || sDate.month() ==3){
                           oppr2.Quarter__c =  'Quarter 1, '+string.valueOf(sDate.Year());   
                       } else if (sDate.Month()== 4 || sDate.month()== 5 || sDate.month() == 6){
                           oppr2.Quarter__c =  'Quarter 2, '+string.valueOf(sDate.Year());
                       } else if (sDate.Month()== 7 || sDate.month()== 8 || sDate.month() == 9){
                           oppr2.Quarter__c =  'Quarter 3, '+string.valueOf(sDate.Year());
                       } else if (sDate.Month()== 10 || sDate.month()==11 || sDate.month() ==12){
                           oppr2.Quarter__c =  'Quarter 4, '+string.valueOf(sDate.Year());
                       }
                   
                   oppr.add(oppr2);
                   sDate = sDate.addMonths(3);
                   }
                  
        
              }
        }
        insert oppr;

    }
}
}
 
trigger OpportunityRevenueTrigger on Opportunity (after insert, after update) {
  
        
        OpportunityRevenueTrigger2.updateOpportuntityRev(trigger.new);
        
 
  }

 
Hello Developers!
I am trying to write trigger on opportunity which would sum the Amount field on Account.
This might be possiable via standard but I am trying to have similar trigger on different set of object and solving this would solve the other one as well.
Trigger:
trigger AmountRollup on Opportunity(After insert, After update, After delete, After undelete){
    
    Set<ID> accountIds = New Set<ID>();
    
    If(Trigger.IsInsert || Trigger.IsUpdate || Trigger.IsUndelete){
        For(Opportunity opp: Trigger.New){
            accountIds.add(opp.AccountID);
        }
    }
    If(Trigger.IsDelete){
        For(Opportunity opp: Trigger.Old){
            accountIds.add(opp.AccountID);
        }
    }
    
    List<Account> AccountListToUpdate = New List<Account>();
    Double AmountTotal = 0.00;
    
    
    For(Account a : [Select id, total_opportunity_amount__c, 
                                (Select id, Amount FROM opportunities) 
                                FROM Account WHERE ID = :accountIds])
    {
         For(Integer I = 0; I < a.opportunities.size(); I++)
         {
             AmountTotal += a.opportunities.Amount; // Here I am trying add all amount sum into AmountTotal
             a.total_opportunity_amount__c = AmountTotal;
             AccountListToUpdate.add(a);
         }
                                
    }
    try{
    update AccountListToUpdate;
    }
    catch(Exception E){
        system.debug('Error thrown is: ' + E.getMessage());
    }
}

Thank you for the help!
We are trying to install app from appexchange in sandbox and getting [Exception, DomainNotPropagated] error.

An error has occurred in the following section: [Exception, DomainNotPropagated]. Salesforce.com has been notified of this error.

How do we resolve? We have been on a custom domain for over a year in sandbox and production.
<apex:page standardcontroller="comingpeople__c"   sidebar="false" showHeader="false">
<apex:form >

<apex:pageBlock >
<apex:pageBlockSection title="OUTING PLAN">
<apex:inputField value="{!comingpeople__c.Employee_name__c}" /><br/>
<apex:inputField value="{!comingpeople__c.GID__c}" /><br/>
<apex:inputField value="{!comingpeople__c.coming_or_not__c}" /><br/>
<apex:inputField value="{!comingpeople__c.Transportation__c}" /><br/>
<apex:inputField value="{!comingpeople__c.Venue__c}" /><br/>
</apex:pageBlockSection>

<apex:commandButton value="save" action="{!save}"  />

</apex:pageBlock>
</apex:form>
</apex:page>
In Setup, I have so many apex classes or VF pages, I dont want to browse page by page to locate a class, I have used Quick Find/Search box to find a class but it returns 0 item.
I have to browse every page to find a class, it is very inconvenient.
Please tell me how to find quickly a class or Vf page.

thanks

 
I'm trying to build [Change] link next to record owner name on the lead VF page so that the user can re-assign the leads. My lead VF page is a completely custom build page. I'm expecting this functionality to work as in Standard page ie., when the user clicks the [Change] link he/she should be taken to the change ownership page from where he/she should re-assign the lead and the retUrl should take him/her back to the custom page.

I have used the below piece of code found in this forum - 
<apex:outputLink value="{!URLFOR($Action.Lead.ChangeOwner,Lead.id)}">[Change]</apex:outputLink>

But it's not working as expected. When I add this code and tested by clicking the output link [Change] it asks me to log in again and gives me an error as - 
Stale Session Exception
The page you submitted was invalid for your session. Please try your action again. 

Can I get some help here? 

Hi,

We have created an apex class and 2 triggers which execute once a registration record is created/updated in order to update the record based on certain criteria.
From this we have noticed that in the mornings the registration process can be quite slow for some users and in some cases they will get the request timed out error message.
When a system admin tries it, sometimes its slow but most of the time we can create the registration fairly quickly.

Is there anything that I should check to maybe increase the request time of the users/triggers? I've never got an error like this and we never had the error in any of our sandboxes - it just appears to be production.
Does anyone know how to resolve this/had a similiar problem?

Thanks.

Hello,

I have a VF text like below
<apex:outputText value="{!cObj.Type__c}" style="font-weight: bold;color: black;font-size: 160%;"/>

I want to control the CSS based on Type__c value
if(Type__c == XYZ)
    style="font-weight: bold;color: black;font-size: 160%;"
else
    style="color: black;"

Thanks for suggestion !
 I need a calculating field ---  calculate days taken to change from open to verified status.

There is a Lead Status picklist  on Account object   -- open ---> Verified.
.
Let me know if you need more info.
Hi, 

Some questions with respect to the Report module.  Here is a report that we have and it has the relationship like this.

Levels for the Reports

Question : In the above screenshot on the top it shows Opportunities (A). The other three are relationships are below that.
Can we have another relationship like Opportunities to a new relationship (E) and E is not related to B or C or D.   We need this new relationship for our project. Need to explore if this is possible or we have to do only by means of development ? 

Thanks
Sajiv​


 
Hello,

When i search something in search box from Portal, i can see the people in the salesforce.
How can i block it ?

Thaks for suggestion !
Hi There, Does anybody knows if there is a way to create an opportunity directly when a customer order a service from our company website. Can you do process builder or need a Apex trigger ? Feel free to  direct me to a link with the process builder or trigger solution.
Hello Geeks,

Wants to know more about how we can whitelist IP's at Profile Level instead of manually.
I want to know is there a way to add IP's Programmatically through API's.

Any suggestion appreciated 

Thanks
Lokesh
Hello Geeks,

we have a requirement to do a call out whenever any deployment is happing in the Org,

Why Is it required?

We want to hit an URL if the deployment components having particular component only in Apex Class. URL is for executing the test cases in the third party system. 

So is there any way to look into the deployment Components programmatically. (API's)

Any Help much appreciated.

Thanks
Lokesh
I am trying to pass Set of Ids in the where clause at the time of setEndPoint URL for more PFB.
Map<ID,ApexClass> apexclassName 		= new Map<Id,ApexClass>([select id,name from ApexClass where NamespacePrefix = null]);
        Map<ID,ApexTrigger> apexTriggerName 	= new Map<ID,ApexTrigger>([select id,name from ApexTrigger where NamespacePrefix = null]);
        Set<ID> apexandTriggerID = new Set<Id>();
        apexandTriggerID.addAll(apexTriggerName.keySet());
        apexandTriggerID.addAll(apexclassName.keySet());
        HttpRequest req = new HttpRequest();
        req.setHeader('Authorization', 'Bearer ' + UserInfo.getSessionID());
        req.setHeader('Content-Type', 'application/json');
        req.setEndpoint(URL.getSalesforceBaseURL().toExternalForm()+'/services/data/v37.0/tooling/query/?q=Select+ApexClassorTriggerId,NumLinesCovered,NumLinesUncovered,Coverage+from+ApexCodeCoverageAggregate+where+ApexClassorTriggerId+IN+(+'+apexandTriggerID+')');
        req.setMethod('GET');
        Http h = new Http();
        HttpResponse res = h.send(req);

the value which is getting assigned is like.

21:08:27:041 USER_DEBUG [12]|DEBUG|***System.HttpRequest[Endpoint=https://informatica--Lokesh.cs41.my.salesforce.com/services/data/v37.0/tooling/query/?q=Select+ApexClassorTriggerId,NumLinesCovered,NumLinesUncovered,Coverage+from+ApexCodeCoverageAggregate+where+ApexClassorTriggerId+IN+(+{01p550000001F7QAAU, 01p550000001F7RAAU, 01p550000001F7SAAU, 01p550000001F7TAAU, 01p550000001F7UAAU, 01p550000001F7VAAU, 01p550000001F7WAAU, 01p550000001F7XAAU, 01p550000001F7YAAU, 01p550000001F7ZAAU, ...}), Method=GET]
 
can anyone help me how to pass return false; in the ng-click event while opening a PrimaryTab using salesforce service cloud console. This is to stop refreshing the main page after clicking on a link.
 
<tr ng-repeat="case in Caseinformation|orderBy:sortType:sortReverse |      filter:query " style="height:1px;" class="data-row">          
     <td style="text-align:left;"><a ng-href="/{{case.caseId}}" ng-click= "openPrimaryCaseTab(case.caseId,case.caseNumber);return false">{{case.CaseNumber}}</a></td>

$scope.openPrimaryCaseTab = function (recordID,caseNumber) {
    alert('open primary tab'+recordID);
    sforce.console.openPrimaryTab(null,recordID,true,caseNumber); 
    }



 
Not able to pass this Challenge PFB screen shot.
My Save Method code.

 
public PageReference save(){
        PageReference savePage;
        if (Schema.SObjectType.Resource_Type__c.isCreateable()){
            try{

                insert rtype;

                String completion = ApexPages.currentPage().getParameters().get('finishURL');
                system.debug('First$'+completion);
        if(completion.startsWith('/')){
        system.debug('Second$'+completion);
            completion.replaceFirst('/','');
system.debug('Third$'+completion);
        }
        savePage = new PageReference('/'+completion);
        
        savePage.setRedirect(true);
        return savePage;
            

            }catch (exception e){
                ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR, 'Unable to update requisitions.  Exception: ' + e.getMessage()));
                return null;
            } 
        }else{
            ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR, 'You do not have permission to update requisitions'));
            return null;
        }
    }


User-added image 
can anyone please help me here I am not able to solve this challenge.

User-added image
Can somebody please help me out here how to measure based on the sum of # instead of a count of rows or sum of the amount because on my case # is not appearing on the creating lens window Thanks in advance. PFB more details.

User-added image
can somebody help me her am not able to pass this module stuck in the last challenge for more details PFA.

User-added image

User-added image

 
We have a requirement to get the overall test class coverage and individual classes there in salesforce production org. automatically based on time interval. The challenge is how to execute it programmatically and get the latest coverage? 
 Thanks in Advance 
-Lokesh
Create a dashboard named Sales Focus and add the reports you set up earlier in this module.
Add a component based on the Upgrades (Last Month) report as a gauge component.
Add a component based on the Key Accounts report as a horizontal bar chart component.
Check challenge


Challenge Not yet complete... here's what's wrong: 
There was an unexpected error while verifying this challenge.
Usually this is due to some pre-existing configuration or code in the challenge Org. We recommend using a new Developer Edition (DE) to check this challenge. If you're using a new DE and seeing this error, please post to the developer forums and reference error id: LNEWIXXM

User-added image
I am quering a name from the user object by providing in text box and displaying as dynamic record choice. but if the provided user is not exist i want to display a message that the requested user in not present. how to handle no result in visual flow dynamic record choice
currently we are running via manual clicking on the batches. could you please suggest an option to automate apttus job.

these are the apttus batch jobs update.
Requirement:
I want to create an app which update the user information like profile, email,license etc. and give it to service desk engineer so the can solve the ticket related to user detail modification by own.
For the above requirement modify-all permission is required, but i want to do this without any dependency of an logged-in user means in system-mode context.
Please suggest some ideas.

i tried visual flow and process-builder but i get to know that visual flow run's in a user-mode and process-builder doesn't support screen. only we can execute the auto-flow(which doesn't have screen to take the input from the user).
Can somebody please help me out here how to measure based on the sum of # instead of a count of rows or sum of the amount because on my case # is not appearing on the creating lens window Thanks in advance. PFB more details.

User-added image
Hi,
I created a process builder recently. As it was no longer in use I deleted it from my org. Now, while making any changes in the records I am still receiving the mail with error message regarding process builder failure. 
Error element myRule_1_A1 (FlowRecordUpdate).
The flow tried to update these records: 0034100000TxUl2AAF. This error occurred: ALL_OR_NONE_OPERATION_ROLLED_BACK: Record rolled back because not all records were valid and the request was using AllOrNone header.

It would be helpful of you if you can solve my problem.
Regards,
Deepali
We have created a custom button on the feed called "New Task". When we use it the feed details show:
[Task Subject] - [Task creator] created a task.
[Task Subject] date
[Case number]

We would like to change this to display:
[Task Type] - [Task creator] created a task.
[Task Subject] date
[Task Comments]
I have inline VF page on Account page layout. This inline page may or maynot have records and even if records are present, it can be very low in number. When the number of records are none/less, it is showing white space at the botton of this inline page which doesnt look good. How to remove this white space below the inline page?
User-added image HI Folks!! Whether i need to create Custom fiels for account like Match_Billing_Address with API NAME: 'Match_Billing_Address__c
Hi,
   I have a requirement with pick list values 

   Record Type Record_Type_Name__c = ( Partner, Forti User, End User)
  
   profile 1 = 00e340000011weF
   profile 2 = 00e30000000boI5
   User 1 = 00534000008Rauz

 Here Profile 1 and 2 are only allowed to change picklist values other than this no one is allowed to change.
 User 1 is allowed to change only pick list Record_Type_Name__c  value from  (Forti User to End User) other than this he is not allowed to change.
 
 Please suggest me how to add this condition in salesforce formula

Thanks
Sudhir
 

Hi, I've build a flow in my sandbox (Winter 18) which updates the Standard Field NAME in a custom object. 
It's working... but when I try to build it in productive evironment standard fields are not available to select. 

Bug or Feature?

Thx


 User-added image

I had to delete a field, say Type__c from a custom object and use RecordType ... I've deleted the field Type__c and now I'm trying to upgrade the recordTypes via PostInstallScript. But when I'm trying to query for Type__c I get the below error.

    No such column 'Type__c' on entity 'Custom Object'. If you are attempting to use a custom field, be sure to append the '__c' after the custom field name. Please reference your WSDL or the describe call for the appropriate names.

Any suggestions, thanks.
Child name-Childobject__C;
Parent name-Parentobjectname__c;
i want query to update related parent record.

Hi,

I have 4 record types, once lead created of "ABC" record type values should not be able to updated of ABC record type.

Any pointers on this ?

I've created an invocablemethod to perform some business logic processing and was going to use visual workflow to habdle the UI side of things as the method requires some inputs from the user. The method runs through test cases with 100% coverage and no errors, and I;ve checked using debug messaages that it is actually doing what it is supposed to do.
However, when I create a visual workflow for the UI, I don't get an "Apex" section in the pallette, nor of course the class that should appear there. Are there any gotchas that might mean my class or the section is not displaying? I have been looking high and low for the sulution on the web and several hours later am about to give up and use a VF page instead.
Hi Team,

I need to update a custom field in case object whenever the case owner changed from a user to queue.

Can anyone help me to fix this with a trigger ASAP?

Thanks,
Karthikeyan
Hi all,
I created a vf page , with a text box field mobile number along with a button called Next , so I want when i will give 10 digit number only then only the next button will work, otherwise for giving any number less than 10 digit it should through an error mssg saying plz give the 10digit number?

can any one suggest me the code
Thanks
Hi,

I've setup a process to send marketing emails out at regular intervals. However, as the process goes on the amount of emails send begins to vary with some being sent 45 times each and others just 15. why would this happen/how is it prevented?
  • May 30, 2017
  • Like
  • 0
I am trying to have a minimum 3 characters of First Name and Last Name in order to retrieve the data, but now, it retrieves result of data even it is less than 3 characters.

Thanks in advance.

Bottom is Apex code:
----------------------------------------------------------------------------
public with sharing class psw {
    public String sfprn { get; set; }
    public String mrn {get;set;}
    public String lname {get;set;}
    public String fname {get;set;}


public class TableRow2{
    public String sfprn {get;set;}
    public String mrn {get;set;}
    public String lname {get;set;}
    public String fname {get;set;}
    public Decimal SurveySelection {get;set;}
}

public List<TableRow2> RowList {get; set;}

public PageReference searchPatients(){

    RowList = new List<TableRow2>();
    TableRow2 tr;

    String bind_fname = string.isBlank(fName) ? null : (fname.left(3) + '%');
    String bind_lname = string.isBlank(lname) ? null : (lname.left(3) + '%');

    for(Patient__c con : [SELECT sfprn__c, 
                                mrn__c,
                                LName__c, 
                                FName__c,
                                (select SurveySelection__c.SurveySelection__c from SurveySelections__r) 
                                FROM Patient__c
                                where ( mrn__c =:mrn )
                              //or ( LName__c =:lname and FName__c =:fname) LIMIT 1 
                                or ( LName__c LIKE :bind_lname and FName__c LIKE :bind_fname ) LIMIT 1                       
                                ]){                                    
        tr = new TableRow2();
        tr.sfprn = con.sfprn__c;
        tr.mrn = con.mrn__c;
        tr.lname = con.LName__c;
        tr.fname = con.FName__c;
        tr.SurveySelection = con.SurveySelections__r.isEmpty() ? null : con.SurveySelections__r[0].SurveySelection__c;

        RowList.add(tr);         

        }
     return null;   


}

Bottom is VF code:
----------------------------------------------------------------------------

<apex:page Controller="psw" showHeader="false" sidebar="false">
<apex:form >
<apex:pageBlock >
    <!-- Search button-->
    <apex:pageBlockButtons location="top">
        <apex:commandButton value="Search" action="{!searchPatients}" reRender="contact-table"/>
    </apex:pageBlockButtons>

    <apex:pageBlockSection id="contact-table" columns="1">
        <!-- Input starts -->
        <apex:pageBlockSectionItem >
            <apex:outputLabel value="MRN" />
            <apex:inputText value="{!mrn}"/>            
        </apex:pageBlockSectionItem>

        <apex:pageBlockSectionItem >
            <apex:outputLabel value="Last Name" />
            <apex:inputText value="{!lname}"/>            
        </apex:pageBlockSectionItem>
        <apex:pageBlockSectionItem >
            <apex:outputLabel value="First Name" />
            <apex:inputText value="{!fname}"/>            
        </apex:pageBlockSectionItem> 
        <!-- Input ends -->

        <!-- Output 1 starts --->
        <apex:pageBlockTable value="{!RowList}" var="c">
            <apex:column >
                <apex:facet name="header">MRN</apex:facet>
                {!c.mrn}
            </apex:column>
            <apex:column >
                <apex:facet name="header">Last Name</apex:facet>
                {!c.lname}
            </apex:column>
            <apex:column >
                <apex:facet name="header">First Name</apex:facet>
                {!c.fname}
            </apex:column>                         
         </apex:pageBlockTable>
         <!-- Output 1 ends --->  
     </apex:pageBlockSection>       
    </apex:pageBlock>    
</apex:form>    
</apex:page>
 
Hi All,

I have created custom fields Credit_Card_Name__c, Credit_Card_Number__c in Contact object. And i have created one custom object - Credit_Card__c with fields Name, Card_Holder_Email__c, Credit_Card_Number__c. 
I have created one custom button (name: Credit Card) on contact object of type (Display Type: Detail Page Button, Content Source: Visualforce Page).
I have inserted the records for Credit Card object.

When I click on custom button (name: Credit Card), I want to retrieve and display only those records which are related to Contact email in the form PageBlockTable with Radio buttons. After selecting one credit card, those details should be displayed in Contact object fields Credit_Card_Name__c, Credit_Card_Number__c.
I can achieve this by using below class. But i want to do the same using wrpapper class so that credit cards will be displayed in the form of pageBlockTable along with Radio buttons.
Thanks.

public Class ContactCreditDetailsPage
{
    private final Contact conObject = null;
    public String selectedCard{get; set;} //This is for updating selected credit card details in Contact object
    public List<Contact> con2 {get; set;} //This is for retrieving only those credit cards whose email is same as Contact record.
    public List<Credit_Card__c> ccard {get; set;}
    public List<Credit_Card__c> results; // For retrieving the credit cards from object - Credit_Card__c
    
    
    /*************
    Constructor to initialize the objects
    *********/
        public ContactCreditDetailsPage(ApexPages.StandardController stdCtr)
    {
        ccard = new List<Credit_Card__c> ();
        this.conObject = (Contact)stdCtr.getRecord();
        con2 = [select id, email, name from contact where id=:conObject.Id];
    }
    
    /**************
    For retrieving the credit cards from object - Credit_Card__c where Card_Holder_Email__c is same as Contact email
    ****************/
        public List<SelectOption> getRecords()
    {
        results = [select Name, Card_Holder_Email__c, CreditCardNumber__c, Expiry_Date__c, CVV__c from Credit_Card__c where  Card_Holder_Email__c =: con2.get(0).Email]; 
        List<SelectOption> cardList = new List<SelectOption>();
        for(Credit_Card__c cc : results)
        {
         
            cardList.add(new SelectOption(cc.Name,'Name: '+cc.name));
           
        }
        return cardList;
    }
    
    /*****************
            Method to assign Credit Card details to Contact
    ***************/
    public void retrieveCardDetails()
    {
        for(Credit_Card__c cc : results)
        {
            if(selectedCard == cc.Name)
            {
                contact conObj = new contact();
                conObj.CreditCardNumber__c = cc.CreditCardNumber__c;
                conObj.Expiry_Date__c = cc.Expiry_Date__c;
                conObj.CVV__c = cc.CVV__c;
                conObj.Credit_Card_Name__c = cc.Id;
                conObj.Id = con2.get(0).Id;
                System.debug('conObj'+conObj);
                update conObj;    
            }
        }
        
    }
    
    /********
    PageReference method to save details and redirect to Contact page
    *********/
    public PageReference save() 
    {
        PageReference nextPage = new PageReference('/' + con2.get(0).Id);
        retrieveCardDetails();
        return nextpage;
    }
    
      }

<apex:page standardController="Contact" extensions="ContactCreditDetailsPage" sidebar="false">
<apex:sectionHeader title="Credit Card" subtitle="Page"/>
    <apex:form >
   
        <apex:pageBlock title="Credit Card Details"> 
              
            <apex:selectRadio value="{!selectedCard}" >
                <apex:selectOptions value="{!Records}"/>
            </apex:selectRadio>
            
            <apex:pageBlockButtons location="top">
                     <apex:commandButton action="{!save}" title="Add selected card info in Contact" value="Add Card" />
                 
            </apex:pageBlockButtons>   
       
        </apex:pageBlock> 
    </apex:form>
</apex:page>
Current page:
User-added image

New Page should be as below:
User-added image
set<Id> pmIds = new set<id>();        
        
         for(Medical_History_MVN__c mdh : medicalhistorys) {         
         pmIds.add(mdh.Program_Member_MVN__c); 
             System.debug('mdh:'+mdh);
    }
    
    lstMH = [Select id,Program_Member_MVN__c,Diagnosis_Start_Date_C1__c,Primary_ICD_10_CM_Code_C1__c, Secondary_ICD_10_CM_Code_C1__c, Primary_ICD_10_CM_Code_C1__r.id,
                         Secondary_ICD_10_CM_Code_C1__r.id from Medical_History_MVN__c WHERE RecordType.DeveloperName = 'Diagnosis'
                                                                        and Program_Member_MVN__c IN :pmIds];
How to cover the "pmIds" in test class?
I need help on the following requirement as follows,

I have a text field called "Latest date" which has values in "March -2017" format

I want another formula field to convert the above text to dd/mm/yyyy format


The date can be 1st of every month

I shouldnt make any changes to the existing field and need this functionality in  a new field

Help me how to acheive this

Thanks in Advance
Hi
I am backing up my org's data every week via DemandTool.
But there are few field saying "Failed to Create Batch Job".
What does this mean exactly ? Can it be fixed through administrator or developer ?
Any suggestions would be appreciated !