• Sandeep Yadav
  • NEWBIE
  • 64 Points
  • Member since 2017
  • Salesforce Developer


  • Chatter
    Feed
  • 1
    Best Answers
  • 0
    Likes Received
  • 1
    Likes Given
  • 5
    Questions
  • 25
    Replies
Apex class
-------------
public class StringStack {

      private List<String> stack;

    public StringStack()
    {
         stack = new List<String>();

    }

    public void push(String s)
    { 
        stack.add(s); 
    }
    public String pop() 
    {
       
    return stack.remove( lastItemIndex );
    }
    public String peak() 
    {

        return stack.get( lastItemIndex );

    }

 
    public Boolean isEmpty() 
    { 
        return stack.isEmpty();
    }
     

    // Helper Property

    private Integer lastItemIndex
    {
        get 
        { 
            return stack.size() - 1;
            }
    }

}



Test clas
------------
@isTest
public class TestStringStack 
 {
public static testmethod void StringStackcheck()
{
    //Instantiate a StringStack.

    StringStack stack = new StringStack();
 // Set up some test data.

    String bottomString = 'Bottom String';
    String middleString = 'Middle String';
    String topString = 'Top String';

      // Call the push() method with multiple objects

    stack.push(bottomString);

    stack.push(middleString);
    stack.push(topString);

    // Verify that the 'top' object is the object we expected

    String peakValue = stack.peak();

    System.assertEquals(topString, peakValue);

    // Verify that the order of the objects is as we expected
    String popValue = stack.pop();
    System.assertEquals(topString, popValue);
    popValue = stack.pop();
    System.assertEquals(middleString, popValue);
    popValue = stack.pop();
    System.assertEquals(bottomString, popValue);
    System.assert(stack.isEmpty());

}
 }
Hi everyone,
Here is my code--
when I debug it shows null value.
Any suggestion ??
<apex:page controller="AlertConId" >
  
  <script type="text/javascript">
      
      function demo(fst,lst)
      {
          var fn = document.getElementById(fst).value;
          var ln = document.getElementById(lst).value;
          myFunction(fn,ln);
      }
  </script>
  
  <apex:form >
      <apex:actionFunction name="myFunction" action="{!save}">
          <apex:param value="" name="fname" assignTo="{!fname}"/>
          <apex:param value="" name="lname" assignTo="{!lname}"/>
      </apex:actionFunction>
      
      <apex:pageBlock id="ref">
          <apex:pageBlockSection >
              <apex:inputText id="fname" label="FirstName"/>
              <apex:inputText id="lname" label="LastName"/>
              
              <apex:commandButton value="Go" onclick="demo('{!$Component.fname}','{!$Component.lname}')" reRender="ref"/>
          </apex:pageBlockSection>
      </apex:pageBlock>
  </apex:form>
</apex:page>

------------------------------------------------------------------------------------------------------------

public class AlertConId 
{
    public Contact ct {get;set;}
    public string fname {get;set;}
    public string lname {get;set;}
    
    public void save()
    {
        string first = ApexPages.currentPage().getParameters().get('fname');
        string last = ApexPages.currentPage().getParameters().get('lname');
        system.debug(first + last);
        
        ct = new Contact();
        ct.firstname = first;
        ct.lastname = last;
        try{
            insert ct;
        }
         catch(Exception e){}
    }
}

 
Hello everyone,
I want to upload a number of files when I select a value in the picklist.i.e. when I select 2 in picklist then it uploads only two files and so on.
Here is the code what I did to achieve this.
Thanks in advance
VF Page--

<apex:page standardController="Document" extensions="MyDocuments">
  <apex:form >
      <apex:pageBlock >          
          <apex:selectList value="{!len}" size="1">
              <apex:selectOptions value="{!option}"/>
              <apex:actionSupport event="onchange" action="{!uploadMultiFile}" reRender="lab"/>
          </apex:selectList>
      </apex:pageBlock>
      
      <apex:pageBlock title="UpLoad A File">
          <apex:pageBlockSection id="lab">
              <apex:repeat value="{!total}" var="t">
                  <apex:inputFile value="{!doc.body}" fileName="{!doc.name}"/>
              </apex:repeat>
              <apex:commandButton value="Save" action="{!save}"/>

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

