• WHO WE ARE
  • WHAT WE DO
    • Salesforce
      • Implementations
        • Sales Cloud
        • Service Cloud
        • CPQ
        • Field Service Lightning
        • Field Service for SMEs
      • Developments
        • Salesforce Customization
        • Custom Application Development
        • AppExchange Product Development
      • Migrations
        • Classic to Lightning Migration
        • Other Systems to Salesforce Migration
      • Integrations
    • AI/ML
    • Agentic AI
  • HOW WE DO
    • Delivery Model
    • Our Works
  • REACH US
    • Contact Us
    • Careers
  • BLOG
    • WHO WE ARE
    • WHAT WE DO
      • Salesforce
        • Implementations
          • Sales Cloud
          • Service Cloud
          • CPQ
          • Field Service Lightning
          • Field Service for SMEs
        • Developments
          • Salesforce Customization
          • Custom Application Development
          • AppExchange Product Development
        • Migrations
          • Classic to Lightning Migration
          • Other Systems to Salesforce Migration
        • Integrations
      • AI/ML
      • Agentic AI
    • HOW WE DO
      • Delivery Model
      • Our Works
    • REACH US
      • Contact Us
      • Careers
    • BLOG
  • [email protected]
  • (+91) 44-49521562
Merfantz - Salesforce Solutions for SMEs
Merfantz - Salesforce Solutions for SMEs
  • WHO WE ARE
  • WHAT WE DO
    • Salesforce
      • Implementations
        • Sales Cloud
        • Service Cloud
        • CPQ
        • Field Service Lightning
        • Field Service for SMEs
      • Developments
        • Salesforce Customization
        • Custom Application Development
        • AppExchange Product Development
      • Migrations
        • Classic to Lightning Migration
        • Other Systems to Salesforce Migration
      • Integrations
    • AI/ML
    • Agentic AI
  • HOW WE DO
    • Delivery Model
    • Our Works
  • REACH US
    • Contact Us
    • Careers
  • BLOG

How to Get Fields Only from Different Object in a Given String

  • November 7, 2017
  • Merfantz Editor
  • Salesforce Developments Tutorial
  • 0

The below code is convenient to get list of fields come from different object.

For example we have taken a String, which contains Objects Api name like that ObjA__c, ObjB__c, ObjC__c and Fields Api name like that Status__c, Date__c, Description__c.

// Variable Declaration

String allstr = ‘ ObjA__c.Status__c,ObjB__c.Date__c,ObjC__c.Description__c’;

List<String> liststr=new List<String>();

//For Loop Start

for(String str : allstr.split(‘\\,’)){

String[] fieldnames = str.Split(‘\\.’);

system.debug(‘Field Only’+fieldnames[1]);

liststr.add(fieldnames[1]);
}

//For Loop End

system.debug(‘List Values’+liststr);

 

———————- Thank You ———————————-

Author Bio

Merfantz Editor
+ Recent Posts
  • August 4, 2023
    How to Setup CRM Analytics for Financial Services Cloud
  • August 2, 2023
    How to Get Started with Salesforce Hyperforce - Merfantz
  • July 28, 2023
    Health Cloud Mastery: Salesforce Trailhead for Effective Healthcare CRM
  • July 26, 2023
    How to integrate Data cloud and Marketing cloud In Salesforce
  • Previous How to Sign Up FieldAx as Guest User
  • Next Salesforce Introduction

Leave a Reply

You must be logged in to post a comment.

Merfantz Technologies is a leading Salesforce consulting firm dedicated to helping small and medium enterprises transform their operations and achieve their goals through the use of the Salesforce platform. Contact us today to learn more about our services and how we can help your business thrive.

Discover More

Terms and Conditions
Privacy Policy
Cancellation & Refund Policy
Information Security Policy

Contact Info

  • No 96, 2nd Floor, Greeta Tech Park, VSI Industrial Estate, Perungudi, Chennai 600 096, Tamil Nadu, INDIA
  • (+91) 44-49521562
  • [email protected]
  • 9:30 IST - 18:30 IST

Latest Posts

Quantum Cloud: The Future of Business Optimization
Quantum Cloud: The Future of Business Optimization September 16, 2025
Achieving Seamless Digital Transformation with CloudMasonry’s End-to-End Salesforce Solutions September 10, 2025
AI-Driven CRM: How SP Solutions Harnesses Einstein and Agentforce for Smarter Sales September 9, 2025

Copyright @2023 Merfantz Technologies, All rights reserved