You need to sign in to do that
Don't have an account?
jnegi
How to get QueueSobject prefix ?
Hi All,
I want to get QueueSObject record prefix . I can get Other standard objects prefix by using below mentioned code:
Account.sObjectType.getDescribe().getKeyPrefix();
but when I use QueueSobject in above code it through an error. :
"Method does not exist or incorrect signature: [Schema.DescribeFieldResult].getKeyPrefix();"
any Idea ?
I misread your original question, I thought you had wanted to determine the SobjectType field prefix, but you actually wanted the key prefix for the QueueSobject entity (is that correct?). It is odd that this object works differently than say, accounts. I believe that behavior might be a bug of some sort, since QueueSobject.sObjectType.getDescribe() is returning a field describe instead of an object describe (Scoping issue, maybe?). That being said, you can definitely get your answer using the following mechanism:
All Answers
As the error message states, you're attempting to call getKeyPrefix on an DescribeFieldResult, not a DescribeSobjectResult. You'll need to call Schema.getGlobalDescribe(), and then get the appropriate entry from the map, and then call getDescribe() on that entry.
Thanks sfdcfox.
Could you please provide me the syntax to get prefix for QueueSobject.
I misread your original question, I thought you had wanted to determine the SobjectType field prefix, but you actually wanted the key prefix for the QueueSobject entity (is that correct?). It is odd that this object works differently than say, accounts. I believe that behavior might be a bug of some sort, since QueueSobject.sObjectType.getDescribe() is returning a field describe instead of an object describe (Scoping issue, maybe?). That being said, you can definitely get your answer using the following mechanism:
Thanks sfdcfox once again.