0

I am trying to get the Description value of the Asset of an Organization and need a query for that. Is that possible?

When I try query SELECT AccountId, Product2.Name, Product2.ProductCode, InstallDate, Description FROM Asset, I get the expected rows but the Description field does not return anything. Any help would be appreciated.

3
  • What do you mean by blanks results? no results (no rows) or the description field in each row is blank even though the data is filled in within the UI? The later I find hard to believe. How are you querying? NB: It is a Long Text Field. which is relevant to the Where Clause, you cannot use description in the WhereClause Commented Mar 1, 2021 at 8:59
  • What I mean is - when I query "SELECT AccountId, Product2.Name, Product2.ProductCode, InstallDate,Description FROM Asset" - I get other fields - only Description is not fetched Commented Mar 1, 2021 at 9:15
  • I would check if the description is actually populated or not and the field i am referencing is same as the where the data is.
    – manjit5190
    Commented Mar 1, 2021 at 9:20

1 Answer 1

1

Yes it is possible to return the Description field.

List<Asset> assets = [SELECT Id, Description FROM Asset];

If you are getting no rows returned either:

  • there is no data or
  • you do not have access to the data that is there, or
  • your WHERE clause is filter out the data

If the description field is empty then either:

  • there is no data in said field or
  • you do not have access to the field which does happen even for system admin on some standard fields.

You are returning Rows but no description field, please check your field level access. Also sometime people create a custom field named Description with less text size and then you may have another field (real stab in the dark there :) )

Here is data returning for me when I use Dev Console: enter image description here

5
  • When I query "SELECT AccountId, Product2.Name, Product2.ProductCode, InstallDate,Description FROM Asset" - I get other fields - just not Description Commented Mar 1, 2021 at 9:17
  • updated my answer: pls check your field level access Commented Mar 1, 2021 at 9:18
  • Is there another custom field called description ? Commented Mar 1, 2021 at 9:21
  • any luck with your field-level security found in SETUP/OBJECT/ASSET/DESCRIPTION when viewing the field at the top "Set Field-Level Security" Commented Mar 1, 2021 at 9:32
  • yes that solved the problem..Thanks for your help Commented Mar 1, 2021 at 9:45

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .