• Bablu Kumar Pandit
  • NEWBIE
  • 95 Points
  • Member since 2019
  • Developer
  • 360 Degree Cloud Technology pvt Ltd.

  • Chatter
    Feed
  • 1
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 35
    Questions
  • 30
    Replies
Hi, I am trying to write a batch class which will delete the opportunities whose CloseDate is last month and update checkbox in related account.

//Batch Class

global class DeleteOppsBatch implements Database.Batchable<SObject> {
    List<Account> newList = new List<Account>();
    global Database.QueryLocator start (Database.BatchableContext BC) {
        return Database.getQueryLocator([Select Id, DeletedOpp__c, (SELECT Id, CloseDate FROM Opportunities WHERE CloseDate = LAST_N_DAYS:30) FROM Account]);
    }
    global void execute(Database.BatchableContext BC, List<Account> accList) {
        for(Account acc : accList) {
            acc.DeletedOpp__c = TRUE;
            newList.add(acc);
        }
        //update newList;
    }
    global void finish(Database.BatchableContext BC) {
        System.debug('listsize:'+newList.size());
        delete newList;
    }
}

I didn't understand why this class is not working. Can someone help me achieve this functionality.

Thanks in advance.
Hello Every One,
I want to know that after live the app on app Exchange then what are the things that we can restrict Like Code May be Globel ,what are the things that we can not chnaged on page level(Vf/Lightning page),Code level.
 
My Handler Class
public class EventTriggerHandler {
	public static void addSubject(List<Event> lstevent){
		Set<Id> setOfConId = new Set<Id>();
        Set<Id> setOfEventid = New Set<Id>();
        List<Event>lstUpadteEvent = new List<Event>();
        Map<Id,Contact> MapOfIdToCon = New Map<id,contact>();
        for(Event objevent : lstevent){
                if(objevent.WhoId != null && objevent.WhoId.getSObjectType().getDescribe().getName() == 'Contact' && objevent.Subject == null && (objevent.Type__c == 'Candidate Meeting (Internal Interview)' || objevent.Type__c == 'Candidate Meeting (Interview Debrief)' || objevent.Type__c == '	Candidate Meeting (Other)' || objevent.Type__c == 'Client Interview (Direct Hire)' || objevent.type__c == 'Client Meeting (Intake)' || objevent.type__c == 'Client Meeting (Interview Debrief)' || objevent.type__c == 'Client Meeting (Other)' || objevent.type__c == 'Client Meeting (PEM)' || objevent.type__c == 'Client Meeting (Prospecting)' || objevent.type__c == 'Internal Meeting' || objevent.type__c == 'Networking Event' || objevent.type__c == 'Partner/Referral Meeting' || objevent.type__c == 'Vendor Meeting' || objevent.type__c == 'Vendor Prospect Meeting')){
                    setOfConId.add(objevent.WhoId);
                    setOfEventid.add(objevent.Id);
                }
         }
         System.debug('<---setOfEventid--->'+setOfEventid);
         System.debug('<---setOfConId---->'+setOfConId);
         for(Contact objConatct : [Select Id,Name,Current_Title__c,Current_Company__c,Account.Name from Contact where Id IN:setOfConId]){
            if(objConatct.Name != null || objConatct.Current_Title__c != null || objConatct.Current_Company__c != null || objConatct.Account.Name != null){
                 MapOfIdToCon.put(objConatct.id, objConatct);
            }
         }
         System.debug('<---MapOfIdToCon--->'+MapOfIdToCon);
        for(Event objevent : [Select Id,WhoId,Owner.Name,Subject,Type__c from Event where Id IN:setOfEventid]){
            if(MapOfIdToCon.containsKey(objevent.WhoId) && (objevent.Type__c == 'Candidate Meeting (Internal Interview)' || objevent.Type__c == 'Candidate Meeting (Interview Debrief)' || objevent.Type__c == 'Candidate Meeting (Other)')){
                objevent.Subject = (MapOfIdToCon.get(objevent.WhoId).Name == null ? ' ' : MapOfIdToCon.get(objevent.WhoId).Name)+','+ +(MapOfIdToCon.get(objevent.whoId).Current_Title__c == null ? ' ' : MapOfIdToCon.get(objevent.whoId).Current_Title__c)+','+' '+(MapOfIdToCon.get(objevent.WhoId).Current_Company__c == null ? ' ' : (MapOfIdToCon.get(objevent.WhoId).Current_Company__c))+' '+'&'+' '+(objevent.Owner.Name == null ? ' ' :objevent.Owner.Name)+','+' '+(objevent.Type__c == null ? ' ' :objevent.Type__c); 
    			System.debug('<---subject-->'+objevent.Subject);
                lstUpadteEvent.add(objevent);
            }
            else if(MapOfIdToCon.containsKey(objevent.WhoId) && (objevent.Type__c == 'Client Interview (Direct Hire)' || objevent.type__c == 'Client Meeting (Intake)' || objevent.type__c == 'Client Meeting (Interview Debrief)' || objevent.type__c == 'Client Meeting (Other)' || objevent.type__c == 'Client Meeting (PEM)' || objevent.type__c == 'Client Meeting (Prospecting)' || objevent.type__c == 'Internal Meeting' || objevent.type__c == 'Networking Event' || objevent.type__c == 'Partner/Referral Meeting' || objevent.type__c == 'Vendor Meeting' || objevent.type__c == 'Vendor Prospect Meeting')){
                    objevent.Subject = objevent.Subject = (MapOfIdToCon.get(objevent.WhoId).Name == null ? ' ' : MapOfIdToCon.get(objevent.WhoId).Name)+','+ +(MapOfIdToCon.get(objevent.whoId).Current_Title__c == null ? ' ' : MapOfIdToCon.get(objevent.whoId).Current_Title__c)+','+' '+(MapOfIdToCon.get(objevent.WhoId).Account.Name == null ? ' ' : (MapOfIdToCon.get(objevent.WhoId).Account.Name))+' '+'&'+' '+(objevent.Owner.Name == null ? ' ' :objevent.Owner.Name)+','+' '+(objevent.Type__c == null ? ' ' :objevent.Type__c); 
					System.debug('<---subject-->'+objevent.Subject);
					lstUpadteEvent.add(objevent);
            }
        }
        //Event Before update
        System.debug('<--Before lstUpadteEvent--->'+lstUpadteEvent);
        if(lstUpadteEvent.size() > 0){
            update lstUpadteEvent;
        }
        //Event After Update
        System.debug('<---After lstUpadteEvent---->'+lstUpadteEvent);
	} 
}

