Skip to main content
deleted 57 characters in body
Source Link
Alex Tennant
  • 13.7k
  • 5
  • 58
  • 85

I am working on KnowledgeArticleVersion and want to show the list of articles on Visual force page.

SObjectType objToken = Schema.getGlobalDescribe().get('KnowledgeArticleVersion'); DescribeSObjectResult objDef = objToken.getDescribe(); Map<String, SObjectField> fields = objDef.fields.getMap();

    Set<String> fieldSet = fields.keySet();
    for(String s:fieldSet)
    {
        SObjectField fieldToken = fields.get(s);
        DescribeFieldResult selectedField = fieldToken.getDescribe();
       System.debug(selectedField.getName());
    }
SObjectType objToken = Schema.getGlobalDescribe().get('KnowledgeArticleVersion');
DescribeSObjectResult objDef = objToken.getDescribe();
Map<String, SObjectField> fields = objDef.fields.getMap();
     
Set<String> fieldSet = fields.keySet();
for(String s:fieldSet)
{
    SObjectField fieldToken = fields.get(s);
    DescribeFieldResult selectedField = fieldToken.getDescribe();
    System.debug(selectedField.getName());
}

                          

When I try to run this through apex, I get an exception

System.NullPointerException: Attempt to de-reference a null object.

System.NullPointerException: Attempt to de-reference a null object.

I am able to run this SOQL Query using same object,

SELECT Id, Title FROM KnowledgeArticleVersion WHERE PublishStatus='Online' AND language ='en_US'

SELECT Id, Title FROM KnowledgeArticleVersion WHERE
PublishStatus='Online' AND language ='en_US'

The framework that we are using does not allow this SOQL Query to be used and does a describe and fetches fields dynamically.

Can someone please provide a help or pointer on this ?

I am working on KnowledgeArticleVersion and want to show the list of articles on Visual force page.

SObjectType objToken = Schema.getGlobalDescribe().get('KnowledgeArticleVersion'); DescribeSObjectResult objDef = objToken.getDescribe(); Map<String, SObjectField> fields = objDef.fields.getMap();

    Set<String> fieldSet = fields.keySet();
    for(String s:fieldSet)
    {
        SObjectField fieldToken = fields.get(s);
        DescribeFieldResult selectedField = fieldToken.getDescribe();
       System.debug(selectedField.getName());
    }

When I try to run this through apex, I get an exception

System.NullPointerException: Attempt to de-reference a null object.

I am able to run this SOQL Query using same object,

SELECT Id, Title FROM KnowledgeArticleVersion WHERE PublishStatus='Online' AND language ='en_US'

The framework that we are using does not allow this SOQL Query to be used and does a describe and fetches fields dynamically.

Can someone please provide a help or pointer on this ?

I am working on KnowledgeArticleVersion and want to show the list of articles on Visual force page.

SObjectType objToken = Schema.getGlobalDescribe().get('KnowledgeArticleVersion');
DescribeSObjectResult objDef = objToken.getDescribe();
Map<String, SObjectField> fields = objDef.fields.getMap();
     
Set<String> fieldSet = fields.keySet();
for(String s:fieldSet)
{
    SObjectField fieldToken = fields.get(s);
    DescribeFieldResult selectedField = fieldToken.getDescribe();
    System.debug(selectedField.getName());
}

                          

When I try to run this through apex, I get an exception

System.NullPointerException: Attempt to de-reference a null object.

I am able to run this SOQL Query using same object,

SELECT Id, Title FROM KnowledgeArticleVersion WHERE
PublishStatus='Online' AND language ='en_US'

The framework that we are using does not allow this SOQL Query to be used and does a describe and fetches fields dynamically.

Can someone please provide a help or pointer on this ?

added 25 characters in body
Source Link
Dave
  • 663
  • 5
  • 11

I am working on KnowledgeArticleVersion and want to show the list of articles on Visual force page.

