• Chidanand M
  • NEWBIE
  • 30 Points
  • Member since 2015
  • Chidanand Magadum

  • Chatter
    Feed
  • 0
    Best Answers
  • 1
    Likes Received
  • 0
    Likes Given
  • 29
    Questions
  • 21
    Replies
Hello  All,

I am trying to create a table structure in apex class using html.

htmlBody1 = '<html><img width="200" alt="heloo"><br/>';

In the above piece of code if i try to use src attribute to specify the url, it throws me run time error.

htmlBody1 = '<html><img width="200" alt="heloo" src=" "><br/>'; == > this is throwing me a runtime error


Can anybody tell me what exactly m missing here.
 
Hi All,

I have written a trigger on contentdocument object to get the size of the file that is being uploaded. Unfortunately, everytime i upload the document i get size of the file being uploaded as null. Let me know if anybody has faced the same issue and resolved it. 

Thanks and Regards
Chidanand G.M.
Hi All,

I have a requirement to develop a geocharts in lightning. Can anybody tell me is there any charting javascript library which supports lightning/lockerservices to build a geocharts.

TIA
Hi,

I have written a component with the following javascript controller to scan the scnned data.
 
({
    doInit : function(component, event, helper) {
        

        var urlEvent = $A.get("e.force:navigateToURL");
        //option 2 QR codes contains just the record Id 
         if (component.get("v.UrlType") == "Id Only"){
           var url = "scan://scan?callback="+encodeURIComponent("salesforce1://sObject/SCANNED_DATA/view");
			
             urlEvent.setParams({
                "url": url
            });
             
             
             
         }
        
        //use an custom field using a special VF page to search and redirect to the object
        
        urlEvent.fire();
		
		}
})

1. QR Code is having Record Id in it.
2. As soon as i scan the QR Code it gets redirected to the record. Works fine

Requirement​.

1. I want to capture the scanned QR Code value (Which is nothing but Id of the record) in a variable.

How can i achieve my requiremnt.

Please Post your Ideas/Comments

Thanks,
Chidanand G.M.
function nextRec(){
        
            
             alert('hii');
        
            if(localStorage['CycleAccounts']){
            var cycleAccounts = localStorage['CycleAccounts'].split(',');
            alert(cycleAccounts);
            alert('{!Account.Id}');
            var accId='{!Account.Id}';
            accId= accId.substring(0, accId.length - 3);
            alert(accId);
           // var currentAccountPos = cycleAccounts.indexOf('{!Account.Id}');
           var currentAccountPos = cycleAccounts.indexOf(accId);
            alert(currentAccountPos);
            
            if(currentAccountPos == cycleAccounts.length - 1){
            alert('This was the Last Account!');
            }
            else{
            
            parent.parent.frames.location.replace('/apex/accExample?id='+ cycleAccounts[currentAccountPos + 1]); 

            }
            }
                   
        
        }

Hi All,

1. If i login as a admin, browser gets refreshed with the updated id's
2.If i login with user other than admin, browser doesn't get refreshed.

Can somebody help me, It's very urgent.

TIA
Hey Guys,
Can anyone explain me when do we use actionFunction over remote action and vice-versa with an example Code.
TIA
Hello friends,
       I am trying to deploy my Force.com Metadata to my developer Org.
       But it is throwing me an error like this 'Problem: encodingKey must be specified'.
       Can anyone help me on how to sort out this isuue. TIA.
Hi friends
I have a website field in my Account Object.
I wanna get the Alexa ranking of that website.

What is the procedure and how can i achieve it??
Hi friends,

I have written a test class for my trigger in account object.
But whever i run the test class, i am getting the fowwing error


FATAL_ERROR|System.TypeException: Methods defined as TestMethod do not support Web service callouts, test skipped.

I have some of the managed packages inside the Account object.
The same test class when i run before refreshing my sandbox it was working fine. But the problem started after refreshing the sandbox. But other object testclasses r running correctly.

Here is my complete error message