---------------------------------------------------------------------------------------------------------------------
Controller--

public class MyDocuments {
    
    public document doc {get;set;}
    public List<selectOption> option {get;set;}
    public String len {get;set;}
    public Integer total {get;set;}
    
    
    public MyDocuments(ApexPages.StandardController controller) 
    {
        doc = (Document)controller.getRecord();
        doc.folderId = UserInfo.getUserId();
        
        option = new List<selectOption>();
        option.add(new selectOption('','--None--'));
        for(Integer i=1; i<=10; i++)
        {
            option.add(new selectOption('val'+i,string.valueOf(i)));
        }
        
    }
    
    public void uploadMultiFile()
    {
        if(len == 'val1')
        {
            total = 1;
        }
        if(len == 'val2')
        {
            total = 2;
        }
    }

}

 
Am, using the concept of Wrapper class. I want to delete recently created contact record from pageBlockTable.
I am facing Unknown property 'SingleRecordDelete.ContactWrp.id' Error
Here is What I did--

VF page

<apex:page controller="SingleRecordDelete">
  <apex:form >
     <apex:pageBlock title="Contacts">
          <apex:pageBlockSection title="New Contact" columns="2" id="fresh">
              <apex:inputText label="FirstName" value="{!fname}" />
              <apex:inputText label="LastName" value="{!lname}"/>
              <apex:commandButton action="{!save}" value="Save" reRender="lab,fresh"/>
          </apex:pageBlockSection> 
         
          <apex:pageBlockSection title="ContactList" id="lab">
              <apex:pageBlockTable value="{!crp}" var="cy" id="update">
                  <apex:column headerValue="FirstName">
                      <apex:outputLabel value="{!cy.cn.firstname}"/>
                  </apex:column>
                  <apex:column headerValue="LastName">
                      <apex:outputLabel value="{!cy.cn.lastname}"/>
                  </apex:column>
                  <apex:column >
                         <apex:commandLink value="Delete" action="{!doDelete}" style="color:Red" reRender="lab">
                             <apex:param name="did" value="{!cy.id}" assignTo="{!did}"/>
                         </apex:commandLink>
                  </apex:column>
                  
              </apex:pageBlockTable>
                  
          </apex:pageBlockSection> 
               
     </apex:pageBlock>
  </apex:form>
</apex:page>

ApexClass
public with sharing class SingleRecordDelete {

    public String fname {get;set;}
    public String lname {get;set;}
    public String did {get;set;}
    
    public List<ContactWrp> crp {get;set;}
    
    public SingleRecordDelete(){
        crp = new List<ContactWrp>();
        
    }
    
    public void save(){
      Contact c = new Contact();
      c.firstname = fname;
      c.lastname = lname;
      insert c;
      crp.add(new ContactWrp(c));
      fname='';
      lname='';
    }
    
    public void doDelete()
    {
        List<Contact> contactToBeDelete = new List<Contact>();
        Contact cod = [select id from Contact where id =: did];
        contactToBeDelete.add(cod);
        delete contactToBeDelete;
    }
    
     public class ContactWrp{
    
      public Contact cn {get;set;}
      
        public ContactWrp(Contact cs){
            this.cn = cs;                   
        }
    }
}
On execution this in my Anonymous window --

List<List<sObject>> searchList = [FINd 'Mission Control' in ALL Field
                                   RETURNING Contact(FirstName,LastName,Email,Phone,Department)];

 Contact[] searchContacts = (Contact[])searchList[0];
    System.debug(searchContacts[0].LastName + ' ,' + searchContacts[0].FirstName);

a PopBox says that-
Unexpected Token at Line 1

 
Why I am getting this error--
"Executing the 'insertNewAccount' method failed. Either the method does not exist, is not static, or does not insert the proper account."
my code--

public class AccountHandler {