My test Class
@isTest
public class EventTriggerhandlerTest {
    Static testmethod void Method1(){
        //Insertion of Account
        Account objacc				 		= New Account();
        objacc.Name					 		= 'test';
        objacc.Company_Allocation__c 		= 'New';
        objacc.Type__c 				 		= 'Client';
        objacc.Market__c 			 		= 'Boston';
        objacc.Industry__c 			 		= 'agriculture';
		objacc.Physical_City__c 	 		= 'Test';
        objacc.Physical_State_Province__c   = 'Test';
        
        // Account DML
        insert objacc;
        
        //Insertion of contact
        Contact objContact 	       			= new Contact();
        objContact.AccountId				= objacc.Id;
        objContact.LastName					= 'Testing Trigger 1';
        objContact.Contact_Type__c 			= 'Not DM';
        objContact.Contact_Allocation__c 	= 'New';
        objContact.Title					= 'Test 1';
        objContact.Linked_In_URL__c 		= '@#$$';
        objContact.Functional_Area__c 		= 'Accounting';
        objContact.Title_Level__c			= 'Accounting Director';
        objContact.Database_Sourced__c 		= 'Rahul Merani';
        objContact.Current_Title__c         = 'Test';
        objContact.Current_Company__c		= 'Test Comp';
        
        //Contact DMl
        Insert objContact;
        
        //Insertion of event
        
        Event objevent = New Event();
        objevent.StartDateTime = System.today();
        objEvent.EndDateTime = System.today();
        objEvent.WhoId = objevent.Id;
        objEvent.Type__c = 'Candidate Meeting (Internal Interview)';
        insert objevent;
    }
}

 
-----------------Vf controller-----------
Public class THGenesisFeedbackController{

    public String Ques1{set;get;}
    public String Ques2{set;get;}
    public String Ques3{set;get;}
    public String Ques4{set;get;}
    public String Ques5{set;get;}
    public String Ques7{set;get;}
    public String CaseId{set;get;}
    public String rating1{set;get;}
    public String rating2{set;get;}
    public String rating3{set;get;}
    public String rating4{set;get;}
    public String rating5{set;get;}
    public String rating6{set;get;}
    public List<Case> lstCase{set;get;}
    //public String QueTest{set;get;}
    public Boolean caseSubmitted {set;get;}
    public String logo{set;get;}
    
    public THGenesisFeedbackController(){
        CaseId = ApexPages.currentPage().getParameters().get('CaseId');
        lstCase = new List<Case>();
        if(CaseId!=null){
                   lstCase = [Select id,ContactId,Contact.Email,overall_satisfaction__c,Dissatisfaction_Reason__c, Product__C,Presales_Experience__c, Upsell_Experience__c,Number_Of_Times_Contacted__c,
                    Product_Usage_Experience__c,Cost_Performance__c,Product_Quality__c,Aftersales_Service__c, Recommendation_To_Friend__c,Recommendation_To_Friend_Reason__c,
                    Other_feedback__c,Feedback_Submitted__c,CSat_Rating__c ,CSat_Company_Feedback__c from Case where id=:CaseId];
                    System.debug('logo-->'+lstcase[0].Product__C);

            System.debug('logo-->'+lstcase[0].Product__C);
            if(!lstCase.isEmpty()){
                if(lstcase[0].Product__C!=null){
                    logo = lstcase[0].Product__C;
                }
                caseSubmitted = lstcase[0].Feedback_Submitted__c;

            }
        }
        Ques1 = '';
        Ques2 = '';
        Ques3 = '';
        Ques4 = '';
        Ques5 = '';
        Ques7 = '';
        rating1 = '';
        rating2 = '';
        rating3 = '';
        rating4 = '';
        rating5 = '';
        rating6 = '';
        //logo ='';
    }    
    public PageReference CustomerFeedback(){
        System.debug('CaseId-->'+CaseId);
        if(CaseId!=null){
        lstCase = [Select id,ContactId,Contact.Email,overall_satisfaction__c,Dissatisfaction_Reason__c, Product__C,Presales_Experience__c, Upsell_Experience__c,Number_Of_Times_Contacted__c,
        Product_Usage_Experience__c,Cost_Performance__c,Product_Quality__c,Aftersales_Service__c, Recommendation_To_Friend__c,Recommendation_To_Friend_Reason__c,
        Other_feedback__c,Feedback_Submitted__c,CSat_Rating__c ,CSat_Company_Feedback__c from Case where id=:CaseId];
        System.debug('logo-->'+lstcase[0].Product__C);
            if(!lstCase.isEmpty()){
                if(lstcase[0].Product__C!=null)
                    logo = lstcase[0].Product__C;
                if(Ques1 != null && Ques1 == 'Extremely Satisfied'){
                    lstcase[0].CSat_Rating__c = 5;
                }else if(Ques1 != null && Ques1 == 'Very Satisfied'){
                    lstcase[0].CSat_Rating__c = 4;
                }else if(Ques1 != null && Ques1 == 'Neither satisfied nor dissatisfied'){
                    lstcase[0].CSat_Rating__c = 3;
                }else if(Ques1 != null && Ques1 == 'Somewhat dissatisfied'){
                    lstcase[0].CSat_Rating__c = 2;
                }else if(Ques1 != null && Ques1 == 'Very dissatisfied'){
                    lstcase[0].CSat_Rating__c = 1;
                }
                lstCase[0].Dissatisfaction_Reason__c= ( Ques2 != null ? Ques2 : '');
                lstCase[0].Number_Of_Times_Contacted__c= ( Ques3 != null ? Ques3 : '');
                lstCase[0].Recommendation_To_Friend__c= ( Ques4 != null ? Ques4 : '');
                lstCase[0].Recommendation_To_Friend_Reason__c= ( Ques5 != null ? Ques5 : '');
                lstCase[0].CSat_Company_Feedback__c = (Ques7!= Null ? Ques7 : '');
                lstCase[0].Presales_Experience__c = (rating1!= Null ? rating1 : '');
                lstCase[0].Upsell_Experience__c = (rating2!= Null ? rating2 : '');
                lstCase[0].Product_Usage_Experience__c = (rating3!= Null ? rating3 : '');
                lstCase[0].Product_Quality__c = (rating4!= Null ? rating4 : '');
                lstCase[0].Cost_Performance__c = (rating5!= Null ? rating5 : '');
                lstCase[0].Aftersales_Service__c = (rating6!= Null ? rating6 : '');
                if(Ques1 != NUll){
                    lstcase[0].Feedback_Submitted__c = true;
                }else if(Ques2 != null){
                    lstcase[0].Feedback_Submitted__c = true;
                }else if(Ques3 != Null){
                    lstcase[0].Feedback_Submitted__c = true;
                }else if(Ques4 != Null){
                    lstcase[0].Feedback_Submitted__c = true;
                }else if(Ques5 != Null){
                    lstcase[0].Feedback_Submitted__c = true;
                }else if(Ques7 != Null){
                    lstcase[0].Feedback_Submitted__c = true;
                }else if(rating1 != Null){
                    lstcase[0].Feedback_Submitted__c = true;
                }else if(rating2 != Null){
                    lstcase[0].Feedback_Submitted__c = true;
                }else if(rating3 != Null){
                    lstcase[0].Feedback_Submitted__c = true;
                }else if(rating4 != Null){
                    lstcase[0].Feedback_Submitted__c = true;
                }else if(rating5 != Null){
                    lstcase[0].Feedback_Submitted__c = true;
                }else if(rating6 != Null){
                    lstcase[0].Feedback_Submitted__c = true;
                }
                update lstcase;
            }
        }
        return new PageReference('javascript:window.close()');
    }
}