00:25:27.648 (3648848170)|CODE_UNIT_FINISHED|territoryownerTest.checkStateCountry 00:25:27.650 (3650894509)|EXECUTION_FINISHED 00:25:27.654 (3654729375)|ENTERING_MANAGED_PKG|ClientSuccess 00:25:27.655 (3655562162)|FATAL_ERROR|System.TypeException: Methods defined as TestMethod do not support Web service callouts, test skipped (ClientSuccess) 00:25:27.655 (3655576096)|FATAL_ERROR|System.TypeException: Methods defined as TestMethod do not support Web service callouts, test skipped (ClientSuccess)

Can anyone tell me how to resolve this issue.




 
Hi friends,

In account Object i have two fields.

1.Website
2. Alexa ranking

I wanna get the Alexa ranking of a website and populate Alexa ranking field of Account.

How to achive this. Any kind of  help would be greatly appreciated.
Hi friends,

I have agreement related list on Opportunity.
I have an uploaded file for the new agreement.
In the uploaded file there is a label Name.
I wanna fetch the Name from Opportunity and populate the label 'Name' in the uploaded file, soon after the uploaded file is sent for signature.
Its very ugent, Could u plz help me to achieve this.
TIA.
Hi friends,

I have agreement related list on Opportunity.
I have an uploaded file for the new agreement.
In the uploaded file there is a label Name.
I wanna fetch the Name from Opportunity and populate the label 'Name' in the uploaded file, soon after the uploaded file is sent for signature.
Its very ugent, Could u plz help me to achieve this.
TIA.
 
Hi friends,

I wanna make the checkbox 'Send email notification ' on Lead object to be checked on change of Lead Owner.
Has anyone come across this scenario?
If so plz guide me to achieve the same.

 
Hi folks,

Could anyone plz explain me the exact difference b/w,
commandLink,
actionSupport and
actionFunction 

With some scenarios.
When to use them perticularly, in which scenarios.
It is confusing a lot between the 3.
I know them individually,
Hi folks,

Could anyone plz explain me the exact difference b/w,
commandLink,
actionSupport and
actionFunction 

With some scenarios.
When to use them perticularly, in which scenarios.
It is confusing a lot between the 3.
I know them individually,
But need to know how they are different to each other
Hey Guys,

Option to attach and Edit the file of rich textArea in salesforce1 is not supported.
So, any workaround for the same to attach image in salesforce1.
TIA
Hey Guys,

Option to attach and Edit the file of rich textArea in salesforce1 is not supported.
So, any workaround for the same to attach image in salesforce1.
TIA
Hi folks,
I need two separate lead queues that assign leads in a round robin fashion based on the lead score.
Any score containing a 1 or 2 is a Tier 1 lead.
Any score containing a 3 or 4 is a Tier 2 lead
For context, Tier 1 leads are urgent and Tier 2 are not
I have three people I want to round robin each of these lead queue to.

How to achieve this.
TIA
Hi friends,

I could cover only 73% of code.
Code insde the for loop of pricebook entry is not covered.
Select query of opportunity is returning me 0 rows inside the test class.
Apex

