Forcetalks Logo

  • Home
  • Articles
    • All Articles
    • Blogs
    • Videos
    • Infographics
  • Consultants
  • Jobs
  • Marketplace
  • Advertise With Us
  • Quizzes
  • Discussions
  • Groups
    Sign in Sign up
    Forcetalks Logo
    Forcetalks Logo

    • Home
    • Articles
      • All Articles
      • Blogs
      • Videos
      • Infographics
    • Consultants
    • Jobs
    • Marketplace
    • Advertise With Us
    • Quizzes
    • Discussions
    • Groups
    Sign in Sign up

    Activity › Forums › Salesforce® Discussions › How to define a custom type for both account and contact object using Wrapper class in Salesforce?

    Tagged: Account Object, Contact Object, Salesforce Apex, Wrapper Class, Wrapper List

    • How to define a custom type for both account and contact object using Wrapper class in Salesforce?

       shradha jain updated 3 years, 9 months ago 2 Members · 2 Posts
      Salesforce® Discussions
      • Account Object
      • Contact Object
      • Salesforce Apex
      • Wrapper Class
      • Wrapper List
    • chanchal kumar

      Member
      July 2, 2018 at 12:28 pm

      How to define a custom type for both account and contact object using Wrapper class in Salesforce?

    • shradha jain

      Member
      August 6, 2018 at 7:09 am

      Hello Chanchal,

      You can refer to the following example to  define a custom type for both acccount and contact object using wrapper class:

      public with sharing class conacc {

      public List<MyWrapper> wrapper {get; set;}

      public List<Account> accLst1 {get; set;
      public List<Contact> conLst1 {get; set;}

      public conacc ()

      {
      accLst1 = [select id,Name from Account ] ;
      conLst1 = [select Id,Name from contact where AccountId IN : accLst1 ] ;
      wrapper = new List<MyWrapper>() ;
      for(Integer i=0 ; i < 20; i++)
      wrapper.add(new MyWrapper( conLst1, accLst1[i])) ;
      System.debug('----------'+ wrapper);
      }
      public class MyWrapper
      {
      public Account accRec1 {get; set;}
      public List<Contact> conRec1 {get; set;}
      public MyWrapper( List<Contact> con ,Account acc )
      {
      accRec1 = acc ;
      conRec1 = con ;
      }

      }

      }

    Viewing 1 - 2 of 2 posts

    Log In to reply.

    • Public
    • All Members
    • My Connections
    • Only Me
    • Public
    • All Members
    • My Connections
    • Only Me
    • Public
    • All Members
    • My Connections
    • Only Me

    Reply

    Subscribe

    Popular Salesforce Blogs

    salesforce integration

    Salesforce to Salesforce Integration Using SOAP API

    Blog in Salesforce integration

    Introduction to SOAP API SOAP API stands for Simple Object Access Protocol API  which supports XML only. It can be used to create, update, delete,…

    Apex Class, Apex from WSDL, Configuration of Salesforce, Salesforce, Salesforce Data
    Kirandeep Jun 3, 2020

    Implemented All In One Donation Management System Using Salesforce

    Blog in Salesforce Products

    The Challenges The client was using a legacy system for all its donation related data entries, while leveraging a suite of vendors to enable their…

    donation management system, nonprofit crm, Salesforce Non Profit CRM
    Rahul Oct 6, 2017
    Lightning Components & AuraEnabled method parameters: What’s working and what’s not?

    Lightning Components & AuraEnabled Method : What’s Working & What’s Not?

    Blog in Lightning

    Parameters Passing from Client-Side to Server-Side is the much-needed part for Lightning component development. Prerequisite to pass a parameter from client-side to server-side: Value of…

    AURA, Aura in Salesforce, AuraEnabled, AuraEnabled Method, Lightning Component
    Aman May 8, 2018

    Popular Salesforce Videos

    Salesforce Development Master Training | Salesforce Development Course

    Salesforce Development Master Training | Salesforce Development Course

    Video in Salesforce Training, Salesforce Development

    Shrey Finally launched the most awaited Salesforce Development Master Training. Features of the course are: Learn Salesforce Development from Scratch with more than 100 on-demand…

    Salesforce Training, Salesforce Tutorial, Salesforce Development, Salesforce Certification, salesforce
    Salesforce Feb 8, 2022
    647  Views
    Drive Personalized and Scalable Idea Management in Salesforce Community Cloud with IdeasPro

    Drive Personalized and Scalable Idea Management in Salesforce Community Cloud with IdeasPro

    Video in Salesforce Products

    IdeasPro enables you to implement the best of business ideas from your Salesforce community. Foster innovation, improve brand transparency, and make the most of internal…

    Salesforce Training, Salesforce Tutorial, salesforce, Salesforce Community, Salesforce Community Cloud
    Grazitti Apr 1, 2022
    405  Views
    Attribute Setup for Skill based Routing in Salesforce

    Attribute Setup for Skill based Routing in Salesforce

    Video in Salesforce Training

    This video is 3rd Part of the Omnichannel Series. Implementation of Attribute set up skill-based routing with the demo. Do let us know in the…

    Salesforce Training, Salesforce Tutorial, salesforce, Salesforce Video, Salesforce Learning
    Pooja Nov 26, 2021
    658  Views
    Footer Forcetalks logo

    [email protected]


    Quick Links

    Advertise with Us

    Salesforce® Articles

    Dreamforce 2021

    Top Salesforce® Bloggers 2021

    Tips to choose Best Salesforce® Consulting Company

    Get Listed

    Company

    Contact Us

    About Us

    Privacy Policy

    Terms & Conditions

    Submissions

    Write a Blog

    Start a New Discussion

    Post a Video

    Post an Infographic

    © 2022 - Forcetalks ● All Rights Reserved

    Salesforce® is a trademark of Salesforce® Inc. No claim is made to the exclusive right to use “Salesforce”. Any services offered within the Forcetalks website/app are not sponsored or endorsed by Salesforce®.

    Report

    Harassment or bullying behavior
    Harassment or bullying behavior
    Contains mature or sensitive content
    Contains misleading or false information
    Mobile App Reported Contents
    Contains abusive or derogatory content
    Contains spam, fake content or potential malware

    Block Member?

    Please confirm you want to block this member.

    You will no longer be able to:

    • See blocked member's posts
    • Mention this member in posts
    • Invite this member to groups
    • Message this member
    • Add this member as a connection

    Please note: This action will also remove this member from your connections and send a report to the site admin. Please allow a few minutes for this process to complete.

    Report

    You have already reported this
    Clear Clear All
    We use cookies to enhance your browsing experience. Please see our privacy policy if you'd like more information on our use of cookies.