------ My Test Class---
//--it only Cover 70%-------
@isTest
public class THGenesisFeedbackControllerTest {
    Static testmethod void feedbacktest(){
        Case objcase = new Case();
        objcase.Product__C = 'Digestive Center';
        objcase.overall_satisfaction__c = 'Extremely Satisfied';
        objcase.CSat_Rating__c = 5;
        objcase.Dissatisfaction_Reason__c = 'Test';
        objcase.Number_Of_Times_Contacted__c = '3';
        objcase.Recommendation_To_Friend__c = '4';
        objcase.Recommendation_To_Friend_Reason__c = 'Good Product';
        objcase.Presales_Experience__c = '10';
        objcase.Upsell_Experience__c = '9';
        objcase.Product_Usage_Experience__c = '8';
        objcase.Product_Quality__c = '7';
        objcase.Cost_Performance__c = '5';
        objcase.Aftersales_Service__c = '4';
        objcase.Feedback_Submitted__c = true;
        objcase.CSat_Company_Feedback__c = 'Test';
        insert objcase;
           
        update objcase;
        test.startTest();
        
            PageReference pageRef = Page.THGenesisFeedback;
            pageRef.getParameters().put('CaseId', String.valueOf(objcase.Id));
            Test.setCurrentPage(pageRef);
            
            THGenesisFeedbackController objThgenesis = New THGenesisFeedbackController();
            objThgenesis.CustomerFeedback();
            
        test.stopTest();
    }
}
i tried to control using java script but not work please guide me
Below see my code
<apex:selectRadio value="{!Ques1}" layout="pageDirection" id="Ques1" onchange="check(this)">
                                    <apex:selectOption itemLabel="Extremely Satisfied" itemValue="Extremely Satisfied"/>
                                    <apex:selectOption itemLabel="Very Satisfied" itemValue="Very Satisfied"/>
                                    <apex:selectOption itemLabel="Neither satisfied nor dissatisfied" itemValue="Neither satisfied nor dissatisfied"/> 
                                    <apex:selectOption itemLabel="Somewhat dissatisfied" itemValue="Somewhat dissatisfied"/> 
                                    <apex:selectOption itemLabel="Very dissatisfied" itemValue="Very dissatisfied"/> 
                                </apex:selectRadio> 

-------JavaScript-----
 <script type="text/javascript">
                function check(Selected){
				var choice = Selected.value;
                    if(choice == "Neither satisfied nor dissatisfied" || choice == "Somewhat dissatisfied" || choice == "Very dissatisfied" ){
                        //alert('if');
                        document.getElementsById("msg")[0].style.display = "block"
                    }else{
                        //alert('else');
                        document.getElementsById"msg")[0].style.display = "none"
                    }
                }
            </script>