global class RenewexistingOpp implements Schedulable 
{
   global void execute(SchedulableContext SC) 
   {
       NewOppFromexistingOpp Opp= new NewOppFromexistingOpp();
   }
   public class NewOppFromexistingOpp 
   {
       NewOppFromexistingOpp()
       {      
           Date d = Date.Today();
           Date ssdt= Date.newInstance(2014,1,1);
           User newUser=[select Id from user where Name='Jarin Stevens'];

            for(Opportunity oldOpp:[select Name,Amount,AccountId,Service_End_Date__c,Service_Start_Date__c,
            CloseDate,StageName,AutoProcessedFlag__c,Why_OP_Win_Details__c,Billing_Contact__c,Primary_Contact__c,
            Payment_Terms__c,Billing_Cycle__c from opportunity where StageName='Closed Won' And AutoProcessedFlag__c=false])
    {
   
    
                System.debug(oldOpp);
                if(oldOpp.Service_Start_Date__c!=NULL)
                {
        
                        if(oldOpp.Service_Start_Date__c >=ssdt && oldOpp.Service_End_Date__c>=d )  
                        {  
        
                            Opportunity newOpp= new Opportunity();
                            newOpp.Name=oldOpp.Name; 
                            newOpp.OwnerId=newUser.Id;
                            newOpp.CloseDate=oldOpp.Service_End_Date__c + 1;  
                            newOpp.StageName='Renewal - Decision';  

                            insert newOpp;
                             for(PriceBookEntry priceBookList:[select Id,UnitPrice,Pricebook2Id,Product2Id FROM PriceBookEntry where Product2.Name IN('Enterprise License','ObservePoint Platform - Contracted') And PriceBook2.isStandard=true])
                            {
                                OpportunityLineItem oli = new OpportunityLineItem(); // Create new Opportunity Product
                                oli.OpportunityId = newOpp.Id;                           
                                oli.PricebookEntryId=priceBookList.Id;       
                                oli.UnitPrice =priceBookList.UnitPrice;                       
                                oli.Quantity=1;
                                insert oli;
                                
                            }
                            oldOpp.AutoProcessedFlag__c = true;
                           
                            upsert oldOpp;

                      }
                       
                 }
             
           }  
       }
    }
}
Test Class

@isTest (SeeAllData=false)