SObjectType objToken = Schema.getGlobalDescribe().get('KnowledgeArticleVersion'); DescribeSObjectResult objDef = objToken.getDescribe(); Map<String, SObjectField> fields = objDef.fields.getMap();

    Set<String> fieldSet = fields.keySet();
    for(String s:fieldSet)
    {
        SObjectField fieldToken = fields.get(s);
        DescribeFieldResult selectedField = fieldToken.getDescribe();
       System.debug(selectedField.getName());
    }

When I try to run this through apex, I get an exception

  When ISystem.NullPointerException: tryAttempt to run this through apex, I getde-reference ana exceptionnull object.

System.NullPointerException: Attempt to de-reference a null object.

I am able to run this SOQL Query using same object,

SELECT Id, Title FROM KnowledgeArticleVersion WHERE PublishStatus='Online' AND language ='en_US'

The framework that we are using does not allow this SOQL Query to be used and does a describe and fetches fields dynamically.

Any HelpCan someone please provide a help or Pointerspointer on this... ?

I am working on KnowledgeArticleVersion and want to show the list of articles on Visual force page.

SObjectType objToken = Schema.getGlobalDescribe().get('KnowledgeArticleVersion'); DescribeSObjectResult objDef = objToken.getDescribe(); Map<String, SObjectField> fields = objDef.fields.getMap();

    Set<String> fieldSet = fields.keySet();
    for(String s:fieldSet)
    {
        SObjectField fieldToken = fields.get(s);
        DescribeFieldResult selectedField = fieldToken.getDescribe();
       System.debug(selectedField.getName());
    }
  When I try to run this through apex, I get an exception 

System.NullPointerException: Attempt to de-reference a null object.

I am able to run this SOQL Query using same object,

SELECT Id, Title FROM KnowledgeArticleVersion WHERE PublishStatus='Online' AND language ='en_US'

The framework that we are using does not allow this SOQL Query to be used and does a describe and fetches fields dynamically.

Any Help or Pointers on this...

I am working on KnowledgeArticleVersion and want to show the list of articles on Visual force page.

SObjectType objToken = Schema.getGlobalDescribe().get('KnowledgeArticleVersion'); DescribeSObjectResult objDef = objToken.getDescribe(); Map<String, SObjectField> fields = objDef.fields.getMap();

    Set<String> fieldSet = fields.keySet();
    for(String s:fieldSet)
    {
        SObjectField fieldToken = fields.get(s);
        DescribeFieldResult selectedField = fieldToken.getDescribe();
       System.debug(selectedField.getName());
    }

When I try to run this through apex, I get an exception

System.NullPointerException: Attempt to de-reference a null object.

I am able to run this SOQL Query using same object,

SELECT Id, Title FROM KnowledgeArticleVersion WHERE PublishStatus='Online' AND language ='en_US'

The framework that we are using does not allow this SOQL Query to be used and does a describe and fetches fields dynamically.

Can someone please provide a help or pointer on this ?

Source Link
Dave
  • 663
  • 5
  • 11

List Knowledge Articles on Visualforce Page

I am working on KnowledgeArticleVersion and want to show the list of articles on Visual force page.

SObjectType objToken = Schema.getGlobalDescribe().get('KnowledgeArticleVersion'); DescribeSObjectResult objDef = objToken.getDescribe(); Map<String, SObjectField> fields = objDef.fields.getMap();

    Set<String> fieldSet = fields.keySet();
    for(String s:fieldSet)
    {
        SObjectField fieldToken = fields.get(s);
        DescribeFieldResult selectedField = fieldToken.getDescribe();
       System.debug(selectedField.getName());
    }
  When I try to run this through apex, I get an exception 

System.NullPointerException: Attempt to de-reference a null object.

I am able to run this SOQL Query using same object,

SELECT Id, Title FROM KnowledgeArticleVersion WHERE PublishStatus='Online' AND language ='en_US'

The framework that we are using does not allow this SOQL Query to be used and does a describe and fetches fields dynamically.

Any Help or Pointers on this...