• Alvin Tan
  • NEWBIE
  • 0 Points
  • Member since 2017

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 3
    Questions
  • 2
    Replies
Is there a way for me to get reference fields name or values easily when I have an instance of an object. For example, Case has the field contact name. In apex when I access this field it is the id of a contact rather than the name. Is there an efficient way for me to get values, specifically name, out of the Contact that belongs to that id without trying having to query the whole contact object and any other reference objects that I may need? 

Thanks!
Hi, I'm struggling with getting ALL of the field names for an object in APEX. When running the code below (in APEX), I am getting most of the fields but it's omitting a few contact fields as well as the comment field. When I run the block of code in anonymous apex, all the fields I need are returning. Is there something I might be missing? Thanks in advanced.
 
Schema.SObjectType targetType = Schema.getGlobalDescribe().get('case');
Map<String, Schema.SObjectField> fieldMap = targetType.getDescribe().fields.getMap();
    for (Schema.SObjectField field : fieldMap.values()) {
         System.debug(field.getDescribe().getName());
     }

 
Is there a way to programmatically get the max number of allowable queued or active scheduled/batch jobs? The Limits class looks like it has most of the limits but not getting the max number of schedulable apex jobs. I understand the standard limit is 5, but is there a case where this number can vary?
Is there a way for me to get reference fields name or values easily when I have an instance of an object. For example, Case has the field contact name. In apex when I access this field it is the id of a contact rather than the name. Is there an efficient way for me to get values, specifically name, out of the Contact that belongs to that id without trying having to query the whole contact object and any other reference objects that I may need? 

Thanks!
Hi, I'm struggling with getting ALL of the field names for an object in APEX. When running the code below (in APEX), I am getting most of the fields but it's omitting a few contact fields as well as the comment field. When I run the block of code in anonymous apex, all the fields I need are returning. Is there something I might be missing? Thanks in advanced.
 
Schema.SObjectType targetType = Schema.getGlobalDescribe().get('case');
Map<String, Schema.SObjectField> fieldMap = targetType.getDescribe().fields.getMap();
    for (Schema.SObjectField field : fieldMap.values()) {
         System.debug(field.getDescribe().getName());
     }