public class RenewexistingOppTest{

public static String CRON_EXP = '0 0 0 15 3 ? 2022';

    
    static testmethod void RenewexistingOppTest() {
    Test.startTest();
    Date sed = Date.newInstance(2015, 9, 15);
    Date ssd= Date.newInstance(2014,1,1);
    Date cd= Date.newInstance(2017, 9, 15);
    Date d = Date.Today();
    List<PricebookEntry > pntr= new List<PricebookEntry >();
    
    Profile p = [SELECT Id FROM Profile WHERE Name='System Administrator']; 
      User u = new User(Alias = 'standt', Email='standarduser@testorg.com', 
      EmailEncodingKey='UTF-8', LastName='wwy', LanguageLocaleKey='en_US',FirstName='wwx',
      LocaleSidKey='en_US', ProfileId = p.Id, 
      TimeZoneSidKey='America/Los_Angeles', UserName='abvc@gmail.com');
    
     insert u;
     
     User uid=[select Id from User where Name='wwx wwy' LIMIT 1];
    
    
      
    Account createAcc= new Account(Name='testAccount'); 
    insert createAcc;
    
    Campaign cmp = new Campaign(Name='Chidanand');
    insert cmp;
    
    Contact createCont=new Contact(FirstName='testContact1',LastName='testContact1',AccountId=createAcc.Id);
    insert createCont;
    
    
    Opportunity createOpp= new Opportunity(Name='TestNew2',Amount=500.00,AccountId=createAcc.Id,Service_End_Date__c=sed,
                                           Service_Start_Date__c=ssd,CampaignId=cmp.Id,NextStep='hi',CloseDate=cd,StageName='Closed Won',AutoProcessedFlag__c=false,
                                           Why_OP_Win_Details__c='Hi',Billing_Contact__c=createCont.Id,Primary_Contact__c=createCont.Id,
                                           Payment_Terms__c='Net 15',Billing_Cycle__c='Annual In Advance');  
    
                                  
    insert createOpp;
    
      
    Product2 createProd=new Product2(Name='ObservePoint Platform - Contracted');
    insert createProd; 
    
   // Pricebook2 stdpb = [SELECT Id FROM Pricebook2 WHERE IsStandard = true]; 
        
        Id pricebookId = Test.getStandardPricebookId();                               
    
  //  PricebookEntry createPE=new PricebookEntry(Pricebook2Id=stdpb.Id,Product2Id=createProd.Id,UnitPrice=500,IsActive = true);
     
     PricebookEntry createPE=new PricebookEntry(Pricebook2Id=pricebookId,Product2Id=createProd.Id,UnitPrice=500,IsActive = true);
     insert createPE;
    
    String jobId = System.schedule('Schedule Opp From Opp',CRON_EXP,new RenewexistingOpp());
                        
    CronTrigger ct = [SELECT Id, CronExpression, TimesTriggered, NextFireTime FROM CronTrigger WHERE id = :jobId];
         
         System.assertEquals(CRON_EXP, ct.CronExpression);
         
         System.assertEquals(0, ct.TimesTriggered);
         System.assertEquals('2022-03-15 00:00:00', String.valueOf(ct.NextFireTime));
         Test.stopTest();  
             
         for(Opportunity oldOpp:[select Id,Name,Amount,AccountId,Service_End_Date__c,Service_Start_Date__c,
           CloseDate,StageName,AutoProcessedFlag__c,NextStep,CampaignId,Why_OP_Win_Details__c,Billing_Contact__c,Primary_Contact__c,
           Payment_Terms__c,Billing_Cycle__c from opportunity where StageName=:'Closed Won' And AutoProcessedFlag__c=:false]){
           
           System.debug('hi1'); 
           if(oldOpp.Service_Start_Date__c!=NULL){
        
         System.debug('hi2'); 
                             if(oldOpp.Service_start_Date__c>=ssd && oldOpp.Service_End_Date__c>= d)  
                        {  
                        
                         System.debug('hi3'); 
                            Opportunity newOpp= new Opportunity();
                            newOpp.Name=oldOpp.Name; 
                            newOpp.StageName='Renewal - Decision'; 
                            
                            newOpp.OwnerId=uid.Id;
                           // newOpp.AccountId=oldOpp.AccountId; 
                            newOpp.CloseDate=oldOpp.Service_End_Date__c+1;    
                             insert newOpp;
                           
                           System.debug('hello');  
                           system.debug([select Id,UnitPrice,Pricebook2Id,Product2Id FROM PriceBookEntry where Product2.Name IN ('Enterprise License','ObservePoint Platform - Contracted')]);
                             
                             for(PriceBookEntry priceBookList:[select Id,UnitPrice,Pricebook2Id,Product2Id FROM PriceBookEntry])
                            {
                            
                                //system.debug([select Id,UnitPrice,Pricebook2Id,Product2Id FROM PriceBookEntry where Product2.Name IN ('Enterprise License','ObservePoint Platform - Contracted')]);
                            
                                OpportunityLineItem oli = new OpportunityLineItem(); // Create new Opportunity Product
                                oli.OpportunityId = newOpp.Id;                           
                                oli.PricebookEntryId=priceBookList.Id; 
                               // oli.PricebookEntryId='00kJ0000008VXct';
                                oli.UnitPrice =priceBookList.UnitPrice;                       
                                oli.Quantity=1;
                                insert oli;
                                
                            }
                             
                            oldOpp.AutoProcessedFlag__c = true;
                              
                            upsert oldOpp;
                        
                        }
           }
           
           }
         
                 
    
    
    }
     
    }



 
Hi,

How to get Id of the dynamically created textbox using javascript?
Plz give some good links or a sample code.
TIA
 
Hai folks,

Could u plz tell me the exact difference between Database.query() and Database.getQueryLocator(). When and in which situation v need to make use of respective methods. TIA
Hi All,

I have written a trigger on contentdocument object to get the size of the file that is being uploaded. Unfortunately, everytime i upload the document i get size of the file being uploaded as null. Let me know if anybody has faced the same issue and resolved it. 

Thanks and Regards
Chidanand G.M.
Hi All,

I have a requirement to develop a geocharts in lightning. Can anybody tell me is there any charting javascript library which supports lightning/lockerservices to build a geocharts.

TIA
Was wondering if anyone is have a problem displaying the map from leaflet onto a lighting component record page. Following the Accounts near me trailhead. In the trailhead you can see the map in the App which is fine. But i am not able to show it in a lighting component.
Hi, 
I have created the following components for this step:

BoatSearchForm.cmp
<aura:component controller="BoatSearchForm" implements="force:appHostable,flexipage:availableForAllPageTypes"  access="global" >
    <aura:handler name="init" value="{!this}" action="{!c.doInit}"/>
    <aura:attribute name="searchOptions" type='String[]' default='All'/>
    <aura:attribute name='searchOptionToIdMap' type='Map' default="{All:''}" />
    <aura:attribute name='showNewButton' type='Boolean' default='false'/>

    <lightning:layout horizontalAlign="center"   >

       <lightning:layoutItem class="slds-grid_vertical-align-center" > 

           <lightning:select aura:id='typeSelect' name='selectItem' onchange=''>
             <aura:iteration items='{!v.searchOptions}' var='option'>
                 <option value='{!option}' text='{!option}'></option>
             </aura:iteration>
         </lightning:select>
       </lightning:layoutItem>

       <lightning:layoutItem class="slds-grid_vertical-align-center" > 
         <lightning:button label="Search" variant="brand"  />
         <aura:if isTrue='{!v.showNewButton}'>
            <lightning:button variant='neutral' label='New' onclick='{!c.createBoat}'/>
        </aura:if>
       </lightning:layoutItem>

    </lightning:layout>

</aura:component>

BoatSearchController.js
({
     doInit: function(component) 
    {
       console.log('inside do init '); 
        debugger;
       var action=component.get('c.getSearchOptions');
        action.setcallback(this,function(response)
         {
             debugger;
             var state = response.getState();
             if (state === "SUCCESS")
             {
                 debugger;
                 console.log('inside success state');
                 component.set('v.searchOptionToIdMap',response.getReturnValue());
                 var custs = [];
                 var conts = response.getReturnValue();
                 for(var key in conts)
                 {
                    console.log('populated list');
                     custs.push({value:conts[key], key:key});
                 }
                 component.set("v.searchOptions", custs);
             }
             
         }); 
    }, 
     createBoat: function (component) 
     {
            console.log('inside controller');
            var createRecordEvent = $A.get('e.force:createRecord');
            if (createRecordEvent) 
            {
                    var typeName = component.find('typeSelect').get('v.value');
                    var typeMap = component.get('v.searchOptionToIdMap');
                    var typeId = null;
                    if (typeName && typeMap && typeMap[typeName]) 
                    {
                            typeId = typeMap[typeName];
                    }
                    createRecordEvent.setParams({
                        'entityApiName': 'Boat__c',
                        'defaultFieldValues': {
                            'BoatType__c': typeId
                        }
                    });
                    createRecordEvent.fire();
            }
       }
})
BoatSearchHelper.js
({
    renderNewButton: function (component) {
    var createRecordEvent = $A.get('e.force:createRecord');
    if (createRecordEvent) {
        component.set('v.showNewButton', true);
    }
}})

Apex Controller:
public with sharing class BoatSearchForm
{
        @AuraEnabled
        public static Map<String, String> getSearchOptions() 
        {
                List<BoatType__c> boatTypes = [SELECT Id, Name FROM BoatType__c LIMIT 400];
                Map<String, String> returnMap = new Map<String, String>();
                if(!boatTypes.isEmpty())
                {
                        for(BoatType__c bt: boatTypes)
                        {
                            returnMap.put(bt.Name, bt.Id);
                        }
                }
                return returnMap;
        }
}
FriendswithBoat.app
<aura:application extends="force:slds">
    <lightning:layout >
                 
                 <lightning:card title="Find a Boat" class="slds-m-top_10px" >
                          <c:BoatSearchForm />
                 </lightning:card>

    </lightning:layout>
</aura:application>

Whenever I try to load my app I get this error:
User-added image