Please see the Below Screenshot and guide me how to display Data row with Ciclkble buttonUser-added image
Can we color code meetings on the calendar (right now they are all blue). I’d like (for example) yellow for internal meetings, grey for partner meetings, green for interviews, blue for client meetings etc
-----My class cover 64 % how to increase covarge----
global class OnDemandSandboxSchedulerV3 implements Schedulable,Database.AllowsCallouts{

    global void execute(SchedulableContext sc){
        expiredDate();
        dailyCtrlOpr();
    }

    global void expiredDate(){
        List<ManageOnDemandS__c> lstmanagedemand = [Select Id,Sandbox_Id__c,Name,Expire_Date__c,OnDemandRealms__c from ManageOnDemandS__c where Expire_Date__c = today AND Status__c != 'Deleted Sandbox'];
        System.debug('----lstmanagedemand--'+lstmanagedemand);
        if(!lstmanagedemand.isEmpty()){
            //Using JSON.Serialize method we can convert the account list to Json
            String sandboxData = JSON.Serialize(lstmanagedemand);
            System.debug('sandboxData---'+sandboxData);
            //Calling the handler to delete the Sandbox
            OnDemandSandboxIntegrationClass.deleteSandbox(sandboxData);
        }  
    }

    global void dailyCtrlOpr(){
        DateTime now = DateTime.now();
        System.debug('---now'+now);
        String dayOfWeek;
        String hour;
        if(test.isRunningTest()){
            dayOfWeek = 'Saturday';
        }else{
          dayOfWeek = now.format('EEEEE');
        }
         //String dayOfWeek = 'Saturday';
        System.debug('---dayOfWeek'+dayOfWeek);
        if(test.isRunningTest()){
            hour = '2';
        }else{
          hour = String.valueOf(now.hour());
        }
        System.debug('---hour'+hour);
        
        List<ManageOnDemandS__c> lstToStop = new List<ManageOnDemandS__c>();
        List<ManageOnDemandS__c> lstToStart = new List<ManageOnDemandS__c>();
        for(ManageOnDemandS__c mngSndBox:[Select Id, Action__c, Sandbox_Id__c, Status__c, DailyStart__c, DailyStop__c, Friday_Start__c, Friday_Stop__c, Monday_Start__c, Monday_Stop__c, Saturday_Start__c, Saturday_Stop__c, Sunday_Start__c, Sunday_Stop__c, Thrusday_Start__c, Thrusday_Stop__c, Tuesday_Start__c, Tuesday_Stop__c, Wednesday_Start__c, Wednesday_Stop__c, Weekend_Stop_Re_Start__c, Monday_Checkbox__c, Tuesday_Checkbox__c, Wednesday_Checkbox__c, Thrusday_Checkbox__c, Friday_checkbox__c, Saturday_Checkbox__c, Sunday_Checkbox__c, OnDemandRealms__c FROM ManageOnDemandS__c WHERE (Action__c IN ('start','stop','Create Sandbox')) LIMIT 50000]){
        System.debug('---mngSndBox'+mngSndBox);
		
            if(mngSndBox.Action__c == 'start' || mngSndBox.Action__c == 'Create Sandbox'){
                if(dayOfWeek == 'Monday' && mngSndBox.Monday_Checkbox__c == true && mngSndBox.Monday_Start__c == hour){
                    lstToStop.add(mngSndBox);
                }else if(dayOfWeek == 'Tuesday' && mngSndBox.Tuesday_Checkbox__c == true && mngSndBox.Tuesday_Start__c == hour){
                    lstToStop.add(mngSndBox);
                }else if(dayOfWeek == 'Wednesday' && mngSndBox.Wednesday_Checkbox__c == true && mngSndBox.Wednesday_Start__c == hour){
                    lstToStop.add(mngSndBox);
                }else if(dayOfWeek == 'Thursday' && mngSndBox.Thrusday_Checkbox__c == true && mngSndBox.Thrusday_Start__c == hour){
                    lstToStop.add(mngSndBox);  
                }else if(dayOfWeek == 'Friday' && mngSndBox.Friday_checkbox__c == true && mngSndBox.Friday_Start__c == hour){
                    lstToStop.add(mngSndBox);
                }else if(dayOfWeek == 'Saturday' && mngSndBox.Saturday_Checkbox__c == true && mngSndBox.Saturday_Start__c == hour){
                    lstToStop.add(mngSndBox);
                }else if(dayOfWeek == 'Sunday' && mngSndBox.Sunday_Checkbox__c == true && mngSndBox.Sunday_Start__c == hour){
                    lstToStop.add(mngSndBox);
                }
            }else if(mngSndBox.Action__c == 'stop'){
                if(dayOfWeek == 'Monday' && mngSndBox.Monday_Checkbox__c == true && mngSndBox.Monday_Stop__c == hour){
                    lstToStart.add(mngSndBox);
                }else if(dayOfWeek == 'Tuesday' && mngSndBox.Tuesday_Checkbox__c == true && mngSndBox.Tuesday_Stop__c == hour){
                    lstToStart.add(mngSndBox);
                }else if(dayOfWeek == 'Wednesday' && mngSndBox.Wednesday_Checkbox__c == true && mngSndBox.Wednesday_Stop__c == hour){
                    lstToStart.add(mngSndBox);
                }else if(dayOfWeek == 'Thursday' && mngSndBox.Thrusday_Checkbox__c == true && mngSndBox.Thrusday_Stop__c == hour){
                    lstToStart.add(mngSndBox);
                }else if(dayOfWeek == 'Friday' && mngSndBox.Friday_checkbox__c == true && mngSndBox.Friday_Stop__c == hour){
                    lstToStart.add(mngSndBox);
                }else if(dayOfWeek == 'Saturday' && mngSndBox.Saturday_Checkbox__c == true && mngSndBox.Saturday_Stop__c == hour){
                    lstToStart.add(mngSndBox);
                }else if(dayOfWeek == 'Sunday' && mngSndBox.Sunday_Checkbox__c == true && mngSndBox.Sunday_Stop__c == hour){
                    lstToStart.add(mngSndBox);
                }
            }
        }
        System.debug('---lstToStop'+lstToStop);
        System.debug('---lstToStart'+lstToStart);
        //System.debug('---lstMngSndBox'+lstMngSndBox);
        if(!lstToStart.isEmpty()){
            String sndBoxStart = JSON.Serialize(lstToStart);
            OnDemandSandboxIntegrationClass.controlSandbox(sndBoxStart,'daily-start');
        }if(!lstToStop.isEmpty()){
            String sndBoxStop = JSON.Serialize(lstToStop);
            OnDemandSandboxIntegrationClass.controlSandbox(sndBoxStop,'daily-stop');
        }
    }
}

///------My Test Class-----///
@isTest
public class OnDemandSandboxSchedulerV2Test {
    static testmethod void Testscheduledmethod(){
        String CRON_EXP = '0 0 2 * * ? *';
        DateTime now = DateTime.now();
        String  status = 'weekend-stop';
        OnDemandRealms__c objdem = New OnDemandRealms__c();
        objdem.RealmID__c = 'bdtv';
        objdem.Key__c = '6776c02b-6981-4234-a73a-6528a04cd30e';
        objdem.keypassword__c ='87900';
        insert objdem;
        
        ManageOnDemandS__c managdemand = New ManageOnDemandS__c();
        managdemand.Expire_Date__c = System.today();
        managdemand.Status__c = 'Sandbox';
        managdemand.Action__c = 'Create Sandbox';
        managdemand.Weekend_Stop_Re_Start__c = true;
        managdemand.DailyStop__c = '2';
        managdemand.DailyStart__c = '2';
        managdemand.OnDemandRealms__c = objdem.Id;
        insert managdemand;
      
        Test.setMock(HttpCalloutMock.class, new RestMock());
        test.startTest();  
        OnDemandSandboxSchedulerV3 obj = New OnDemandSandboxSchedulerV3();
        String jobId = System.schedule('ScheduleApexClassTest',  CRON_EXP, obj);
        CronTrigger ct = [SELECT Id, CronExpression, TimesTriggered, NextFireTime FROM CronTrigger WHERE id = :jobId];
        System.assertEquals(CRON_EXP, ct.CronExpression);
        System.assertEquals(0, ct.TimesTriggered);
        test.stopTest();
    }
    
