• Prolay
  • NEWBIE
  • 215 Points
  • Member since 2012
  • Lead Solution Architect
  • CSS CORP


  • Chatter
    Feed
  • 5
    Best Answers
  • 0
    Likes Received
  • 2
    Likes Given
  • 10
    Questions
  • 171
    Replies
I have a report with filters (filters fixed) that works fine.

User-added image

But I need to add another filters which are dynamics, I mean, there are 5 filters that the user can o can't choose and with these criteria selected the report needs to get the information.

I read in the forum that exists the way to pass dynamically the values using URL with querystring variables:
https://na12.salesforce.com/00OU00000013vG6?pv0=1/1/2011&pv1=2/1/2011

But in order to this works the filters "pv0" and "pv1" needs to be defined in the report, in my case I can't define these because are not fixed.

Is there a way to made this?

Thank you very much
Hi I am using angular js and remoteaction to modify the data on the page My code is
<---------visualforce page------>
<apex:page controller="testangular">
	<apex:includescript value="//ajax.googleapis.com/ajax/libs/angularjs/1.4.8/angular.min.js"/>
	<apex:stylesheet value="{!URLFOR($Resource.EshopResource,'EShopResource/EshopProduct.css')}"/>
	<apex:stylesheet value="{!URLFOR($Resource.EshopResource,'EShopResource/fonts.css')}"/>
	<style>
		.v-align{
			vertical-align: middle !important;
			}
	</style>

	<div ng-app="myApp" ng-controller="customersCtrl"> 
				
						{{names}}
						<button ng-click="letsset()">Try me</button>
					</div>
				
	

	<script>
		function myfunc(){
			
		}
		var a;
		var app = angular.module('myApp', []);
		app.controller('customersCtrl', function($scope,$window) {
                      $scope.names='Firstname';
		     $scope.letsset=function(){
			testangular.actfast($scope.names,function(result,event){
				 		if (event.status){
				 			
				 			$scope.names=result;
				 			
				 			}
						});
		
			}
		
		});

	</script>
</apex:page>



<!---controller--->