Something is wrong with my component. I am not able to identify it. Can anyone help me with this?
We are getting the following error upon clicking on a tab which will create lighting component from the javaScript -
Uncaught (in promise) TypeError: Cannot set property 'innerHTML' of null
    at AuraInstance.message (/auraFW/javascript/zsWZWPmRKjQt6GsG2UtCYg/aura_proddebug.js:18708)
    at AuraInstance.handleError (/auraFW/javascript/zsWZWPmRKjQt6GsG2UtCYg/aura_proddebug.js:18676)
    at AuraInstance.$reportError$ (/auraFW/javascript/zsWZWPmRKjQt6GsG2UtCYg/aura_proddebug.js:18685)
    at reportError (/auraFW/javascript/zsWZWPmRKjQt6GsG2UtCYg/aura_proddebug.js:18523)

Please help me with any work around.

Thanks,
Srinivas

Hi,
I'm stuck at the first challenge where it always returns me:
Could not find an entry in the ServiceCredentials custom setting named 'BillingServiceCredential' with the specified username and password. Ensure the you have entered the data correctly into the custom settings record.
I think that I did everything right. The unmanaged package came with a custom setting called ServiceCredentials:

User-added image
I clicked manage and added the BillingServiceCredential

User-added image

With following details
User-added image

Still giving me above error!
Any ideas?

Regs,
Pieter

how to call apex class from process builder?
Hi

I need to copy the field value from one object to other object.Both are look up relation ship.i have written a batch class for coping field from one to other automatically .
 
global class CopyStudtoAdr_Batch implements Database.Batchable<sObject>
{
global Database.QueryLocator start(Database.BatchableContext BC)
{
     String query='SELECT ID,Closing_Balance__c,DailyUpdate__c FROM Debtors_Ledger__c';
     return Database.getQueryLocator(query);
   }
    global void execute(Database.BatchableContext BC, List<Debtors_Ledger__c> scope)
    {
      System.debug('Batch Class Started....');
      
      List<MasterCopy__c> adrToUpdate = [Select Id,Date__c,Closing_Balance__c ,Master__c from MasterCopy__c where Master__c in : Scope];

     Map<ID,Debtors_Ledger__c> stdMap = new Map<ID,Debtors_Ledger__c>(scope) ;
       
       // Loop to copy account Student to Address phone
       for(MasterCopy__c adr : adrToUpdate)
        {
         adr.Closing_Balance__c =  stdMap.get(adr.Master__c ).Closing_Balance__c;
         adr.Date__c=  stdMap.get(adr.Master__c ).DailyUpdate__c ;

         }
       if(adrToUpdate.size() > 0)
       update adrToUpdate;
      }
     global void finish(Database.BatchableContext ctx)
      {}
}

 
Hi Guys,
  1. Until the Spring 15 release, Maps and Sets are Unordered Collections. So the returned order will be random.
  2. But beginning from Summer 15 release onwards, Maps and Set order is predictable. The order will be same that what you put from the beginning to end.
Example:
Map<String, String> orderedMap = new Map<String, String>();
orderedMap.put('Good', 'This is so good');
orderedMap.put('Bad', 'This is so bad');
System.debug(orderedMap);

If you run the above code snippet in Developer console you will get the returned order as below,

Until Spring 15 Release:

{Bad=This is so bad, Good=This is so good}

From Summer 15 Release:

{Good=This is so good, Bad=This is so bad}

This changes is not the API level, this is Schema level change. If anyone relying on the Map or Set order in your codes, change it as soon. 

Thanks.
Hi friends,

I have written a test class for my trigger in account object.
But whever i run the test class, i am getting the fowwing error


FATAL_ERROR|System.TypeException: Methods defined as TestMethod do not support Web service callouts, test skipped.

I have some of the managed packages inside the Account object.
The same test class when i run before refreshing my sandbox it was working fine. But the problem started after refreshing the sandbox. But other object testclasses r running correctly.

Here is my complete error message

00:25:27.648 (3648848170)|CODE_UNIT_FINISHED|territoryownerTest.checkStateCountry 00:25:27.650 (3650894509)|EXECUTION_FINISHED 00:25:27.654 (3654729375)|ENTERING_MANAGED_PKG|ClientSuccess 00:25:27.655 (3655562162)|FATAL_ERROR|System.TypeException: Methods defined as TestMethod do not support Web service callouts, test skipped (ClientSuccess) 00:25:27.655 (3655576096)|FATAL_ERROR|System.TypeException: Methods defined as TestMethod do not support Web service callouts, test skipped (ClientSuccess)

