+ Start a Discussion
Rakesh PNRakesh PN 

SOQL to get entitlements for an account.

Hi,

I am new to SOQL and I am trying to get the entitlements, can someone help me in writing a SOQL to fetch entitlements for an account?

​Thanks!
Best Answer chosen by Rakesh PN
Carlos Campillo GallegoCarlos Campillo Gallego
Hi Rakesh,

If you have worked with SQL before this shouldn't be too hard (once you know the schema of of your org, of course)
 
SELECT id, Name, AccountId FROM Entitlement

With this you'll get all the entitlements of your org, if you want to specify an account:
SELECT id, Name, AccountId FROM Entitlement WHERE AccountId = 'yourDesiredAccountId'

Hope this helps you.

Regards

All Answers

Carlos Campillo GallegoCarlos Campillo Gallego
Hi Rakesh,

If you have worked with SQL before this shouldn't be too hard (once you know the schema of of your org, of course)
 
SELECT id, Name, AccountId FROM Entitlement

With this you'll get all the entitlements of your org, if you want to specify an account:
SELECT id, Name, AccountId FROM Entitlement WHERE AccountId = 'yourDesiredAccountId'

Hope this helps you.

Regards
This was selected as the best answer
Rakesh PNRakesh PN
Thanks Carlos! I was actually running the same query but was not providing correct value for the AccountId field.