Toggle Side Panel

  • Home
  • Articles
    • All Articles
    • Blogs
    • Videos
    • Infographics
  • Consultants
    • Salesforce Product Expertise
      • Top Salesforce ConsultantsTop Salesforce Consultants
      • Marketing Cloud ConsultantsMarketing Cloud Consultants
      • Service Cloud ConsultantsService Cloud Consultants
      • Experience Cloud ConsultantsExperience Cloud Consultants
      • Analytics Cloud ConsultantsAnalytics Cloud Consultants
    • Salesforce Industry Expertise
      • Non-Profit Cloud ConsultantsNon-Profit Cloud Consultants
      • Financial Service Cloud ConsultantsFinancial Service Cloud Consultants
      • Health Cloud ConsultantsHealth Cloud Consultants
      • Commerce Cloud ConsultantsCommerce Cloud Consultants
      • Manufacturing Cloud ConsultantsManufacturing Cloud Consultants
    • Salesforce Experts by Location
      • USATop Salesforce Consultants in USA
      • IndiaTop Salesforce Consultants in India
      • AustraliaTop Salesforce Consultants in Australia
      • United KingdomTop Salesforce Consultants in UK
      • CanadaTop Salesforce Consultants in Canada
  • Webinars
  • Marketplace
  • Advertise With Us
  • Contact Us
  • Discussions
