function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
mnoorgatmnoorgat 

Getting Account Name from Case

Hi,

A quick question, how can I get the "Account Name" linked to a case?

I thought I'd have to do something like:

sforce.Case cas = (sforce.Case)qr.records[i]
string accName = cas.AccountName;

Except the WSDL doesn't define AccountName.  What am I missing?

Thanks.

DevAngelDevAngel

Hi mnoorgat,

A case can be parented by a contact.  If there is a contact id on the case, then you will need to first obtain the contact.  Once you have the contact you can check to see if the contact has an account id.  If so, you then need to obtain the account name based on the account id from the contact record.

Net-net is that it will take 2 more calls (retrieve or query) to obtain the account name for an account indirectly associated with a case.

 

mnoorgatmnoorgat

Thanks Dave,

Sorry for my delay in replying.  Your answer was very useful in helping me decide the approach to take for a solution I'm building.

Question:  I'm stiill interested in knowing wheteher ot not it would be possible to use a join of some kind to reduce the number of calls to get the Account Name from a Case to just one query?  Or will the 2 additional calls you mentioned always stand?  (Will it still be the same for the 6.0 api?)

Thanks for all your help.

DevAngelDevAngel

Hi  mnoorgat,

Until we design and publish join support in our API the 2 calls will stand.  We will be publishing join support at some point in the future.