Can anyone tell me how to resolve this issue.




 
I am new in Salesforce. Today I have downloaded Data Loader to check import functionality from desktop. But when I am trying to get login via Data Loader, it's give error. 'Error log in to Salesforce' whereas I can login into salesforce in browser with same credential.

Will you please help me out this problem?
Hi folks,

I have a requirement where i need to add the values(like 8,5,6 etc) that r entered into the dynamically created textboxes.
The fixed text box should populate with the added value as v enter the values into the dynamically created textbox.
I have vf and controller.
I just need javascript to perform the the addition of values from the dynamically created textbox instantly as i enter numbers and show in the text box.

TIA
Hi friends,

Is it possible to display a list based on the rowIndex.
Soql query.
Hai folks,

I have a table with 7 rows.
The last column of each row has action buttons [add] and [delete]
Now when i click on add button of the first row, new row should get created below it. Now with the following code, new row is getting created at the end of all 7 row's. i.e. it is getting created as 8th row.
Any workaround??
 
Visualforce Page

<apex:page standardController="Account" extensions="addAttendee" sidebar="false">
 <apex:form >
 <apex:pageBlock title="Accounts" id="pb">

 <apex:pageMessages />
 <apex:variable var="rowNumber" value="{!0}"/>
 <apex:pageblockSection columns="1">
 
 <apex:pageBlockTable title="Contacts" var="acc" value="{!attendeeList}"> 
 
 <apex:column headerValue="First Name" >
 <apex:inputField value="{!acc.FirstName}"/>
  <apex:param value="{!rowNumber+1}" /> 
 </apex:column> 
 <apex:column headerValue="Last Name" >
 <apex:inputField value="{!acc.LastName}"/>
 </apex:column> 
 <apex:column headerValue="Phone" >
 <apex:inputField value="{!acc.Phone}"/>
 </apex:column> 
 <apex:column headerValue="Email" >
 <apex:inputField value="{!acc.Email}"/>
 </apex:column> 
 <apex:column headerValue="Action" >
 <apex:commandButton value="Delete" action="{!deleteRow}" reRender="pb">
 <apex:commandButton action="{!addRow}" value="Add Attendee" reRender="pb"/>
 <apex:param name="rowIndex" value="{!rowNumber}"/>
 </apex:commandButton>
 <apex:variable var="rowNumber" value="{!rowNumber+1}"/>
 </apex:column> 
   
 </apex:pageBlockTable>
 
 <apex:commandButton action="{!addRow}" value="Add Attendee" reRender="pb"/>
 </apex:pageblockSection>
 <apex:pageBlockButtons >
 <apex:commandButton value="Save" action="{!ave}" />
 <apex:commandButton value="Cancel" action="{!cancel}"/>
 </apex:pageBlockButtons>
 
 </apex:pageBlock>
 
 </apex:form> 
 </apex:page>
Apex Code

public class addAttendee {
public Account accounts;
public Contact del;
public String currentRecordId {get;set;}
public List<Contact> addattendeeList {get;set;}
public List<Contact> delattendeeList {get;set;}
public List<Contact> attendeeList {get;set;}
public Integer totalCount {get;set;}
public Integer rowIndex {get;set;}
public List<Contact> delAttendees {get; set;} 
 
 
 public addAttendee(ApexPages.StandardController controller) {
 accounts = (Account)controller.getRecord();
 currentRecordId  = ApexPages.CurrentPage().getparameters().get('id');
 //attendeeList = [Select id, firstName, LastName, Email, Phone from Contact where AccountId =: accounts.Id];
 attendeeList = [Select id, firstName, LastName, Email, Phone from Contact where AccountId =: currentRecordId];
 totalCount = attendeeList.size();
 delattendeeList = new List<Contact>();
 delattendees = new List<Contact>();
 attendeeList.add(new Contact(AccountId = accounts.Id));
 }
 
 
 