    static testmethod void Testscheduledmethod1(){
        String CRON_EXP = '0 0 2 * * ? *';
        DateTime now = DateTime.now();
        String  status = 'weekend-stop';
        OnDemandRealms__c objdem = New OnDemandRealms__c();
        objdem.RealmID__c = 'bdtv';
        objdem.Key__c = '6776c02b-6981-4234-a73a-6528a04cd30e';
        objdem.keypassword__c ='87900';
        insert objdem;
        
        ManageOnDemandS__c managdemand = New ManageOnDemandS__c();
        managdemand.Expire_Date__c = System.today();
        managdemand.Status__c = 'Sandbox';
        managdemand.Action__c = 'Create Sandbox';
        managdemand.Weekend_Stop_Re_Start__c = true;
        managdemand.DailyStop__c = '2';
        managdemand.DailyStart__c = '2';
        managdemand.OnDemandRealms__c = objdem.Id;
        insert managdemand;
        
        managdemand.Action__c = 'Stop';
        update managdemand;
      
        Test.setMock(HttpCalloutMock.class, new RestMock());
        test.startTest();  
        OnDemandSandboxSchedulerV3 obj = New OnDemandSandboxSchedulerV3();
        String jobId = System.schedule('ScheduleApexClassTest',  CRON_EXP, obj);
        CronTrigger ct = [SELECT Id, CronExpression, TimesTriggered, NextFireTime FROM CronTrigger WHERE id = :jobId];
        System.assertEquals(CRON_EXP, ct.CronExpression);
        System.assertEquals(0, ct.TimesTriggered);
        test.stopTest();
    }
    
    public class RestMock implements HttpCalloutMock {
        public HTTPResponse respond(HTTPRequest req) {
            String json = '{"operation":"test"}';
            HTTPResponse res = new HTTPResponse();
            res.setHeader('accept','application/json');
            res.setBody(json);
            res.setStatusCode(200);
            return res;
        }
    }
}

 
Challenge Not yet complete... here's what's wrong:
Could not find your org in the Square Peg registry. Ensure that you have registered your connected app and tested the connection successfully.
Close errors
Please Help me i get the Error
//-----Handler Class------//
public class OppPrintCampaign{
    public static void InsertOpp(List<Opportunity> lstopp,Map<Id,Opportunity> mapIdToSatge){
        Set<Id> setOfAccId = New Set<Id>();
        List<Account> lstupdateacc = New List<Account>();
        List<Opportunity> lstofClosedLostOpp = New List<Opportunity>();
        Campaign objcamp = [Select Id,name from campaign where Id = '7012v000002KBp9'];
        for(Opportunity objopp:lstopp){
            if(objopp.accountId != null && objopp.stageName == 'Closed Lost' && objopp.StageName != mapIdToSatge.get(objopp.Id).stageName){
                setOfAccId.add(objopp.accountId);
            }
		}
        System.debug('-----setOfAccId-----'+setOfAccId);
         for(Opportunity objopp :[Select Id,Name ,Stagename ,AccountId from Opportunity where AccountId IN:setOfAccId]){        
             if(objopp.StageName != 'Closed Lost'){
                 lstofClosedLostOpp.add(objopp);
                 break;
             }
        }
        System.debug('----lstofClosedLostOpp----'+lstofClosedLostOpp.size());
        if(lstofClosedLostOpp.size() == 0){
          	 for(Account objacc:[Select Id,Name from Account where Id IN:setOfAccId]){
             	objacc.Assign_Engments__c = objcamp.name;
             	lstupdateacc.add(objacc);
             } 
        }
        
        System.debug('-----lstupdateacc-----'+lstupdateacc);
        update lstupdateacc;
	}
}

//------Test Class-----//
@isTest
public class OppPrintCampaignTest {
    static testmethod void method1(){
        
        Account objacc = new Account();
        objacc.name = 'Test';
        objacc.Rating = 'Cold';
        insert objacc;
        
        Opportunity objopp = New Opportunity();
        objopp.name = 'Test opp';
        objopp.CloseDate = System.today();
        objopp.AccountId = objacc.Id;
        objopp.StageName = 'Closed Lost';
        insert objopp;       
    }
}

 
can any one help me how to find average value of any filed per month for past 12 month in reort
Hii Every One,

