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
    – NZ Dev
    Mar 1 '21 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 Mar 1 '21 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
    Mar 1 '21 at 9:20
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 Mar 1 '21 at 9:17
  • updated my answer: pls check your field level access
    – NZ Dev
    Mar 1 '21 at 9:18
  • Is there another custom field called description ?
    – NZ Dev
    Mar 1 '21 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"
    – NZ Dev
    Mar 1 '21 at 9:32
  • yes that solved the problem..Thanks for your help Mar 1 '21 at 9:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.