public with sharing class testangular {
     @remoteaction
	 public static string  actfast(string s){
	  return s=='Firstname'?'LastName':'Firstname';
	 
 	

}
code works fine but the view changes abnormaly. some times lastname appear as soon as try me is clicked some time i need to double click

Please help
 
Scenario I have tired:
I have created custom object (School) with a custom field (Address) and checked it as required.
 
Now the message is displayed as “Error: You must enter a value“ .
Instead of this message I want to display the message as “Address Is Compulsory”.
Please suggest how to do this.

We created a convert button that will convert from one object to another.  It works on Administrator profile but wont work on other profile.  I enabled all APEX Classes Access and Visualforce Page Access but it still doesnt work.  Any work around you can think of? 

what I've done
- redo the APEX
- recreate the VF Page

 

APEX CLASS
public class ControllerProposalConvertView {
    public Id pId;
    public String convertedAccountId;

    public ControllerProposalConvertView(ApexPages.StandardController stdController){
        pId = ApexPages.CurrentPage().getParameters().get('id');
        System.Debug('#######leadId:' + pId);
    }


    public PageReference convert(){

        try{
        Proposal__c p = [SELECT Id, name, Already_Converted__c, Property__c, Square_Footage__c, Lot_Size__c, Lot__c, Cap_Rate__c, Term__c, NOI__c, Lease_Commencement_Date__c, Rent_Commencement_Date__c, Lease_Expiration_Date__c, Years_Remaining__c, Lease_Notes__c, Gross_Leasable_Area__c, Options__c, Original_Lease_Term__c, Suggested_List_Price__c, Broker_Relationship__c, Broker_Relationship2__c, Commission__c, Escrow_Fees__c, Existing_Debt_Retirement__c, Pre_Payment_Penalty__c, Title_Fees__c, Transfer_Tax__c FROM Proposal__c WHERE Id=:pId LIMIT 1];
        
        if (p.Already_Converted__c  =='Not Converted'){
        Listing__c c=new Listing__c(Name=p.Name, Property__c=p.Property__c, Square_Footage__c=p.Square_Footage__c,  Lot_Size__c=p.Lot_Size__c, Lot__c=p.Lot__c, Cap_Rate__c=p.Cap_Rate__c, Term__c=p.Term__c, NOI__c=p.NOI__c, Lease_Commencement_Date__c=p.Lease_Commencement_Date__c, Rent_Commencement_Date__c=p.Rent_Commencement_Date__c, Lease_Expiration_Date__c=p.Lease_Expiration_Date__c, Years_Remaining__c=p.Years_Remaining__c, Lease_Notes__c=p.Lease_Notes__c,Gross_Leasable_Area__c=p.Gross_Leasable_Area__c,Options__c=p.Options__c,Original_Lease_Term__c=p.Original_Lease_Term__c,Suggested_List_Price__c=p.Suggested_List_Price__c,Broker_Relationship__c=p.Broker_Relationship__c, Broker_Relationship2__c=p.Broker_Relationship2__c,Commission__c=p.Commission__c, Escrow_Fees__c=p.Escrow_Fees__c,Existing_Debt_Retirement__c=p.Existing_Debt_Retirement__c,Pre_Payment_Penalty__c=p.Pre_Payment_Penalty__c,Title_Fees__c=p.Title_Fees__c,Transfer_Tax__c=p.Transfer_Tax__c);

        System.Debug('#######c :' + c );
        insert c;
        p.Already_Converted__c='Converted';
       update p;
        convertedAccountId = c.Id;
        System.Debug('#######convertedAccountId :' + convertedAccountId );
        }
        
        else{
                String sServerName = ApexPages.currentPage().getHeaders().get('Host');
        sServerName = 'https://'+sServerName+'/';
        PageReference retPage = new PageReference(sServerName + '/apex/ProposalConvertView2?id='+ pId); 
        retPage.setRedirect(true);
        System.Debug('#######ALREADYCONVERTED' );
        
        return retPage;
        }
        
        }
        
        catch(Exception e){
            System.Debug('#######Error  - Exception [' + e.getMessage() + ']');
            return null;
        }
        String sServerName = ApexPages.currentPage().getHeaders().get('Host');
        sServerName = 'https://'+sServerName+'/';
        System.Debug('#######sServerName :' + sServerName );
        PageReference retPage = new PageReference(sServerName + convertedAccountId); 
        System.Debug('#######retPage :' + retPage );
        retPage.setRedirect(true);


        return retPage;
    } 
    public PageReference back(){
            String sServerName = ApexPages.currentPage().getHeaders().get('Host');
        sServerName = 'https://'+sServerName+'/';
        System.Debug('#######sServerName :' + sServerName );
        PageReference retPage = new PageReference(sServerName + pId); 
        System.Debug('#######retPage :' + retPage );
        retPage.setRedirect(true);
        
        return retPage;
    }      
}


VF PAGE 1

<apex:page standardController="Proposal__c" extensions="ControllerProposalConvertView"> <apex:outputPanel layout="block" style="font-weight:bold"> You are about to convert this proposal to a listing. Are you sure you want to do this? </apex:outputPanel> <apex:form > <apex:commandButton action="{!convert}" value="OK" id="OK" rerender="hiddenBlock"/> <apex:commandButton action="{!back}" value="Cancel" id="Cancel" /> </apex:form> <apex:outputPanel layout="block" style="font-weight:bold"></apex:outputPanel> </apex:page>

VF PAGE 2

<apex:page standardController="Proposal__c" extensions="ControllerProposalConvertView"> <apex:outputPanel layout="block" style="font-weight:bold; color:red;"> This proposal has already been converted to a listing. Please click the button below to return to your proposal. </apex:outputPanel> <apex:form > <apex:commandButton action="{!back}" value="Back" id="Cancel"/> </apex:form> </apex:page>

Hope this help for visuals
 

I am currently in the final stages of adding features to a new visualforce page.

I wanted to use the Jquery tooltips to display some help info when someone hovered over it.

This works, but it displays the help text at the bottom of the page as well.

From testing it appears to be showing on, or possibley somehow directly before or after the </apex:page> tag.

Visualforce:
 
<apex:page id="Page" showHeader="false" sidebar="false" standardController="Account" extensions="AccountProductExtension" action="{!ActionAccountProductRun}">
    
    <script src="//code.jquery.com/jquery-1.10.2.js"></script>
    <script src="//code.jquery.com/ui/1.11.4/jquery-ui.js"></script>
    
    <script>
    j$ = jQuery.noConflict();

        j$(function() {
            j$( '[id$=name_col]' ).tooltip({
                tooltipClass: "name",
            });
        });
        
        window.setTimeout(recursivecall,500);
        
        function recursivecall()
        {
          window.setTimeout(recursivecall,500);
          autosave();
        }
        
        function Confirm() {
            if ( confirm("Would you like to set a reminder to check back with the TA of {!Account.Name}?")){
                sendTask();
            }
        }    
    </script>
    
    <style>
        .name{
            display:none;
            background: #80bfff;
            font-size:12px;
            height:20px;
            width:120px;
            border: 2px solid white;
        }
    </style>

    <apex:form id="Form">
    <apex:actionFunction name="sendTask" action="{!sendTask}" reRender="out"/>
    <apex:actionFunction name="autosave" action="{!autosave}" reRender="out"/>
    <apex:pageBlock id="PageBlock" title="Associated Products and Services">
        <apex:pageBlockButtons location="Top">
            
        </apex:pageBlockButtons>
        
        <apex:pageBlockTable value="{!accountProducts}" var="p">
            <apex:column id="name_col" headerValue="Product or Service" value="{!p.name}" title="This is the Help Text!"/>

            <apex:column headerValue="Type" value="{!p.Type__c}"/>
            
            <apex:column headerValue="Status">
                <apex:inputField value="{!p.Status__c}"/>
            </apex:column>
            
            <apex:column headerValue="Date Offered">
                <apex:inputField value="{!p.DateOffered__c}"/>
            </apex:column>
            
            <apex:column headerValue="Check Back On">
                <apex:inputField value="{!p.CheckBackDate__c}">
                    <apex:actionSupport event="onchange" oncomplete="Confirm();" reRender="out">
                        <apex:param name="cDate" value="{!p.CheckBackDate__c}" assignTo="{!checkBackDate}"/>
                        <apex:param name="pName" value="{!JSENCODE(p.name)}" assignTo="{!productName}"/>
                    </apex:actionSupport>
                </apex:inputField>
            </apex:column>
            
            <apex:column headerValue="Notes">
                <apex:inputField value="{!p.Notes__c}"/>
            </apex:column>

        </apex:pageBlockTable>
    </apex:pageBlock>
    </apex:form>
</apex:page>

 
Dear Developer Community,

I am running into Authentication error while setting up the Auth. Providers for Microsoft Access Control Service . I followed every step mentioned in the help article https://help.salesforce.com/HTViewHelpDoc?id=sso_provider_microsoft.htm&language=en_US and created the MicrosoftTranslatorAPIFreeAuth configuration in my Salesforce Developer Org.

The Authorization sequence for Microsoft Translator API is described in the following link https://msdn.microsoft.com/en-us/library/azure/gg193416.aspx#UserConsent. I have already created my account in the Azure Data Market and also published the App to get the client_id and the client_secret.

The error I am getting after the successful login using this URL is "http://ap1.salesforce.com/_nc_external/identity/sso/ui/AuthorizationError?ErrorCode=Remote_Error&ErrorDescription=invalid_permissions&ProviderId=0SO90000000CbEH "

I would appreciate any help to sort out this Authorization error.

Thank you in advance!
  • April 05, 2016
  • Like
  • 0
Dear Flocks,

I have searched the Mobile SDK developer guide but did not find how to display the Lookup and Master-Detail lookup fields in native Android and IOS applications. Can somebody point me to some solution on the same?

Thanks in advance!
  • December 28, 2016
  • Like
  • 0
I created a User Trace Flag for one of my Apex Class with all the specified data such as (​Name    LogType    Requested By    Start Date    Expiration Date    Debug Level Name), but unable to see it under the ​User Trace Flags.

Am I missing anything while creating the Trace Flag?
  • November 20, 2015
  • Like
  • 0
Dear Flocks,

I am facing this issue and created the GitHub ticket on the same. The GitHub link is ​https://github.com/forcedotcom/wsc/issues/117 (https://github.com/forcedotcom/wsc/issues/117).

Thanks in Advance.
  • November 16, 2015
  • Like
  • 0
Dear Community,

Greetings of the day!

I am trying to fetch the metadata component from my developer org using the Eclipse Juno SR2 (4.2), but I am getting the error mentioned in the image below.

Eclipse metadata fetch error

I checked the Eclipse log file also and I saw the following errors mentioned in the log file.

!ENTRY com.salesforce.ide.core 2 0 2015-03-28 21:48:42.914
!MESSAGE  WARN [2015-03-28 21:48:42,914] (ComponentFactory.java:getComponentBean:1154) - Unable to get component for id 'ExternalDataSource': Unable to get bean for id 'ExternalDataSource'


!ENTRY com.salesforce.ide.core 2 0 2015-03-28 21:48:47.510
!MESSAGE  WARN [2015-03-28 21:48:47,510] (ComponentFactory.java:getComponentBean:1154) - Unable to get component for id 'ExternalDataSource': Unable to get bean for id 'ExternalDataSource'


!ENTRY com.salesforce.ide.core 2 0 2015-03-28 21:48:48.650
!MESSAGE  WARN [2015-03-28 21:48:48,650] (ComponentFactory.java:getComponentBean:1154) - Unable to get component for id 'ExternalDataSource': Unable to get bean for id 'ExternalDataSource'


!ENTRY com.salesforce.ide.core 2 0 2015-03-28 21:48:49.270
!MESSAGE  WARN [2015-03-28 21:48:49,270] (ComponentFactory.java:getComponentBean:1154) - Unable to get component for id 'ExternalDataSource': Unable to get bean for id 'ExternalDataSource'


!ENTRY com.salesforce.ide.core 2 0 2015-03-28 21:49:28.600
!MESSAGE  WARN [2015-03-28 21:49:28,600] (ComponentFactory.java:getComponentBean:1154) - Unable to get component for id 'BusinessProcess': Unable to get bean for id 'BusinessProcess'


!ENTRY com.salesforce.ide.core 2 0 2015-03-28 21:49:28.677
!MESSAGE  WARN [2015-03-28 21:49:28,677] (ComponentFactory.java:getComponentBean:1154) - Unable to get component for id 'CompactLayout': Unable to get bean for id 'CompactLayout'


!ENTRY com.salesforce.ide.core 2 0 2015-03-28 21:49:28.727
!MESSAGE  WARN [2015-03-28 21:49:28,727] (ComponentFactory.java:getComponentBean:1154) - Unable to get component for id 'CustomField': Unable to get bean for id 'CustomField'


!ENTRY com.salesforce.ide.core 2 0 2015-03-28 21:49:28.757
!MESSAGE  WARN [2015-03-28 21:49:28,757] (ComponentFactory.java:getComponentBean:1154) - Unable to get component for id 'CustomLabel': Unable to get bean for id 'CustomLabel'


!ENTRY com.salesforce.ide.core 2 0 2015-03-28 21:49:29.367
!MESSAGE  WARN [2015-03-28 21:49:29,367] (ComponentFactory.java:getComponentBean:1154) - Unable to get component for id 'ExternalDataSource': Unable to get bean for id 'ExternalDataSource'


!ENTRY com.salesforce.ide.core 2 0 2015-03-28 21:49:32.021
!MESSAGE  WARN [2015-03-28 21:49:32,021] (ComponentFactory.java:getComponentBean:1154) - Unable to get component for id 'ExternalDataSource': Unable to get bean for id 'ExternalDataSource'


!ENTRY com.salesforce.ide.core 2 0 2015-03-28 21:49:33.226
!MESSAGE  WARN [2015-03-28 21:49:33,226] (ComponentFactory.java:getComponentBean:1154) - Unable to get component for id 'ExternalDataSource': Unable to get bean for id 'ExternalDataSource'


!ENTRY com.salesforce.ide.core 2 0 2015-03-28 21:49:34.359
!MESSAGE  WARN [2015-03-28 21:49:34,359] (ComponentFactory.java:getComponentBean:1154) - Unable to get component for id 'ExternalDataSource': Unable to get bean for id 'ExternalDataSource'


!ENTRY com.salesforce.ide.core 2 0 2015-03-28 21:49:34.389
!MESSAGE  WARN [2015-03-28 21:49:34,379] (ComponentFactory.java:getComponentBean:1154) - Unable to get component for id 'FieldSet': Unable to get bean for id 'FieldSet'


!ENTRY com.salesforce.ide.core 2 0 2015-03-28 21:49:34.519
!MESSAGE  WARN [2015-03-28 21:49:34,519] (ComponentFactory.java:getComponentBean:1154) - Unable to get component for id 'ListView': Unable to get bean for id 'ListView'
----------------------------------------------------
I would really appriciate your kind help to resolve my issue.

With Best Regards,
Prolay
  • March 28, 2015
  • Like
  • 0
Hi,

I created a custom list button using VF page. I tried to add the list button in Page Layout, but the custom List button is not visible as component under Button section of the Page Editor.

I would appriciate any help to resolve my issue.

Thanks,
Prolay

Hi,

I tried to create new apex class in Force.com IDE (standalone), but I got the error of package.xml because this new class is not there in package.xml.

 

I would appreciate any help to resolve this deployment issue through Force.com standalone plugin.

 

Thanks in advance.

Prolay

 

 

Hi,

 

I am getting this error while creating Heroku template application for Force.com from Eclipse Juno.

 

"We have encountered a problem creating your application: cryptic-temple-7724. This could be due to the Eclipse SSH key is not matching the SSH key(s) that is associated with your Heroku account. To fix this error, you can:

 

- Associate your SSH key to your Heroku account by going to "Preferences" ".

 

Any help will be appriciated.

 

Thanks.

Dear Geeks,

 

I am using Force.com IDE - Version: Summer '12 (25.0.0) and Eclipse IDE for Java Developers - Version: Helios Service Release 2 Build id: 20110301-1815.

 

I have created a Force.com project in Eclipse to retrieve all the fields from Standard Object called Campaign. While exploring the salesforce schema, I can see only 31 standard fields of Campaign standard object whereas, in free Developer Edition of salesforce.com, there are 37 standard fields in Campaign Object.

 

What are the Eclipse configuration changes required to see all the standard fields of Campaign Object listed in salesforce Developer Edition?

 

Thanks,

  • September 13, 2012
  • Like
  • 0

Dear All,

 

Salesforce.com Summer'12 release, the Global search "Options.." hyperlink is no more visible before the actual search. That is, until and unless you put some strings (objects, records etc.) in the global search box, "Option.." hyperlink will not appear.

 

In this context, I have also observed that, for any Standard or Custom objects, the field level search is missing. That is, for a given object (Standard or Custom); you can't select the fields which you want to display in your search result.

 

Is this functionality no longer available with current version or my developer organization is missing some configurations?

 

Any pointer on this issue?

 

Thank you in advance.

  • August 03, 2012
  • Like
  • 0
It works fine on my main page but on the embedded page its displaying the css code as text on the output.

Thanks
I have a visualforce page example vf1, that is calling other visualforce page example vf2.I am calling vf1 from Loginflow. when vf2 page content is updated i want to delete some records from custom settings. please let me know if you have any solution.
Hi, i'm using Person Account and i have a problem with my layout in the field Name (Salution, FirstName, LastName) when i'm editing or creating a new Account. How a fix this layout:
Create Account
Edit Account

View Account - OK

Configuration
Greetings,

One of my users has pointed out that the Salesforce authenticator (2fa) page does not auto focus on the entry bar. This should be an easy .focus() edit if I'm correct, though I'm not sure if the authentication page is modifiable to begin with. 

I figure it may be a security concern and thus not available for edit. Otherwise I'm just looking in the wrong places, I'm admittedly not a Visualforce Wiz. 

Anyone have pointers?

Best,
-Damon
Hi All,

Lately, I've seen some JavaScript in vf pages. On the opportunity line item object, I cannot create a lightning component, as lightning actions are not supported. Is it possible to replace a javascript button with just opening a new vf page and using javascript using <script> ??
<li><dl class="Url_Menu"><dt><a href="#!"><span>URL LIST</span></a></dt>
        <apex:repeat var="x" value="{!Objects2}" rendered="{!Objects2!=null && Objects2.size>0}">
          <apex:outputPanel rendered="{!!(x.obj2==null||x.obj2.size=0)}">
          <apex:repeat var="y" value="{!x.obj2}" rendered="{!x.obj2!=null && x.obj2.size>0}">
 
       <!-- This doesnt show the values becasue of dd tag -->   
         <dd><a href="{!y.Url__c}" class="linkTxt">{!y.Name}</a></dd>

                      </apex:repeat>
                    </apex:outputPanel>
                    </apex:repeat>
          
          <dd><a href="#!" class="linkTxt">LInk01</a></dd>
          <dd><a href="#!" class="linkTxt2">LInk01</a></dd>
          </dl>
 </li>
Hi, im new to salesforce vf pages, currenlt trying using the above code and get the Url list values as in the insde HTML <dl> and <dd> tags, but it doens't show, is there any Apex input is missing to show values inside the <dd> tag ? 
I am here working on 'Product2' sObject where I have created a custom field mynamespace__post_id__c. Now with a piece of code, I am trying to update this post id. For a short brief of it please see the code.
productId = '01t0v000003SFQYAA4';
list<Product2> pro = [Select Id, Name, IsActive ,mynamespace__post_parent__r.mynamespace__post_id__c,(Select Id,Pricebook2Id,UnitPrice from PricebookEntries),mynamespace__post_id__c from product2 where Id =:productId];
        string postId = 20; 
        pro[0].mynamespace__post_id__c = Integer.valueOf(wooId.trim());
        try {
              List<Database.SaveResult> updateResults = Database.update(pro, true);
              System.debug(updateResults); // This is giving result as (Database.SaveResult[getErrors=();getId=01t0v000003SFQYAA4;isSuccess=true;])
        } catch (Exception e) {
              System.debug('exception in product update: '+e.getMessage());
        }
Now as the try block is showing isSuccess as true, the object is not getting updated. Also, the log is showing up a FATAL_ERROR. Can anyone help out where am I going wrong  
We are trying to integrate salesforce api in our php code. While authenticating we are passing following data using curl

Post Parameters= Array ( [grant_type] => password [client_id] => xxxxxx[client_secrect] => xxxxx[username] => info@domain.com [password] => xxxxx)

End Points:  https://login.salesforce.com/services/oauth2/token

Once we are calling then we getting the following response: {"error":"unsupported_grant_type","error_description":"grant type not supported"}

Please help us to fix this problem. 
We have a Visualforce tab that users go to and occassionally get "stuck" on at a URL similar to this:

https://cs67.salesforce.com/servlet/servlet.Integration?lid=01r0n000000D6k3&ic=1&linkToken=VmpFPSxNakF4T0Mwd09DMHhNMVF5TURveE5Eb3pNUzR5TnpsYSx3YmJfXzV3ZnVOREVtdXlTcm9ldWFwLFlXWmtNR0po

The Visualforce page ends up not loading. Normally, they'll see this URL for just a second and then get directed to the Visualforce page, for example: https://c.cs67.visual.force.com/apex/sa_testredirect?sfdc.tabName=01r0n000000D6k3

Does anyone know what could cause this? It does not happen consistently, however I have only seen it in Chrome. The Visualforce page also ends up loading correctly if the user refreshes the page. I also haven't tested this with every Visualforce tab we have, but I suspect it's a general issue. I've been able to replicate it both with custom Visualforce pages we've developed and others from managed packages.

Thanks!
<input id="pwd" name="pwd" placeholder="Password" type="password" value="abc123" aria-invalid="false" class="valid">
Password is showing in different places like network preserve log, inspect elements.
this is the situation which i am facing in inspect elements. How to hide the password element or value in DOM elements. Please help me in this
Can any one help me out.How to call the Lead conversion in a test class?The test code coverage value is showing less.In our org we have a trigger written and the test class,but the code coverage value is displaying only 41% .Any suggestion please.
Trigger :
public class CampaignMemberFunctions {
 public static void UpdateNewToEnterpriseDB(CampaignMember cm, Lead ld)
    {
if(ld.CreatedDate.addHours(6) > DateTime.Now()) 
 cm.New_to_EnterpriseDB__c = true;
    }
public static Boolean SyncStatus(CampaignMember cm, Lead ld, Contact ct, Map<String, CMStatusSettings__c> statusmap)
    {
     Boolean result = true;
     String newvalue;
     if(ct!= null)
        {
            if(statusmap.containsKey(cm.Response_Status__c))
            {
                newvalue = statusmap.get(cm.Response_Status__c).StatusMapping__c;
                if(newvalue == ct.Status__c)
                {
                    result = false;
                }
                else
                {
                    ct.Status__c = newvalue;
                }
            } else if(cm.Response_Status__c == 'Disqualified' || 
                        cm.Response_Status__c == 'Qualified - New Opportunity' ||
                        cm.Response_Status__c == 'Closed - Converted' )
            {
                newvalue = 'Closed - ' + ct.Account.Customer_Status__c + ' Account';
                if(ct.Status__c == newvalue)
                {
                    result = false;
                }
                else
                {
                    ct.Status__c = newvalue;
                }
                if(cm.Response_Status__c == 'Disqualified')
                {   // Set nuture time on disqualified status
                    Date newtimeout = Date.today().addDays((CMScoreEngine__c.getInstance('Default').NurtureTimeoutDays__c).intValue());
                    if(ct.Admin_Nurture_Timeout__c != newtimeout || ct.Lead_Score__c !=0 || ct.Campaign_Score__c !=0) result = true;
                    ct.Admin_Nurture_Timeout__c = newtimeout;
                    ct.Lead_Score__c = 0; 
                    ct.Campaign_Score__c = 0;   // Probably aren't using this one
                }
            } else
            {
                result = false;
            } 
 }

        else if(ld!=null)
        {
            if(statusmap.containsKey(cm.Response_Status__c))
            {
                newvalue = statusmap.get(cm.Response_Status__c).StatusMapping__c;
                if(newvalue==ld.Status)
                {
                    result = false;
                }
                else
                {
                    ld.Status = newvalue;
                }
            } else if(cm.Response_Status__c == 'Disqualified')
            {
                if(ld.Status=='Disqualified' && ld.Disqaulified_Reason__c == cm.Disqualified_Reason__c)
                {
                    result = false;
                }
                else
                {
                    ld.Status = 'Disqualified';
                    ld.Disqaulified_Reason__c = cm.Disqualified_Reason__c;
                    System.Debug('Disqualified reason being set to: ' + cm.Disqualified_Reason__c);
                }
            } else
            {
                result = false;
            }
 } 
        return(result);

    }

    // Search through the converted leads, opportunities and campaignmembers to sync if necessary
    public static void SyncAfterConversion(Map<Id,Lead> convertedleads, Map<Id, Opportunity>convertedops, Map<Id, CampaignMember> possiblecms) 
    {
        for(Lead ld: convertedleads.values())
        {
            // Grab the campaign member - this must be correct by original query
             CampaignMember cm = new CampaignMember();

             System.debug('@@@@@possiblecms.get(ld.admin_CMSourceId__c)'+possiblecms.get(ld.admin_CMSourceId__c));
             cm = possiblecms.get(ld.admin_CMSourceId__c);
             System.debug('@@@@@cm '+cm );
           if(cm!=null)
           {  
            // We know this lead is converted. Let's get the opportunity.             
            if(ld.ConvertedOpportunityId != null)
            {
                Opportunity opp = convertedops.get(ld.ConvertedOpportunityId);
                opp.PMM_stage__c = cm.PMM_Stage__c;
                opp.Product_Interest__c = cm.Product_Interest__c;
                opp.Buyer__c = cm.Buyer__c;
                opp.New_to_EnterpriseDB__c = cm.New_to_EnterpriseDB__c;
                opp.Problem_to_Solve__c = cm.Problem_to_Solve__c;
                opp.Any_OSS_in_current_stack__c = cm.Any_OSS_in_current_stack__c;
                opp.Total_of_Databases_in_your_Org__c = cm.Total_of_Databases_in_your_Org__c;
                opp.Primary_Database__c = cm.Primary_Database__c;
                opp.of_Postgres_Database_Servers__c = cm.of_Postgres_Database_Servers__c;
                opp.Just_learning_about_EnterpriseDB__c = cm.Just_learning_about_EnterpriseDB__c;
                opp.Project_Requires_a_Net_New_DB__c = cm.Project_Requires_a_Net_New_DB__c;
                opp.Timeframe_To_Production__c = cm.Timeframe_To_Production__c;
                opp.Budget__c = cm.Budget__c;
                opp.User__c = cm.User__c;
                opp.Champion__c = cm.Champion__c;
                opp.Decision_Maker__c = cm.Decision_Maker__c;
                cm.Response_Status__c = 'Qualified - New Opportunity';
                cm.Opportunity_Name__c = opp.Id;
                cm.Opportunity_Create_Date__c = Date.Today();
            }

            else
            {                          
                if(cm.lead.status!=null)
                 {
                    cm.Response_Status__c = cm.lead.status;
                 }
            }
            cm.admin_IsConverted__c = true; 
          }           
        }   

    }

    public static void EmailErrorMessage(String message)
    {
        Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage();
        mail.setToAddresses(new String[] {'edbnotify@bearcavern.com', 'roanbear@gmail.com'});
        mail.setSenderDisplayName('APEX notifier');
        mail.setSubject('SFDC/Eloqua Data Creation Error');
        mail.setPlainTextBody(message);
        List<Messaging.SendEmailResult> results = Messaging.sendEmail(new Messaging.SingleEmailMessage[] { mail });
        for(Messaging.SendEmailResult r: results)
        {
            System.debug('Result of Email sent ' + r.isSuccess());
            if(!r.isSuccess())
            {
                for(Messaging.SendEmailError sme: r.getErrors())
                {
                    for(String s: sme.getFields())  System.Debug('Error for field ' + s );      
                    System.Debug('Error message ' + sme.getMessage());
                    System.Debug('StatusCode ' + sme.getStatusCode());
                }}}}}
Test Class Written :
@isTest(seealldata=true)
Public class TestCampaignMemberFunctions {

   //Checking for if Condition value Response_Status__c= Disqualified 
    Public static testMethod void TestCreationDate() {
        
        Lead ld2 = [select ID, CreatedDate, IsConverted from LEAD where CreatedDate < :DateTime.Now().addHours(-7) and IsConverted=False  LIMIT 1];
        Campaign cam = new Campaign(Name='campname');      
        insert cam;       
        Account a = new Account();
        a.Name ='My Company';
        Insert a;                   
        
        Lead ld = new Lead();
        ld.Company='colead1';  
        ld.LastName ='colead1_'+String.valueOf(System.now());
        ld.status= 'Disqualified';        
        ld.admin_CMSourceId__c= cam.Id;
        ld.Disqaulified_Reason__c='Disqualified';              
        insert ld;
        
        Contact con = new Contact(LastName ='Test');        
        Insert con;               
        Test.StartTest();
        CampaignMember mc1 = new CampaignMember(CampaignId = cam.Id,Product_Interest__c='Services',Response_Status__c='Disqualified',status= 'Junk',PMM_Stage__c='Learns of Postgres', LeadId=ld.Id);
        CampaignMember mc2 = new CampaignMember(CampaignId = cam.Id, LeadId=ld2.Id);
        insert mc1;
        insert mc2; 
        Opportunity opp =new Opportunity();
        opp.Product_Interest__c='Services';
       
        opp.PMM_stage__c ='Deployment';
        opp.Buyer__c = 'xyz';
        opp.New_to_EnterpriseDB__c =True;
        opp.Problem_to_Solve__c ='Performance' ;
        opp.Any_OSS_in_current_stack__c ='OS' ;
        opp.Total_of_Databases_in_your_Org__c ='500';
        opp.Primary_Database__c =mc1.Primary_Database__c;
        opp.of_Postgres_Database_Servers__c = mc1.of_Postgres_Database_Servers__c;
        opp.Just_learning_about_EnterpriseDB__c = mc1.Just_learning_about_EnterpriseDB__c;
        opp.Project_Requires_a_Net_New_DB__c = mc1.Project_Requires_a_Net_New_DB__c;
        opp.Timeframe_To_Production__c = mc1.Timeframe_To_Production__c;
        opp.Budget__c = mc1.Budget__c;
        opp.User__c = mc1.User__c;
        opp.Champion__c = mc1.Champion__c;
        opp.Decision_Maker__c =mc1.Decision_Maker__c;
                
        opp.Name='Testing';
        opp.StageName='Closed Lost';
        opp.CloseDate=System.today(); 
        Insert opp;       
        CampaignMember mc1res = [Select Id, New_to_EnterpriseDB__c,Response_Status__c from CampaignMember where Id = :mc1.id ];
        CampaignMember mc2res = [Select Id, New_to_EnterpriseDB__c from CampaignMember where Id = :mc2.id ];        
        System.assert(mc1res.New_to_EnterpriseDB__c);
        System.assert(! mc2res.New_to_EnterpriseDB__c);
        
        Map<String, CMStatusSettings__c> statusmap = new Map<String, CMStatusSettings__c>();
       // statusmap.put(mc1res.Response_Status__c, custSetting);
                  
        Map<Id,Lead> convertedleads = new Map<Id,Lead>();                   
        convertedleads.put(ld.Id,ld);
        
        Map<Id, Opportunity> convertedops= new Map<Id, Opportunity>();        
        convertedops.put(opp.Id,opp);
          
        Map<Id, CampaignMember> possiblecms= new Map<Id, CampaignMember>();        
        possiblecms.put(mc1.Id,mc1);                                 
        CampaignMemberFunctions  cmf = new CampaignMemberFunctions();
        CampaignMemberFunctions.SyncStatus( mc1res,ld,con,statusmap);
        System.debug('@@@@@convertedleads'+convertedleads);
        System.debug('@@@@@possiblecms'+possiblecms);
        System.debug('@@@@@convertedops'+convertedops);
                
        CampaignMemberFunctions.SyncAfterConversion(convertedleads,convertedops,possiblecms);
        CampaignMemberFunctions.EmailErrorMessage('testmessage');     
        Test.StopTest();    
        }
        //Checking for if Condition value Response_Status__c= Qualified - New Opportunity
        Public static testMethod void TestCreationDate1() {
        
        Lead ld2 = [select ID, CreatedDate, IsConverted from LEAD where CreatedDate < :DateTime.Now().addHours(-7) and IsConverted=False  LIMIT 1];
        Campaign cam = new Campaign(Name='campname');      
        insert cam;       
        Account a = new Account();
        a.Name ='My Company';
        Insert a;                   
        
        Lead ld = new Lead();
        ld.Company='colead1';  
        ld.LastName ='colead1_'+String.valueOf(System.now());
        ld.status= 'Qualified - New Opportunity';        
        ld.admin_CMSourceId__c= cam.Id; 
        ld.Disqaulified_Reason__c='Qualified - New Opportunity';               
        insert ld;
        
        Contact con = new Contact(LastName ='Test');        
        Insert con;               
        Test.StartTest();
        CampaignMember mc1 = new CampaignMember(CampaignId = cam.Id,Product_Interest__c='Services',Response_Status__c='Qualified - New Opportunity',status= 'Junk', LeadId=ld.Id);
        CampaignMember mc2 = new CampaignMember(CampaignId = cam.Id, LeadId=ld2.Id);
        insert mc1;
        insert mc2; 
        Opportunity opp =new Opportunity();
        opp.Product_Interest__c=mc1.Product_Interest__c;
       
        opp.PMM_stage__c = mc1.PMM_Stage__c;
        opp.Buyer__c = mc1.Buyer__c;
        opp.New_to_EnterpriseDB__c =mc1.New_to_EnterpriseDB__c;
        opp.Problem_to_Solve__c = mc1.Problem_to_Solve__c;
        opp.Any_OSS_in_current_stack__c = mc1.Any_OSS_in_current_stack__c;
        opp.Total_of_Databases_in_your_Org__c = mc1.Total_of_Databases_in_your_Org__c;
        opp.Primary_Database__c =mc1.Primary_Database__c;
        opp.of_Postgres_Database_Servers__c = mc1.of_Postgres_Database_Servers__c;
        opp.Just_learning_about_EnterpriseDB__c = mc1.Just_learning_about_EnterpriseDB__c;
        opp.Project_Requires_a_Net_New_DB__c = mc1.Project_Requires_a_Net_New_DB__c;
        opp.Timeframe_To_Production__c = mc1.Timeframe_To_Production__c;
        opp.Budget__c = mc1.Budget__c;
        opp.User__c = mc1.User__c;
        opp.Champion__c = mc1.Champion__c;
        opp.Decision_Maker__c =mc1.Decision_Maker__c;
                
        opp.Name='Testing';
        opp.StageName='Closed Lost';
        opp.CloseDate=System.today(); 
        Insert opp;       
        CampaignMember mc1res = [Select Id, New_to_EnterpriseDB__c,Response_Status__c from CampaignMember where Id = :mc1.id ];
        CampaignMember mc2res = [Select Id, New_to_EnterpriseDB__c from CampaignMember where Id = :mc2.id ];        
        System.assert(mc1res.New_to_EnterpriseDB__c);
        System.assert(! mc2res.New_to_EnterpriseDB__c);
        
        Map<String, CMStatusSettings__c> statusmap = new Map<String, CMStatusSettings__c>();
        //statusmap.put(mc1res.Response_Status__c, custSetting);
                  
        Map<Id,Lead> convertedleads = new Map<Id,Lead>();                   
        convertedleads.put(ld.Id,ld);
        
        Map<Id, Opportunity> convertedops= new Map<Id, Opportunity>();        
        convertedops.put(opp.Id,opp);
          
        Map<Id, CampaignMember> possiblecms= new Map<Id, CampaignMember>();        
        possiblecms.put(mc1.Id,mc1);                                 
        CampaignMemberFunctions  cmf = new CampaignMemberFunctions();
        CampaignMemberFunctions.SyncStatus( mc1res,ld,con,statusmap);
        System.debug('@@@@@convertedleads'+convertedleads);
        System.debug('@@@@@possiblecms'+possiblecms);
        System.debug('@@@@@convertedops'+convertedops);
                
        CampaignMemberFunctions.SyncAfterConversion(convertedleads,convertedops,possiblecms);
        CampaignMemberFunctions.EmailErrorMessage('testmessage');     
        Test.StopTest();    
        } 
          //Checking for if Condition value Response_Status__c= Closed - Converted 
        Public static testMethod void TestCreationDate2() {
        
        Lead ld2 = [select ID, CreatedDate, IsConverted from LEAD where CreatedDate < :DateTime.Now().addHours(-7) and IsConverted=False  LIMIT 1];
        Campaign cam = new Campaign(Name='campname');      
        insert cam;       
        Account a = new Account();
        a.Name ='My Company';
        Insert a;                   
        
        Lead ld = new Lead();
        ld.Company='colead1';  
        ld.LastName ='colead1_'+String.valueOf(System.now());
        ld.status= 'Closed - Converted';        
        ld.admin_CMSourceId__c= cam.Id;
        ld.Disqaulified_Reason__c='Closed - Converted';              
        insert ld;
        
        Contact con = new Contact(LastName ='Test');        
        Insert con;               
        Test.StartTest();
        CampaignMember mc1 = new CampaignMember(CampaignId = cam.Id,Product_Interest__c='Services',Response_Status__c='Closed - Converted',status= 'Closed - Converted', LeadId=ld.Id);
        CampaignMember mc2 = new CampaignMember(CampaignId = cam.Id, LeadId=ld2.Id);
        insert mc1;
        insert mc2; 
        Opportunity opp =new Opportunity();
        opp.Product_Interest__c=mc1.Product_Interest__c;
       
        opp.PMM_stage__c = mc1.PMM_Stage__c;
        opp.Buyer__c = mc1.Buyer__c;
        opp.New_to_EnterpriseDB__c =mc1.New_to_EnterpriseDB__c;
        opp.Problem_to_Solve__c = mc1.Problem_to_Solve__c;
        opp.Any_OSS_in_current_stack__c = mc1.Any_OSS_in_current_stack__c;
        opp.Total_of_Databases_in_your_Org__c = mc1.Total_of_Databases_in_your_Org__c;
        opp.Primary_Database__c =mc1.Primary_Database__c;
        opp.of_Postgres_Database_Servers__c = mc1.of_Postgres_Database_Servers__c;
        opp.Just_learning_about_EnterpriseDB__c = mc1.Just_learning_about_EnterpriseDB__c;
        opp.Project_Requires_a_Net_New_DB__c = mc1.Project_Requires_a_Net_New_DB__c;
        opp.Timeframe_To_Production__c = mc1.Timeframe_To_Production__c;
        opp.Budget__c = mc1.Budget__c;
        opp.User__c = mc1.User__c;
        opp.Champion__c = mc1.Champion__c;
        opp.Decision_Maker__c =mc1.Decision_Maker__c;
                
        opp.Name='Testing';
        opp.StageName='Closed Lost';
        opp.CloseDate=System.today(); 
        Insert opp;       
        CampaignMember mc1res = [Select Id, New_to_EnterpriseDB__c,Response_Status__c from CampaignMember where Id = :mc1.id ];
        CampaignMember mc2res = [Select Id, New_to_EnterpriseDB__c from CampaignMember where Id = :mc2.id ];        
        System.assert(mc1res.New_to_EnterpriseDB__c);
        System.assert(! mc2res.New_to_EnterpriseDB__c);
        
        Map<String, CMStatusSettings__c> statusmap = new Map<String, CMStatusSettings__c>();
        //statusmap.put(mc1res.Response_Status__c, custSetting);
                  
        Map<Id,Lead> convertedleads = new Map<Id,Lead>();                   
        convertedleads.put(ld.Id,ld);
        
        Map<Id, Opportunity> convertedops= new Map<Id, Opportunity>();        
        convertedops.put(opp.Id,opp);
          
        Map<Id, CampaignMember> possiblecms= new Map<Id, CampaignMember>();        
        possiblecms.put(mc1.Id,mc1);                                 
        CampaignMemberFunctions  cmf = new CampaignMemberFunctions();
        CampaignMemberFunctions.SyncStatus( mc1res,ld,con,statusmap);
        System.debug('@@@@@convertedleads'+convertedleads);
        System.debug('@@@@@possiblecms'+possiblecms);
        System.debug('@@@@@convertedops'+convertedops);
                
        CampaignMemberFunctions.SyncAfterConversion(convertedleads,convertedops,possiblecms);
        CampaignMemberFunctions.EmailErrorMessage('testmessage');     
        Test.StopTest();    
        } 
        
        //Checking for if Condition value CMStatusSettings__c 
       Public static testMethod void TestCreationDate3() {
        
        Lead ld2 = [select ID, CreatedDate, IsConverted from LEAD where CreatedDate < :DateTime.Now().addHours(-7) and IsConverted=False  LIMIT 1];
        Campaign cam = new Campaign(Name='campname');      
        insert cam;       
        Account a = new Account();
        a.Name ='My Company';
        Insert a;                   
        
        Lead ld = new Lead();
        ld.Company='colead1';  
        ld.LastName ='colead1_'+String.valueOf(System.now());
        ld.status= 'newvalue';        
        ld.admin_CMSourceId__c= cam.Id;
        ld.Disqaulified_Reason__c='Junk';
        ld.ConvertedOpportunityId=ld.Id; 
        insert ld;
        
        Contact con = new Contact(LastName ='Test');        
        Insert con;               
        Test.StartTest();
        CampaignMember mc1 = new CampaignMember(CampaignId = cam.Id,Product_Interest__c='Services',Response_Status__c='Disqualified',status= 'Junk',PMM_Stage__c='Learns of Postgres', LeadId=ld.Id);
        CampaignMember mc2 = new CampaignMember(CampaignId = cam.Id, LeadId=ld2.Id);
        insert mc1;
        insert mc2; 
        Opportunity opp =new Opportunity();
        opp.Product_Interest__c=mc1.Product_Interest__c;
       
        opp.PMM_stage__c = mc1.PMM_Stage__c;
        opp.Buyer__c = mc1.Buyer__c;
        opp.New_to_EnterpriseDB__c =mc1.New_to_EnterpriseDB__c;
        opp.Problem_to_Solve__c = mc1.Problem_to_Solve__c;
        opp.Any_OSS_in_current_stack__c = mc1.Any_OSS_in_current_stack__c;
        opp.Total_of_Databases_in_your_Org__c = mc1.Total_of_Databases_in_your_Org__c;
        opp.Primary_Database__c =mc1.Primary_Database__c;
        opp.of_Postgres_Database_Servers__c = mc1.of_Postgres_Database_Servers__c;
        opp.Just_learning_about_EnterpriseDB__c = mc1.Just_learning_about_EnterpriseDB__c;
        opp.Project_Requires_a_Net_New_DB__c = mc1.Project_Requires_a_Net_New_DB__c;
        opp.Timeframe_To_Production__c = mc1.Timeframe_To_Production__c;
        opp.Budget__c = mc1.Budget__c;
        opp.User__c = mc1.User__c;
        opp.Champion__c = mc1.Champion__c;
        opp.Decision_Maker__c =mc1.Decision_Maker__c;
                
        opp.Name='Testing';
        opp.StageName='Closed Lost';
        opp.CloseDate=System.today(); 
        Insert opp;       
        CampaignMember mc1res = [Select Id, New_to_EnterpriseDB__c,Response_Status__c from CampaignMember where Id = :mc1.id ];
        CampaignMember mc2res = [Select Id, New_to_EnterpriseDB__c from CampaignMember where Id = :mc2.id ];        
        System.assert(mc1res.New_to_EnterpriseDB__c);
        System.assert(! mc2res.New_to_EnterpriseDB__c);
        
        CMStatusSettings__c custSetting =new CMStatusSettings__c();
        custSetting.Name= 'Test';
        insert custSetting;
       // statusmap.put(mc1res.Response_Status__c, custSetting);
        
        Map<String, CMStatusSettings__c> statusmap = new Map<String, CMStatusSettings__c>();
        statusmap.put(mc1res.Response_Status__c, custSetting);
                  
        Map<Id,Lead> convertedleads = new Map<Id,Lead>();                   
        convertedleads.put(ld.Id,ld);
        
        Map<Id, Opportunity> convertedops= new Map<Id, Opportunity>();        
        convertedops.put(opp.Id,opp);
          
        Map<Id, CampaignMember> possiblecms= new Map<Id, CampaignMember>();        
        possiblecms.put(mc1.Id,mc1);                                 
        CampaignMemberFunctions  cmf = new CampaignMemberFunctions();
        CampaignMemberFunctions.SyncStatus( mc1res,ld,con,statusmap);
        System.debug('@@@@@convertedleads'+convertedleads);
        System.debug('@@@@@possiblecms'+possiblecms);
        System.debug('@@@@@convertedops'+convertedops);
                
        CampaignMemberFunctions.SyncAfterConversion(convertedleads,convertedops,possiblecms);
        CampaignMemberFunctions.EmailErrorMessage('testmessage');     
        Test.StopTest();    
        } 
           //Checking for if Condition value LeadConvertion.
         Public static testMethod void TestCreationDate4() {
        
        Lead ld2 = [select ID, CreatedDate, IsConverted from LEAD where CreatedDate < :DateTime.Now().addHours(-7) and IsConverted=False  LIMIT 1];
        Campaign cam = new Campaign(Name='campname');      
        insert cam;       
        Account a = new Account();
        a.Name ='My Company';
        Insert a;                   
        
        Lead ld = new Lead();
        ld.Company='colead1';  
        ld.LastName ='colead1_'+String.valueOf(System.now());
       // ld.status= ' Qualified - Legacy';        
        ld.admin_CMSourceId__c= cam.Id;
        ld.Disqaulified_Reason__c='Junk';
        ld.ConvertedOpportunityId=ld.Id; 
        insert ld;
        
        Contact con = new Contact(LastName ='Test');        
        Insert con;               
        Test.StartTest();
        CampaignMember mc1 = new CampaignMember(CampaignId = cam.Id,Product_Interest__c='Services',Response_Status__c='Disqualified',status= 'Junk',PMM_Stage__c='Learns of Postgres', LeadId=ld.Id);
        CampaignMember mc2 = new CampaignMember(CampaignId = cam.Id, LeadId=ld2.Id);
        insert mc1;
        insert mc2; 
        Opportunity opp =new Opportunity();
        opp.Product_Interest__c=mc1.Product_Interest__c;
       
        opp.PMM_stage__c = mc1.PMM_Stage__c;
        opp.Buyer__c = mc1.Buyer__c;
        opp.New_to_EnterpriseDB__c =mc1.New_to_EnterpriseDB__c;
        opp.Problem_to_Solve__c = mc1.Problem_to_Solve__c;
        opp.Any_OSS_in_current_stack__c = mc1.Any_OSS_in_current_stack__c;
        opp.Total_of_Databases_in_your_Org__c = mc1.Total_of_Databases_in_your_Org__c;
        opp.Primary_Database__c =mc1.Primary_Database__c;
        opp.of_Postgres_Database_Servers__c = mc1.of_Postgres_Database_Servers__c;
        opp.Just_learning_about_EnterpriseDB__c = mc1.Just_learning_about_EnterpriseDB__c;
        opp.Project_Requires_a_Net_New_DB__c = mc1.Project_Requires_a_Net_New_DB__c;
        opp.Timeframe_To_Production__c = mc1.Timeframe_To_Production__c;
        opp.Budget__c = mc1.Budget__c;
        opp.User__c = mc1.User__c;
        opp.Champion__c = mc1.Champion__c;
        opp.Decision_Maker__c =mc1.Decision_Maker__c;
                
        opp.Name='Testing';
        opp.StageName='Closed Lost';
        opp.CloseDate=System.today(); 
        Insert opp;       
        CampaignMember mc1res = [Select Id, New_to_EnterpriseDB__c,Response_Status__c from CampaignMember where Id = :mc1.id ];
        CampaignMember mc2res = [Select Id, New_to_EnterpriseDB__c from CampaignMember where Id = :mc2.id ];        
        System.assert(mc1res.New_to_EnterpriseDB__c);
        System.assert(! mc2res.New_to_EnterpriseDB__c);
        
        Map<String, CMStatusSettings__c> statusmap = new Map<String, CMStatusSettings__c>();
       // statusmap.put(mc1res.Response_Status__c, custSetting);
                  
        Map<Id,Lead> convertedleads = new Map<Id,Lead>(); 
         // START Convert the Lead into Test Class
        Database.LeadConvert lc = new Database.LeadConvert();
        lc.setLeadId(ld.Id);
        lc.setOpportunityName('Testing'); 
        LeadStatus convertStatus = [SELECT Id, MasterLabel FROM LeadStatus WHERE IsConverted=true LIMIT 1];
        lc.setConvertedStatus(convertStatus.MasterLabel);
        Database.LeadConvertResult lcr = Database.convertLead(lc); 
        System.assert(lcr.isSuccess()); 
        convertedleads.put(ld.Id,ld);                  
        //convertedleads.put(ld.Id,ld);
        
        Map<Id, Opportunity> convertedops= new Map<Id, Opportunity>();        
        convertedops.put(opp.Id,opp);
          
        Map<Id, CampaignMember> possiblecms= new Map<Id, CampaignMember>();        
        possiblecms.put(mc1.Id,mc1);                                 
        CampaignMemberFunctions  cmf = new CampaignMemberFunctions();
        CampaignMemberFunctions.SyncStatus( mc1res,ld,con,statusmap);
        System.debug('@@@@@convertedleads'+convertedleads);
        System.debug('@@@@@possiblecms'+possiblecms);
        System.debug('@@@@@convertedops'+convertedops);
                
        CampaignMemberFunctions.SyncAfterConversion(convertedleads,convertedops,possiblecms);
        CampaignMemberFunctions.EmailErrorMessage('testmessage');     
        Test.StopTest();    
        } 
                        
}
The System throws an Error when i use Lead Convert.
The method is getting failed when i use the lead conversion.Im not setting the values manually,the system is throwing the error 

System.DmlException: ConvertLead failed. First exception on row 0; first error: INVALID_STATUS, invalid convertedStatus: QualifiedLegacy[Status],

Class.TestCampaignMemberFunctions.TestCreationDate4: line 392, column 1,the line is Database.LeadConvertResult lcr = Database.convertLead(lc);
The opportunity fields are not getting covered.Any help very much appreciated.


 
Hiya,


In my custom APEX REST endpoint, I want to have the exact same pagination as the SFDC REST API.
Is there an easier way to achieve this than implementing the logic from scratch? I would love to just extend abstract base class that holds all this logic and is used by the SFDC REST API as well. Or something similarly convenient, that doesn't involve me re-inventing the wheel.


Thanks in advance,
Peter

Today we’re excited to announce the new Salesforce Developers Discussion Forums. We’ve listened to your feedback on how we can improve the forums.  With Chatter Answers, built on the Salesforce1 Platform, we were able to implement an entirely new experience, integrated with the rest of the Salesforce Developers site.  By the way, it’s also mobile-friendly.

We’ve migrated all the existing data, including user accounts. You can use the same Salesforce account you’ve always used to login right away.  You’ll also have a great new user profile page that will highlight your community activity.  Kudos have been replaced by “liking” a post instead and you’ll now be able to filter solved vs unsolved posts.

This is, of course, only the beginning  and because it’s built on the Salesforce1 Platform, we’re going to be able to bring you more features faster than ever before.  Be sure to share any feedback, ideas, or questions you have on this forum post.

Hats off to our development team who has been working tirelessly over the past few months to bring this new experience to our community. And thanks to each of you for helping to build one of the most vibrant and collaborative developer communities ever.
 

When someone takes the time/effort to repspond to your question, you should take the time/effort to either mark the question as "Solved", or post a Follow-Up with addtional information.  

 

That way people with a similar question can find the Solution without having to re-post the same question again and again. And the people who reply to your post know that the issue has been resolved and they can stop working on it.