0

I have the "View Setup and Configuration" permission but still I am not able to fetch the profileid/isactive on User object

I am trying to fetch active user records grouped by profile name using rest api

Query:

Select count(id), proile.name from User where isActive=true group by proile.name

I am receiving INVALID_FIELD with error messages like

Response 1 (querying with profile id) :

[{"message":"\nSelect count(id), proile.name from User where 
isActive=true\n ^\nERROR at Row:1:Column:19\nDidn't understand 
relationship 'proile' in field path. If you are attempting to use a 
custom relationship, be sure to append the '__r' after the custom 
relationship name. Please reference your WSDL or the describe call for 
the appropriate names.","errorCode":"INVALID_FIELD"}]

Response 2 (querying without profile id) :

[{"message":"\nSelect Id, Name, isActive From User\n ^\nERROR at 
Row:1:Column:18\nNo such column 'isActive' on entity 'User'. If you are 
attempting to use a custom field, be sure to append the '__c' after the
custom field name. Please reference your WSDL or the describe call for 
the appropriate names.","errorCode":"INVALID_FIELD"}]
  • Response 1 Rectification: [{"message":"No such relation 'Profile' on entity 'User'. If you are attempting to use a custom field, be sure to append the '__c' after the custom field name. Please reference your WSDL or the describe call for the appropriate names.","errorCode":"INVALID_FIELD"}] – Atharwa Samant Dec 25 '17 at 11:29
0

In your request 1 you are using "proile" and not "profile",

In your request 2, try checking the FLS to the Field isActive. In Salesforce, Go to Setup -> User -> Fields -> isActive then click on view field level security. Make sure that the User profile you are using have access to the field isActive.

You need to have at least read access to the field in order to be able to execute queries using that field. You can give access to Field using Profiles or Permission Sets. You can check the documentation about Field Level Security

  • Thanks for pointing out the profile spelling mistake. However, I am still receiving an error as [{"message":"No such relation 'Profile' on entity 'User'. If you are attempting to use a custom field, be sure to append the '__c' after the custom field name. Please reference your WSDL or the describe call for the appropriate names.","errorCode":"INVALID_FIELD"}] – Atharwa Samant Dec 25 '17 at 11:32
0

I was not using the right endpoint.

I was using -> /services/data/v38.0/tooling/query/?q=[query] correct endpoint is -> /services/data/v38.0/query/?q=[query]

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.