More options
    Sign in Sign up
    • Home
    • Articles
      • All Articles
      • Blogs
      • Videos
      • Infographics
    • Consultants
      • Salesforce Product Expertise
        • Top Salesforce ConsultantsTop Salesforce Consultants
        • Marketing Cloud ConsultantsMarketing Cloud Consultants
        • Service Cloud ConsultantsService Cloud Consultants
        • Experience Cloud ConsultantsExperience Cloud Consultants
        • Analytics Cloud ConsultantsAnalytics Cloud Consultants
      • Salesforce Industry Expertise
        • Non-Profit Cloud ConsultantsNon-Profit Cloud Consultants
        • Financial Service Cloud ConsultantsFinancial Service Cloud Consultants
        • Health Cloud ConsultantsHealth Cloud Consultants
        • Commerce Cloud ConsultantsCommerce Cloud Consultants
        • Manufacturing Cloud ConsultantsManufacturing Cloud Consultants
      • Salesforce Experts by Location
        • USATop Salesforce Consultants in USA
        • IndiaTop Salesforce Consultants in India
        • AustraliaTop Salesforce Consultants in Australia
        • United KingdomTop Salesforce Consultants in UK
        • CanadaTop Salesforce Consultants in Canada
    • Webinars
    • Marketplace
    • Advertise With Us
    • Contact Us
    • Discussions
    Close search

    Activity › Forums › Salesforce® Discussions › How can I create a Chatter Free License user in a test class?

    Tagged: Chatter Free License, Salesforce Visualforce, Unit Testing, User Profile, User Record

    • Salesforce® Discussions

      How can I create a Chatter Free License user in a test class?

      Posted by Ravi on April 30, 2016 at 6:14 PM

      How can I create a Chatter Free License user in a test class?

      Ajit replied 10 years ago 2 Members · 1 Reply
      • Chatter Free License
      • Salesforce Visualforce
      • Unit Testing
      • User Profile
      • User Record
    • 1 Reply
    • Ajit

      Member
      April 30, 2016 at 6:19 PM

      The license isn't actually connected to the user, but depends on the profile you assign your user. If you create a user with the Chatter Free User profile, the usertype will be set to Chatter free.

      5.0 APEX_CODE,DEBUG
      Execute Anonymous: Profile p = [SELECT id, Name FROM Profile where name = 'Chatter Free User' ].get(0);
      Execute Anonymous:
      Execute Anonymous: User u = new User(firstname= 'Samuel',
      Execute Anonymous: lastname='De Rycke',
      Execute Anonymous: Alias='Samuel',
      Execute Anonymous: email = 'nospamplz@absi.be',
      Execute Anonymous: username= 'nospamplz@absi.be',
      Execute Anonymous: profileId= p.id,
      Execute Anonymous: emailencodingkey='UTF-8',
      Execute Anonymous: languagelocalekey='en_US',
      Execute Anonymous: localesidkey='en_US',
      Execute Anonymous: timezonesidkey='America/Los_Angeles');
      Execute Anonymous: insert u;
      Execute Anonymous:
      Execute Anonymous: u = [select usertype from user where id =:u.id];
      Execute Anonymous:
      Execute Anonymous: system.debug('--------------------------->User.UserType:'+u.usertype);
      13:15:05.040 (40786000)|EXECUTION_STARTED
      13:15:05.040 (40800000)|CODE_UNIT_STARTED|[EXTERNAL]|execute_anonymous_apex
      13:15:05.769 (769888000)|USER_DEBUG|[17]|DEBUG|--------------------------->User.UserType:CsnOnly
      13:15:05.820 (820554000)|CODE_UNIT_FINISHED|execute_anonymous_apex
      13:15:05.820 (820567000)|EXECUTION_FINISHED

    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

    [adinserter block="12"]

    Popular Salesforce Blogs

    B2B Marketing Strategy

    Fuel Your B2B Marketing Strategy with Salesforce Marketing Cloud

    Blog in Salesforce Cloud Platform

    Are you thinking of using a top-quality marketing automation tool? Yes, it can take your marketing efforts to the highest level. However, when you begin…

    B2B Brands, B2B Business Marketing, B2B Companies, B2B Marketers, B2B Marketing
    Innovadel Sep 21, 2022
    2,426  Views

    Things to Consider Before Choosing CDP Implementation Partner

    Blog in Salesforce

    Are you looking for a Salesforce CDP integration and implementation services provider and don’t know how to choose the right CDP for your business, then…

    budget, Business, Business Challenges, Business Intelligence Tools, Business Niche
    Fexle Services Aug 28, 2023
    1,363  Views

    Salesforce Sales Cloud vs Service Cloud

    Blog in Salesforce

    Salesforce Sales Cloud and Service Cloud are two powerful tools that can help businesses of all sizes manage their customer interactions and data more effectively.…

    Automation, Better Visibility, Business Needs, Business Success, Case Management
    Concretio Nov 9, 2023
    1,554  Views

    Popular Salesforce Videos

    Salesforce Agentforce for Nonprofits

    Salesforce Agentforce for Nonprofits

    Video in Others

    With Salesforce's latest AI tool, Agentforce, you can boost your Salesforce org with AI agents that can streamline workflows, reduce costs, and improve your constituent…

    salesforce, CRM, AI, Digital Transformation, Workflows
    DB Nov 25, 2025
    138  Views
    What is Classic Email Templates and Documents? Salesforce Tutorial

    What is Classic Email Templates and Documents? Salesforce Tutorial

    Video in Salesforce Training

    Classic Email Templates are also called Communication Templates. Watch this video and learn all about it, if you have any doubts or concerns, do reach…

    Salesforce Training, Salesforce Tutorial, Salesforce Online Training, salesforce, Salesforce Video
    CRS May 9, 2022
    1,575  Views
    How to Set Up a B2B Marketing Analytics Plus App | Salesforce

    How to Set Up a B2B Marketing Analytics Plus App | Salesforce

    Video in Marketing

    This video shows marketers how they can create a B2B Marketing Analytics Plus app, such as Marketing Campaign Intelligence or Account-Based Marketing. So to get…

    Salesforce Tutorial, salesforce, Salesforce Video, salesforce app, Salesforce Learning
    Nauman Aug 6, 2020
    1,733  Views
    Footer Forcetalks logo

    support@forcetalks.com

    • twitterx

    Quick Links

    Advertise with Us

    Salesforce® Articles

    Dreamforce 2023

    Top Salesforce® Bloggers 2023

    Top Salesforce Consultants

    Get Listed

    Company

    Contact Us

    About Us

    Privacy Policy

    Terms & Conditions

    InsightHub

    Salesforce Blogs

    Salesforce Videos

    Salesforce Groups

    Salesforce Jobs

    © 2026 - 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®.

    We use cookies to enhance your browsing experience. Please see our privacy policy if you'd like more information on our use of cookies.