i have a custom filed on Account Name(AssignCheckBox) ,write a Trigger on Opportunity when i update Stage of Opportunity is closed Lost and AccountId not Null and if Selected Account (Might be possible selected Account have more than one Opportunity) of all opportunity will be Closed Lost then Account CheckBox will be true
How to delete Dupliate Recode from flow match on email address
for exapmle if user enter details in search box and click on search button then if any name realed to account are avilable then ll the details of that Account
how to i impiment guide me
When New lead created with email address already present as a existing lead.Lead should get merged with the existing lead record 
Can anyone guide me
Hii Every one,
I am create a flow and add it into the Opportunity recode page but my flow not show on the Recode page .am i missing anything?
Bwlow code of my class we we not cover content documt link area
public class BookingTriggerHandler{
    public static void AddNotes(List<Booking__c> lstbook){
        
        List<ContentDocumentLink> insertlst = New List<ContentDocumentLink>();
        Map<id,Booking__c> mapIdtoBooking = New Map<Id,Booking__c>();
        for(Booking__c objbook :lstbook){
            if(objbook.opportunity__c != null){
                mapIdtoBooking.put(objbook.opportunity__c, objbook);
            }
        }
        system.debug('----mapIdtoBooking----'+mapIdtoBooking);
       
        for(ContentDocumentLink objlink:[SELECT Id,LinkedEntityId ,contentDocumentId FROM ContentDocumentLink where LinkedEntityId IN: mapIdtoBooking.keySet()]){
    		ContentDocumentLink obj = New ContentDocumentLink();
    		obj = objlink.clone(false,true);
    		obj.LinkedEntityId = mapIdtoBooking.get(objlink.LinkedEntityId).id;
    		insertlst.add(obj);            
		}
        system.debug('----insertlst----'+insertlst);
        
        if(!insertlst.isEmpty()){
           insert insertlst; 
        }
    }
}
@isTest
public class BookingTriggerHandlerTest{
    static testMethod void Testdata(){
        List<ContentDocumentLink> lstcon = New List<ContentDocumentLink>();
        List<Booking__c> lstbooking = New List<Booking__c>();
        Account objacc = New Account();
        objacc.name = 'Test';
        objacc.Type = 'Press';
        insert objacc;
        
        Opportunity objopp = new Opportunity();
        objopp.name ='Test';
        objopp.StageName ='Closed Won';
        objopp.CloseDate = system.today();
        objopp.Mode_of_Contact__c = 'Telephone';
        objopp.AccountId = objacc.Id;
        insert objopp;
        
        Booking__c objbook = New Booking__c();
        objbook.Name = 'Test';
        objbook.Opportunity__c = objopp.Id;
        lstbooking.add(objbook);
        insert lstbooking;
        List<contentNote> lstnote = New List<contentNote>();
        contentNote objnote = New contentNote();
        objnote.title = 'Test';
        lstnote.add(objnote);
        insert lstnote;
        
        List<ContentDocument> documents = [SELECT Id, Title, LatestPublishedVersionId FROM ContentDocument where Id =:objopp.Id]; 
        if(!documents.isEmpty()){
           ContentDocumentLink contentlink=new ContentDocumentLink();
		   contentlink.ShareType= 'C';
		   contentlink.LinkedEntityId = objopp.Id; 
		   contentlink.ContentDocumentId=documents[0].Id;
		   contentlink.Visibility = 'AllUsers'; 
           lstcon.add(contentlink); 
           System.assertEquals(documents.size(), 1);
        }		
		insert lstcon;
    }
}
-----------------Vf controller-----------
Public class THGenesisFeedbackController{

    public String Ques1{set;get;}
    public String Ques2{set;get;}
    public String Ques3{set;get;}
    public String Ques4{set;get;}
    public String Ques5{set;get;}
    public String Ques7{set;get;}
    public String CaseId{set;get;}
    public String rating1{set;get;}
    public String rating2{set;get;}
    public String rating3{set;get;}
    public String rating4{set;get;}
    public String rating5{set;get;}
    public String rating6{set;get;}
    public List<Case> lstCase{set;get;}
    //public String QueTest{set;get;}
    public Boolean caseSubmitted {set;get;}
    public String logo{set;get;}
    
    public THGenesisFeedbackController(){
        CaseId = ApexPages.currentPage().getParameters().get('CaseId');
        lstCase = new List<Case>();
        if(CaseId!=null){
                   lstCase = [Select id,ContactId,Contact.Email,overall_satisfaction__c,Dissatisfaction_Reason__c, Product__C,Presales_Experience__c, Upsell_Experience__c,Number_Of_Times_Contacted__c,
                    Product_Usage_Experience__c,Cost_Performance__c,Product_Quality__c,Aftersales_Service__c, Recommendation_To_Friend__c,Recommendation_To_Friend_Reason__c,
                    Other_feedback__c,Feedback_Submitted__c,CSat_Rating__c ,CSat_Company_Feedback__c from Case where id=:CaseId];
                    System.debug('logo-->'+lstcase[0].Product__C);

            System.debug('logo-->'+lstcase[0].Product__C);
            if(!lstCase.isEmpty()){
                if(lstcase[0].Product__C!=null){
                    logo = lstcase[0].Product__C;
                }
                caseSubmitted = lstcase[0].Feedback_Submitted__c;

            }
        }
        Ques1 = '';
        Ques2 = '';
        Ques3 = '';
        Ques4 = '';
        Ques5 = '';
        Ques7 = '';
        rating1 = '';
        rating2 = '';
        rating3 = '';
        rating4 = '';
        rating5 = '';
        rating6 = '';
        //logo ='';
    }    
    public PageReference CustomerFeedback(){
        System.debug('CaseId-->'+CaseId);
        if(CaseId!=null){
        lstCase = [Select id,ContactId,Contact.Email,overall_satisfaction__c,Dissatisfaction_Reason__c, Product__C,Presales_Experience__c, Upsell_Experience__c,Number_Of_Times_Contacted__c,
        Product_Usage_Experience__c,Cost_Performance__c,Product_Quality__c,Aftersales_Service__c, Recommendation_To_Friend__c,Recommendation_To_Friend_Reason__c,
        Other_feedback__c,Feedback_Submitted__c,CSat_Rating__c ,CSat_Company_Feedback__c from Case where id=:CaseId];
        System.debug('logo-->'+lstcase[0].Product__C);
            if(!lstCase.isEmpty()){
                if(lstcase[0].Product__C!=null)
                    logo = lstcase[0].Product__C;
                if(Ques1 != null && Ques1 == 'Extremely Satisfied'){
                    lstcase[0].CSat_Rating__c = 5;
                }else if(Ques1 != null && Ques1 == 'Very Satisfied'){
                    lstcase[0].CSat_Rating__c = 4;
                }else if(Ques1 != null && Ques1 == 'Neither satisfied nor dissatisfied'){
                    lstcase[0].CSat_Rating__c = 3;
                }else if(Ques1 != null && Ques1 == 'Somewhat dissatisfied'){
                    lstcase[0].CSat_Rating__c = 2;
                }else if(Ques1 != null && Ques1 == 'Very dissatisfied'){
                    lstcase[0].CSat_Rating__c = 1;
                }
                lstCase[0].Dissatisfaction_Reason__c= ( Ques2 != null ? Ques2 : '');
                lstCase[0].Number_Of_Times_Contacted__c= ( Ques3 != null ? Ques3 : '');
                lstCase[0].Recommendation_To_Friend__c= ( Ques4 != null ? Ques4 : '');
                lstCase[0].Recommendation_To_Friend_Reason__c= ( Ques5 != null ? Ques5 : '');
                lstCase[0].CSat_Company_Feedback__c = (Ques7!= Null ? Ques7 : '');
                lstCase[0].Presales_Experience__c = (rating1!= Null ? rating1 : '');
                lstCase[0].Upsell_Experience__c = (rating2!= Null ? rating2 : '');
                lstCase[0].Product_Usage_Experience__c = (rating3!= Null ? rating3 : '');
                lstCase[0].Product_Quality__c = (rating4!= Null ? rating4 : '');
                lstCase[0].Cost_Performance__c = (rating5!= Null ? rating5 : '');
                lstCase[0].Aftersales_Service__c = (rating6!= Null ? rating6 : '');
                if(Ques1 != NUll){
                    lstcase[0].Feedback_Submitted__c = true;
                }else if(Ques2 != null){
                    lstcase[0].Feedback_Submitted__c = true;
                }else if(Ques3 != Null){
                    lstcase[0].Feedback_Submitted__c = true;
                }else if(Ques4 != Null){
                    lstcase[0].Feedback_Submitted__c = true;
                }else if(Ques5 != Null){
                    lstcase[0].Feedback_Submitted__c = true;
                }else if(Ques7 != Null){
                    lstcase[0].Feedback_Submitted__c = true;
                }else if(rating1 != Null){
                    lstcase[0].Feedback_Submitted__c = true;
                }else if(rating2 != Null){
                    lstcase[0].Feedback_Submitted__c = true;
                }else if(rating3 != Null){
                    lstcase[0].Feedback_Submitted__c = true;
                }else if(rating4 != Null){
                    lstcase[0].Feedback_Submitted__c = true;
                }else if(rating5 != Null){
                    lstcase[0].Feedback_Submitted__c = true;
                }else if(rating6 != Null){
                    lstcase[0].Feedback_Submitted__c = true;
                }
                update lstcase;
            }
        }
        return new PageReference('javascript:window.close()');
    }
}