 public void addRow(){
 //addattendeeList = new List<Contact>();
 attendeeList.add(new Contact(AccountId = accounts.Id));
 }
 
 public PageReference ave(){
 
 upsert attendeeList;
 delete delattendeeList;
 return (new ApexPages.StandardController(accounts)).view();
 } 
 
 public void deleteRow(){
 
 rowIndex = Integer.valueOf(ApexPages.currentPage().getParameters().get('rowIndex'));
 System.debug('rowbe deleted ' + rowIndex );
 System.debug('rowm to be deleted '+attendeeList[rowIndex]);
 del = attendeeList.remove(rowIndex);
 delattendeeList.add(del);
 
 }
 }



 
I am looking to map the Lead Record Type to the Opportunity Record Type when I convert the lead. Right now the Opportunity Record Type populates with a default value. I have only written a few apex triggers as of now and am still new to salesforce, I appreciate any help! 
This is my test class:

@isTest(seeAllData = true)
public with sharing class NUBSCartControllerTest{
    
    static testMethod void NUBSCartControllerTestMethod() {
       
       Contact c = new Contact();
       c.firstName = 'Charles';
       c.lastName = 'Cox';
       c.email = 'charliecox17@yahoo.com';
       insert c;
       
       Event_Registration__c er = new Event_Registration__c ();
       er.name = 'CharlesConference';
       er.hasPaid__c = false;
       er.Applicant_Name__c = c.id;
       insert er;
       
       Id stnd = Test.getStandardPricebookId();
       
       Product2 p = new Product2();
       p.name = 'Thursday, March 26, Opening Reception';
       insert p;
       
       ConProd_Bridge__c cpb = new ConProd_Bridge__c();
       cpb.Product__c = p.id;
       cpb.Contact__c = c.id;
       insert cpb;
       
       PricebookEntry pbe= new PricebookEntry();
       pbe.Product2Id = p.Id;
       pbe.unitPrice = 30;
       pbe.Pricebook2Id = stnd;
       pbe.isActive = true;
       insert pbe;
       
       Opportunity o = new Opportunity();
       o.Name = 'thisOpp';
       o.Amount = 30;
       o.stageName = 'Prospecting';
       o.closeDate = Date.TODAY().addYears(1);
       o.Contact__c = c.id;
       insert o;
       
       OpportunityLineItem ole = new OpportunityLineItem();
       ole.UnitPrice = 30;
       ole.OpportunityId = o.id;
       ole.PriceBookEntryId = pbe.id;
       ole.Quantity = 1;
       insert ole;
       
       Test.setCurrentPageReference(new PageReference('Page.myPage'));
       System.currentPageReference().getParameters().put('oppId', o.id);
       System.currentPageReference().getParameters().put('isConference', 'true');
     
       NUBSCartController contr = new NUBSCartController();
       
       contr.BillingFirst = 'Charles';
       contr.BillingLast = 'Cox';
       contr.BillingAddress = '26 West';
       contr.BillingCity = 'Austin';
       contr.BillingState = 'Texas';
       contr.BillingCountry  = 'United States';
       contr.BillingPostcode = '78681';
       
       contr.CardType = 'Visa';
       contr.CardNumber = '4111111111111111';
       contr.CardMonth = '12';
       contr.CardYear = '2038';
       contr.CardSecurity = '123';
       
       contr.cancel();     
       contr.preCharge();
       contr.processPayment();
    
       contr.isConference = 'false';
       contr.sendEmails(c);
    }    
}


I get the error 'TestMethod do not support Web service callouts' when I run the test with seeAlldata = true but not when seeAllData = false. I need to have seeAllData = true so I need to figure this error out. I don't see where I am using a web service call...

Any help would be great,

Thanks! 

Hi,

 

Is it possible to dynamically set the Sender Address on an email when using a SalesForce Email Template in Apex?

 

Thanks,

Kannan