     public static Account insertNewAccount(String name){
        
          Account a = new Account();
          a.Name = 'name';
        
        try{
            insert a;
        }
        catch(Exception e){
            return null;
        }    
       return a;
    }
}
Hi devs!
I'm having a problem when assigning a value into a custom field in a custom object. The error message is the following:
Line: 6, Column: 1
System.DmlException: Insert failed. First exception on row 0; first error: INVALID_OR_NULL_FOR_RESTRICTED_PICKLIST
Some important points:
  • I need it to be restricted.
  • This field doesn't use a global value set.
  • There's no record types defined for this object.
  • The value I'm trying to set are in the value set, and I already checked for typos.
  • If I unmark the "Restrick picklist to values..." option, the record saves, but an identical value is added to the picklist. 
  • I use the API value for the assignation, but I've tried with Label too.
  • The user can set the value trhough User Interface correctly
What could be happening here? 
Regards,
Mario Bravo
I tried a simpe code to display a list of contacts in vfpage
public class Payment {
public List<Contact> ls{get;set;}
public Set<String> st{get;set;}
public string str{get;set;}


    public Payment(){
    List<Contact> ls = new List<Contact>();
    ls = [select id, name from contact limit 3];
    Set<String> st = new Set<String>();
    st.add('1111111');
    st.add('addad');
    st.add('gxghdy');
    st.add('6366vx');
    str = '123';
    
    }
}

<apex:page controller="Payment">
    {!ls}{!st}{!str}
    <apex:pageBlock >
        <apex:pageBlockTable value="{!ls}" var="a">
            <apex:column value="{!a.name}"/>
        </apex:pageBlockTable>
    </apex:pageBlock>
</apex:page>
User-added image
checked all sharing settings every thing is public
this is my new dev edition signedup today
i had same issue with one signed up this month
is this a bug or an issue with my code

--- I can see contacts in debug logs
 
  • March 10, 2018
  • Like
  • 0
Apex class
-------------
public class StringStack {

      private List<String> stack;

    public StringStack()
    {
         stack = new List<String>();

    }

    public void push(String s)
    { 
        stack.add(s); 
    }
    public String pop() 
    {
       
    return stack.remove( lastItemIndex );
    }
    public String peak() 
    {

        return stack.get( lastItemIndex );

    }

 
    public Boolean isEmpty() 
    { 
        return stack.isEmpty();
    }
     

    // Helper Property

    private Integer lastItemIndex
    {
        get 
        { 
            return stack.size() - 1;
            }
    }

}



Test clas
------------
@isTest
public class TestStringStack 
 {
public static testmethod void StringStackcheck()
{
    //Instantiate a StringStack.

    StringStack stack = new StringStack();
 // Set up some test data.

    String bottomString = 'Bottom String';
    String middleString = 'Middle String';
    String topString = 'Top String';

      // Call the push() method with multiple objects

    stack.push(bottomString);

    stack.push(middleString);
    stack.push(topString);

    // Verify that the 'top' object is the object we expected

    String peakValue = stack.peak();

    System.assertEquals(topString, peakValue);

    // Verify that the order of the objects is as we expected
    String popValue = stack.pop();
    System.assertEquals(topString, popValue);
    popValue = stack.pop();
    System.assertEquals(middleString, popValue);
    popValue = stack.pop();
    System.assertEquals(bottomString, popValue);
    System.assert(stack.isEmpty());

}
 }
 

my scenario is when i will click on new opportunity button a new opportunity page should open where i fill the details and click on save then it will redirect to the list page of opportunity where records save with edit and delete link when click on edit link edit page should open i have done till that but when i click on delete link it should deleted i am not abe to do for delete when i am deleting record a new bank page open
 

    <apex:page StandardController="Opportunity" Extensions="secondpage" >
        <apex:form >
        <apex:pageBlock >
    
        <apex:pageBlockButtons location="Top" >
         <apex:commandButton value="Save" action="{!saverec}"/> <br/><br/>
         
         <apex:commandLink action="{!editOpp}" value="Edit"/>
      <apex:param value="{!opp.id}" assignTo="{!selectedAccId}" name="selectedAccId"/>
      <apex:commandLink action="{!deleteOpp}" value="Delete" />
     <apex:param value="{!opp.id}" assignTo="{!selectedAccId}" name="selectedAccId"/>
        </apex:pageBlockButtons>
        <apex:pageblockSection >
           <apex:inputfield value="{!opp.Name}" />
            <apex:inputfield value="{!opp.StageName}"/>
             <apex:inputfield value="{!opp.AccountId}"/>
             <apex:inputfield value="{!opp.Amount}"/>
            <apex:inputfield value="{!opp.closeDate}"/>
       </apex:pageblockSection>
                </apex:pageBlock>   
        </apex:form>
    </apex:page>