------ My Test Class---
//--it only Cover 70%-------
@isTest
public class THGenesisFeedbackControllerTest {
    Static testmethod void feedbacktest(){
        Case objcase = new Case();
        objcase.Product__C = 'Digestive Center';
        objcase.overall_satisfaction__c = 'Extremely Satisfied';
        objcase.CSat_Rating__c = 5;
        objcase.Dissatisfaction_Reason__c = 'Test';
        objcase.Number_Of_Times_Contacted__c = '3';
        objcase.Recommendation_To_Friend__c = '4';
        objcase.Recommendation_To_Friend_Reason__c = 'Good Product';
        objcase.Presales_Experience__c = '10';
        objcase.Upsell_Experience__c = '9';
        objcase.Product_Usage_Experience__c = '8';
        objcase.Product_Quality__c = '7';
        objcase.Cost_Performance__c = '5';
        objcase.Aftersales_Service__c = '4';
        objcase.Feedback_Submitted__c = true;
        objcase.CSat_Company_Feedback__c = 'Test';
        insert objcase;
           
        update objcase;
        test.startTest();
        
            PageReference pageRef = Page.THGenesisFeedback;
            pageRef.getParameters().put('CaseId', String.valueOf(objcase.Id));
            Test.setCurrentPage(pageRef);
            
            THGenesisFeedbackController objThgenesis = New THGenesisFeedbackController();
            objThgenesis.CustomerFeedback();
            
        test.stopTest();
    }
}
//-----Handler Class------//
public class OppPrintCampaign{
    public static void InsertOpp(List<Opportunity> lstopp,Map<Id,Opportunity> mapIdToSatge){
        Set<Id> setOfAccId = New Set<Id>();
        List<Account> lstupdateacc = New List<Account>();
        List<Opportunity> lstofClosedLostOpp = New List<Opportunity>();
        Campaign objcamp = [Select Id,name from campaign where Id = '7012v000002KBp9'];
        for(Opportunity objopp:lstopp){
            if(objopp.accountId != null && objopp.stageName == 'Closed Lost' && objopp.StageName != mapIdToSatge.get(objopp.Id).stageName){
                setOfAccId.add(objopp.accountId);
            }
		}
        System.debug('-----setOfAccId-----'+setOfAccId);
         for(Opportunity objopp :[Select Id,Name ,Stagename ,AccountId from Opportunity where AccountId IN:setOfAccId]){        
             if(objopp.StageName != 'Closed Lost'){
                 lstofClosedLostOpp.add(objopp);
                 break;
             }
        }
        System.debug('----lstofClosedLostOpp----'+lstofClosedLostOpp.size());
        if(lstofClosedLostOpp.size() == 0){
          	 for(Account objacc:[Select Id,Name from Account where Id IN:setOfAccId]){
             	objacc.Assign_Engments__c = objcamp.name;
             	lstupdateacc.add(objacc);
             } 
        }
        
        System.debug('-----lstupdateacc-----'+lstupdateacc);
        update lstupdateacc;
	}
}

//------Test Class-----//
@isTest
public class OppPrintCampaignTest {
    static testmethod void method1(){
        
        Account objacc = new Account();
        objacc.name = 'Test';
        objacc.Rating = 'Cold';
        insert objacc;
        
        Opportunity objopp = New Opportunity();
        objopp.name = 'Test opp';
        objopp.CloseDate = System.today();
        objopp.AccountId = objacc.Id;
        objopp.StageName = 'Closed Lost';
        insert objopp;       
    }
}

 

My requirment is - Junction Object (Junction1__c) record should get created when user create new record on "Account"/"Location" object

Data model -
Account Obj 
M_number__c field

Location object
M_number__c field


Junction1 Object
Account__c (M-D Rel with Account)
location__c (M-D rel with location)

When user create new recrod on Account Or Location object, it should automatically create new Rec on Junction Obj

Hi

I am not able to select the loop variable in the loop element.

To query the record collection varibale and store in single variable it is not popping up.

Am I missing some setup options??
What Could be the issue ?????Attaching screenshot

 Loop element

Hi, I am trying to write a batch class which will delete the opportunities whose CloseDate is last month and update checkbox in related account.

//Batch Class

global class DeleteOppsBatch implements Database.Batchable<SObject> {
    List<Account> newList = new List<Account>();
    global Database.QueryLocator start (Database.BatchableContext BC) {
        return Database.getQueryLocator([Select Id, DeletedOpp__c, (SELECT Id, CloseDate FROM Opportunities WHERE CloseDate = LAST_N_DAYS:30) FROM Account]);
    }
    global void execute(Database.BatchableContext BC, List<Account> accList) {
        for(Account acc : accList) {
            acc.DeletedOpp__c = TRUE;
            newList.add(acc);
        }
        //update newList;
    }
    global void finish(Database.BatchableContext BC) {
        System.debug('listsize:'+newList.size());
        delete newList;
    }
}

I didn't understand why this class is not working. Can someone help me achieve this functionality.

Thanks in advance.
can any one help me how to find average value of any filed per month for past 12 month in reort
Hii Every One,