----

    public class secondpage {
    
       
        Public Opportunity opp{get;set;}
        Public String op1;
         public id accid{set;get;}
       public String selectedAccId {get;set;}
          public String selectedoppId{get;set;}
        public secondpage(ApexPages.StandardController stdController) {
            
       
            Opp= (Opportunity)stdController.getRecord();
               
            
        }
       
       
        public PageReference saverec() {
           
            insert opp;
           
            pagereference pr = new pagereference('https://c.ap6.visual.force.com/apex/Opp2');
           
            return pr;
        }
    
    
        public Pagereference editOpp()
     {
         
           PageReference ref = new PageReference('/'+selectedAccId+'/e?retURL=%2F'+selectedAccId);
            return ref;
     }
     
     public Pagereference deleteOpp()
     {
            return null;
    
            }
     }

----

    <apex:page Controller="mycontroller1">
    <apex:form >
    <apex:pageBlock >
    <apex:pageBlockSection >
    <apex:pageBlockTable value="{!Opportunitylst}" var="op">
    <apex:column value="{!op.Name}"/>
    <apex:column value="{!op.StageName}"/>
    <apex:column value="{!op.Amount}" />
    <apex:column value="{!op.accountId}"/>
    <apex:column value="{!op.CloseDate}"/>
    <apex:column headerValue="Action" >
      <apex:commandLink value="Edit /" action="{!editOpp}">
        <apex:param value="{!op.id}" assignTo="{!selectedAccId}" name="selectedAccId"/>
        </apex:commandLink>
        
        <apex:commandLink action="{!deleteOpp}" value="Delete"/>
     <apex:param value="{!op.id}" assignTo="{!selectedAccId}" name="selectedAccId"/>
        
        
    </apex:column>                        
    </apex:pageBlockTable>
    </apex:pageBlockSection>
    </apex:pageBlock>
    </apex:form>
    </apex:page>

----
                        
    public class mycontroller1 {
    
        public List<Opportunity> Opp{get;set;}
        Public List<Opportunity> Opportunitylst{get;set;}
        public String selectedAccId {get;set;}
    
    
      public PageReference deleteOpp() {
              
opportunitylst=[select Name,AccountId,Amount,CloseDate,StageName from Opportunity where id=:selectedAccId];      
delete  opportunitylst;     
  return null;
              
              }
    
                 
                 
                 
        public mycontroller1(){
            Opportunitylst=[select Name,AccountId,Amount,CloseDate,StageName from Opportunity order by createdDate DESC limit 10 ];
         }
        public Pagereference editOpp()
     {
         p
           PageReference ref = new PageReference('/'+selectedAccId+'/e?retURL=%2F'+selectedAccId);
            return ref;
     }
    }

 

Hi,
1) I'm learning salesforce through trialhead. Currently working in Visual force module. When I run the below Program in visualforce page I recieve a blank page as an outputand unable to view the account content in the page.
INPUT:
<apex:page standardController="Account" >
<apex:outputField value="{! Account.Name }"/>
<apex:outputField value="{! Account.Phone }"/>
<apex:outputField value="{! Account.Industry }"/> <apex:outputField value="{! Account.AnnualRevenue }"/>
</apex:page>
OUTPUT:
User-added image

2)How to change javascript console in chrome and why it is needed?
Please someone help me for better understanding

Thanks in advance!
Hello everyone, I have a problem that it is driving me crazy. I have radio buttons on my Visualforce page, some of the radio buttons are hidden when you first open the page, but if let's say the radio button #10 is changed to the option 'Yes', I refresh the page and show 2 more radio buttons.

My problem is that it's always reloading the page to the top and I don't want it.
I have this radio buttons inside pageblock and outputpanel.
I was able to make it work to go to a button but not a radio button.

On Apex I have differents functions to each radio button that displays hidden radio buttons.
I called this function like this:
 
<apex:selectRadio value="{!contact.LivesInAmerica__c}" label="Do you live in America?" id="rb1">
     <apex:selectoptions value="{!types}"></apex:selectoptions>
     <apex:actionSupport event="onchange" action="{!functionFirst}"/>
</apex:selectRadio>
<apex:selectRadio rendered="{!showRB1}" value="{!contact.Street__c}" label="Street">
     <apex:selectoptions value="{!types}"></apex:selectoptions>
</apex:selectRadio>
And this code on Apex Class Controller:
 
public PageReference functionFirst(){
        if(contact.LivesInAmerica__c == 'Yes'){
            showRB1= true;
        }
        else {
            showRB1= false;
        }
        return null;
    }

Thanks!

 
After I insert a new Account I want to redirect to a Visual Force page instead of the Account Details page.

Is this possible?
Hi Team,

How can we update child record information from vf page and need to add pagination
controller :
public with sharing class DiplayRelatedContacts {
   public List<Account> accList{get;set;}
   public list<Contact> conList{get;set;}
   public String accId{get;set;}
   public DiplayRelatedContacts(){
       accList=[SELECT Id,Name,AccountNumber FROM Account LIMIT 10];
   
   }
    public PageReference dispalyContact() {
       if(accId != null)
        conList=[SELECT id,FirstName,LastName,Phone,Department,Birthdate FROM COntact WHERE AccountId=:accId];
        update conList;
        return null;
    }    

     public pagereference save() {
     	update accList;
     	update conList;
     	return null;
	}   
}
Vf page 
 
<apex:page controller="DiplayRelatedContacts" id="pg" lightningStylesheets="true">
    <apex:form id="frm">
        <apex:pageBlock id="pgblk" >
            <apex:pageBlockTable value="{!accList}" var="ac">
                <apex:column width="10px">
                    <input type="radio" name="group1" />
                    <apex:actionSupport event="onclick" action="{!dispalyContact}" ReRender="conpgblk" >
                        <apex:param assignTo="{!accId}" name="accname" value="{!ac.id}"/>
                    </apex:actionSupport>
                </apex:column>
                <apex:column value="{!ac.Name}" />
                <apex:column value="{!ac.AccountNumber}" />
            </apex:pageBlockTable>
        </apex:pageBlock>
        
        
        <div id="globaSearch" class="modal fade" role="dialog" width="100%">
            <div class="modal-dialog">
               <div class="modal-content">
                    <div class="modal-header">
                       <!-- <button type="button" class="close" data-dismiss="modal">&times;</button> -->
                        <h4 class="modal-title">Contacts</h4>
                    </div>
                    <div class="modal-body">      
                        <apex:pageBlock id="conpgblk" >
                            <apex:outputPanel rendered="{!conList.size == 0}">
                                <b> NO RELATED CONTACTS FOR THIS ACCOUNT .</b>
                            </apex:outputPanel>
                            <apex:outputPanel rendered="{!conList.size != 0}">
                                <apex:pageBlockTable value="{!conList}" var="con">
                                    <apex:column value="{!con.FirstName}" />
                                    <apex:column value="{!con.LastName}" />                                   
                                    <apex:column ><apex:facet name="header">Birthdate</apex:facet> <apex:inputField value="{!con.Birthdate}"/></apex:column>
                                    <apex:column ><apex:facet name="header">Department</apex:facet> <apex:inputField value="{!con.Department}"/></apex:column>
                                    <apex:column ><apex:facet name="header">Phone</apex:facet> <apex:inputField value="{!con.Phone}"/></apex:column>        
                                </apex:pageBlockTable>
                            </apex:outputPanel>
                         
                            <apex:commandButton value="Save" id="save"/> 
                        </apex:pageBlock>
                        
                    </div>
                    
                </div>
                
            </div>
        </div>
        
    </apex:form>
</apex:page>

It is fetching information of related contacts and unable to update save functionality .
 
Can someone please tell me how should I generate JSON for standard fields. I get error When i do it for standard or lookup fields:

Opportunity Opp = Trigger.new[0] ; 
JSONGenerator gen = JSON.createGenerator(true);    
    gen.writeStartObject();      
    gen.writeStringField('Agency Code', Opp.Agency_Code__c);
    gen.writeStringField('Account',Opp.Account);
    gen.writeStringField('Implementation Contact',Opp.Implementation_Contact__c);
    gen.writeStringField('Implementation Contact Email',Opp.Implementation_Contact__c.Email);
    gen.writeStringField('Implementation Contact ID',Opp.Implementation_Contact__c.Record_ID_full__c);
    gen.writeStringField('Opportunity Owner',Opp.Owner);
    gen.writeStringField('Opportunity Owner Email',Opp.Owner.Email;
    gen.writeStringField('Last Modified By Name',Opp.LastModifiedBy);
    gen.writeStringField('Opportunity ID',Opp.Record_ID_Full__c);
    gen.writeStringField('Account',Opp.Account);
    gen.writeStringField('Account',Opp.Account);
    gen.writeEndObject();    
    String jsonS = gen.getAsString();
System.debug('jsonMaterials'+jsonS);
String endpoint = 'http://www.example.com/service';
HttpRequest req = new HttpRequest();
req.setEndpoint(endpoint);
req.setMethod('POST');
req.setbody(jsonS);
Http http = new Http();
HTTPResponse response = http.send(req);

All the custom fields on opprtunity are working just fine but the lookup fields and standard field shows syntax error.

User-added image
Can anyone please suggest?
  • February 20, 2018
  • Like
  • 0
Hi,
I am having issues with a test class that used to work but after making many changes to the VF and Controller and getting those to work, I started getting the following error "class contructor not defined: [ApexPages.StandardController].<Constructor>() at 14 and then I added the following to the controller: 

    public SandboxRefreshUtilPwdChgController() {

    }  
   
Then I now get the list out of bound error.

THIS IS A PORTION OF THE CONTROLLER:
public with sharing class SandboxRefreshUtilPwdChgController {
    
    //list for holding the wrapped users and Integers to be displayed on the page 
    public List<userWrapper> wrappedObjects = new List<userWrapper>();         
    public List<User> userList;    
    public Map<Id, User> compareMap = new Map<Id, User>();
    
    
    // Constructors 1
    public SandboxRefreshUtilPwdChgController() {

    }  
   
    // Constructor 2
    public SandboxRefreshUtilPwdChgController(ApexPages.StandardController ex) {    
        System.debug('constructor');
        List<User> userList = getUsers();
        Integer i = 0; //integer for tracking the row counter value we want to pass back in the wrapper
        for ( user u : userList ) { //start looping through users
            i++; //increment the integer
            userWrapper wrappedObject = new userWrapper(u, i); //wrap the user with the Integer, which calls the userWrapper class below
            wrappedObjects.add(wrappedObject); //add the wrapper object to our list
        }    
    }    

....
....

AND THIS IS THE TEST CLASS:
@isTest
private class SandboxRefreshUtilPwdChgController_Test {
    @testSetup static void setupTestData() {      
        createUserRecords();
    }
    
    private static testMethod void PasswordChangeSucccesTest() {
        List<User> userList = [SELECT id, Email FROM User WHERE CreatedDate = TODAY];
        System.debug('TEST: userList.size(): ' + userList.size());
        
        Test.startTest();
            PageReference pageRef = Page.SandboxRefreshUtilPwdChg;
            Test.setCurrentPage(pageRef);
            SandboxRefreshUtilPwdChgController con = new SandboxRefreshUtilPwdChgController();            //1st error before change
            con.getWrappedObjects()[0].pwd = 'PwT5Srefresh!';          //current error after adding a blank constructor
            con.UpdatePasswords(); 
            System.assertEquals('Yes', con.getWrappedObjects()[0].successfulChange, 'Password Change failed!');
        Test.stopTest();
    }
    


Appreciate your support
Tom
 
i want to create description custom fields on account and contact object
now i want to create a trigger on account object such that when i insert a record on account object contact shoul also be created with with the custom field updated same as account
please help me to achieve this 

 
I want to auto update Account address when I create Contact and save account address should save in contact address by using process builder and Apex please can anyone help me on this 
Am, using the concept of Wrapper class. I want to delete recently created contact record from pageBlockTable.
I am facing Unknown property 'SingleRecordDelete.ContactWrp.id' Error
Here is What I did--

VF page

<apex:page controller="SingleRecordDelete">
  <apex:form >
     <apex:pageBlock title="Contacts">
          <apex:pageBlockSection title="New Contact" columns="2" id="fresh">
              <apex:inputText label="FirstName" value="{!fname}" />
              <apex:inputText label="LastName" value="{!lname}"/>
              <apex:commandButton action="{!save}" value="Save" reRender="lab,fresh"/>
          </apex:pageBlockSection> 
         
          <apex:pageBlockSection title="ContactList" id="lab">
              <apex:pageBlockTable value="{!crp}" var="cy" id="update">
                  <apex:column headerValue="FirstName">
                      <apex:outputLabel value="{!cy.cn.firstname}"/>
                  </apex:column>
                  <apex:column headerValue="LastName">
                      <apex:outputLabel value="{!cy.cn.lastname}"/>
                  </apex:column>
                  <apex:column >
                         <apex:commandLink value="Delete" action="{!doDelete}" style="color:Red" reRender="lab">
                             <apex:param name="did" value="{!cy.id}" assignTo="{!did}"/>
                         </apex:commandLink>
                  </apex:column>
                  
              </apex:pageBlockTable>
                  
          </apex:pageBlockSection> 
               
     </apex:pageBlock>
  </apex:form>
</apex:page>

ApexClass
public with sharing class SingleRecordDelete {

    public String fname {get;set;}
    public String lname {get;set;}
    public String did {get;set;}
    
    public List<ContactWrp> crp {get;set;}
    
    public SingleRecordDelete(){
        crp = new List<ContactWrp>();
        
    }
    
    public void save(){
      Contact c = new Contact();
      c.firstname = fname;
      c.lastname = lname;
      insert c;
      crp.add(new ContactWrp(c));
      fname='';
      lname='';
    }
    
    public void doDelete()
    {
        List<Contact> contactToBeDelete = new List<Contact>();
        Contact cod = [select id from Contact where id =: did];
        contactToBeDelete.add(cod);
        delete contactToBeDelete;
    }
    
     public class ContactWrp{
    
      public Contact cn {get;set;}
      
        public ContactWrp(Contact cs){
            this.cn = cs;                   
        }
    }
}
Hi, 

The problem:
"Challenge Not yet complete... here's what's wrong: 
The component is not using the correct font size. Ensure that you added it to the 'Style' section of the component bundle.
"

My current solution: 
campingHeader.cmp
<aura:component>
	<H1>Camping List</H1>
</aura:component>
campingHeader.css (in the bundle)
.THIS {
}
H1.THIS {
    font-size:18pt; 
}
I have probably clicked the "Check challenge" 150 times by now with different "solutions" and changes in my code... 
  • I have tested with a fresh DE org and with a new Trailhead playground. 
  • I have tested with pt and px in the font-size unit
  • I have tested multiple variations of capitalized H1 vs. h1 and spaces here and there 
  • I have cursed more the last day then have done the whole last year... 
Can someone please help me what I am missing? I have tested every solution I could find in the forums but none of them works.. I would just skip this badge unless I needed it for the Platform Developer II certification path.......
this is my code but its not woking. any one can help

global class LeadProcessor implements Database.Batchable<sObject> {
    global Database.QueryLocator start(Database.BatchableContext bc){
          String query= 'SELECT Name, LeadSource from Lead';
        return Database.QueryLocator(query);
    }
    global void execute(Database.BatchableContext bc, List<Lead> scope){
        
        for(Lead l: scope){
            l.LeadSource ='Dreamforce';
           
        }
        update scope;
    }
    global void finish(Database.BatchableContext bc){
        
    }
}
Hi all,

i am trying to align my command button in center but its not working i have used all the css properties like align and float in my output panel but still its not working

<apex:page controller="VistAudit_VFC" action="{!createData}">
 <apex:form >
  <apex:outputLabel value="Audit Visit" style="font-family:Times New Roman;font-size:15px">
 </apex:outputLabel><br></br>
 
<apex:outputPanel style="float:centre">
 <apex:commandButton value="Save" action="{!save}"/>
 </apex:outputPanel>

</apex:page>

any help would be appreciated

thanks
i want to create description custom fields on account and contact object
now i want to create a trigger on account object such that when i insert a record on account object contact shoul also be created with with the custom field updated same as account
please help me to achieve this