i have a custom filed on Account Name(AssignCheckBox) ,write a Trigger on Opportunity when i update Stage of Opportunity is closed Lost and AccountId not Null and if Selected Account (Might be possible selected Account have more than one Opportunity) of all opportunity will be Closed Lost then Account CheckBox will be true
for exapmle if user enter details in search box and click on search button then if any name realed to account are avilable then ll the details of that Account
how to i impiment guide me
Hii Every one,
I am create a flow and add it into the Opportunity recode page but my flow not show on the Recode page .am i missing anything?
Bwlow code of my class we we not cover content documt link area
public class BookingTriggerHandler{
    public static void AddNotes(List<Booking__c> lstbook){
        
        List<ContentDocumentLink> insertlst = New List<ContentDocumentLink>();
        Map<id,Booking__c> mapIdtoBooking = New Map<Id,Booking__c>();
        for(Booking__c objbook :lstbook){
            if(objbook.opportunity__c != null){
                mapIdtoBooking.put(objbook.opportunity__c, objbook);
            }
        }
        system.debug('----mapIdtoBooking----'+mapIdtoBooking);
       
        for(ContentDocumentLink objlink:[SELECT Id,LinkedEntityId ,contentDocumentId FROM ContentDocumentLink where LinkedEntityId IN: mapIdtoBooking.keySet()]){
    		ContentDocumentLink obj = New ContentDocumentLink();
    		obj = objlink.clone(false,true);
    		obj.LinkedEntityId = mapIdtoBooking.get(objlink.LinkedEntityId).id;
    		insertlst.add(obj);            
		}
        system.debug('----insertlst----'+insertlst);
        
        if(!insertlst.isEmpty()){
           insert insertlst; 
        }
    }
}
@isTest
public class BookingTriggerHandlerTest{
    static testMethod void Testdata(){
        List<ContentDocumentLink> lstcon = New List<ContentDocumentLink>();
        List<Booking__c> lstbooking = New List<Booking__c>();
        Account objacc = New Account();
        objacc.name = 'Test';
        objacc.Type = 'Press';
        insert objacc;
        
        Opportunity objopp = new Opportunity();
        objopp.name ='Test';
        objopp.StageName ='Closed Won';
        objopp.CloseDate = system.today();
        objopp.Mode_of_Contact__c = 'Telephone';
        objopp.AccountId = objacc.Id;
        insert objopp;
        
        Booking__c objbook = New Booking__c();
        objbook.Name = 'Test';
        objbook.Opportunity__c = objopp.Id;
        lstbooking.add(objbook);
        insert lstbooking;
        List<contentNote> lstnote = New List<contentNote>();
        contentNote objnote = New contentNote();
        objnote.title = 'Test';
        lstnote.add(objnote);
        insert lstnote;
        
        List<ContentDocument> documents = [SELECT Id, Title, LatestPublishedVersionId FROM ContentDocument where Id =:objopp.Id]; 
        if(!documents.isEmpty()){
           ContentDocumentLink contentlink=new ContentDocumentLink();
		   contentlink.ShareType= 'C';
		   contentlink.LinkedEntityId = objopp.Id; 
		   contentlink.ContentDocumentId=documents[0].Id;
		   contentlink.Visibility = 'AllUsers'; 
           lstcon.add(contentlink); 
           System.assertEquals(documents.size(), 1);
        }		
		insert lstcon;
    }
}
We can't save this record because the “Opportunity Updates” process failed. Give your Salesforce admin these details. This error occurred when the flow tried to update records: INSUFFICIENT_ACCESS_ON_CROSS_REFERENCE_ENTITY: insufficient access rights on cross-reference id: a0G1U000003g8cd. You can look up ExceptionCode values in the SOAP API Developer Guide. Error ID: 1328276966-63986 (-2109863242)
//Controller Class
Please Any one Help
Pardot_Credential_Setting__c is Custom Setting
public class pardotActivityController{

        public static Pardot_Credential_Setting__c customSetting(){
            Pardot_Credential_Setting__c objSetting = Pardot_Credential_Setting__c.getValues('Pardot Access');
            if(objSetting != null && objSetting.Sync_disabled__c == false){
                return objSetting;
            }
            return null;
        }
        public static String authMethod(){
            
            Pardot_Credential_Setting__c objSetting = customSetting();

            if(objSetting != null){    <----Not Covering -------->
                String email = objSetting.Pardot_Email__c;
                String password = objSetting.Pardot_Password__c;
                String userKey = objSetting.User_Api_Key__c;

                HttpRequest req = new HttpRequest();
                req.setEndpoint( objSetting.Pardot_BaseUrl__c+'/api/login/version/4' );
                req.setMethod( 'POST' );
                req.setBody( 'email=' + email + '&password=' + password + '&user_key=' + userKey );

                HttpResponse res = new Http().send( req );

                System.debug('>>>>>>>>res'+ res );
                System.debug('>>>>>>>>>res.getStatus()'+ res.getStatus() );
                System.debug('>>>>>>res.getBody()'+ res.getBody() );

                String response = res.getBody();
                
                Integer startIdx;
                Integer endIdx;
                String apiKey;
                if(response.contains('<api_key>')){
                    startIdx = response.indexOf( '<api_key>' ) + 9;
                    endIdx = response.indexOf( '</api_key>' );
                    apiKey = response.substring( startIdx, endIdx );
                    System.debug( '>>>>>>>apiKey'+ apiKey );
                    return apiKey;
                }
            }
            
            return null;
        }
}

<------Test class------->
 static Testmethod void authMethodTest(){ 
        Pardot_Credential_Setting__c objSetting = New Pardot_Credential_Setting__c();
         objSetting.Name = 'Test';
         objSetting.Pardot_Email__c = 'abc@gmail.com';
         objSetting.User_Api_Key__c = '<api_key>';
         objSetting.Pardot_BaseUrl__c = 'https://pi.pardot.com/api/login/version/4';
         objSetting.Pardot_Password__c = 'test12';
         objSetting.Sync_disabled__c = false;
         insert objsetting;
        	Test.setMock(HttpCalloutMock.class, new MockHttpResponseGenerator());
        	test.startTest();
        		pardotActivityController.authMethod();
        	test.stopTest();
    	}
 public class MockHttpResponseGenerator implements HttpCalloutMock{ //Http callout class for authmothod
            public HTTPResponse respond(HTTPRequest req){               
            String json=        '{'+
            '        "EMail": "leadsscotia@culliganwaterco.com",'+
            '        "Password": "<api_key>,'+
            '        "Userkey": "</api_key>",'+
            '}';
                   
            	System.assertEquals('https://pi.pardot.com/api/login/version/4', req.getEndpoint());
            	System.assertEquals('POST', req.getMethod());
                
                //make a fake responce
                 HttpResponse res = new HttpResponse();
                 res.setBody(json);
                 res.setStatusCode(200);
                 return res;
            }
        }

 
How to put URL dynamically in HTML email template, i want to populate url dynamically otherwise on every instance i have to chance the URL.

Some one please suggest me what we have to do here.