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
NewToSFNewToSF 

return custom obect with custom object member

Hi,

I have custom object X which has many custom members including Account(datatype is Lookup(Account)) which is related to Account object. When I create instance of getXInfoService in .net code after consuming webservice, I see x.Account__c and x.Account__r. Account__c is string and Account__r is null. How can I get Account object thru apex webservice?

global class getXInfo {

WebService static X__c getX(string xName) {

   X__c  z= [SELECT Account__c, API_Access__c from X__c WHERE X__c.Name =: xName];

    X__c n_z= new X__c(Account__c = z.Account__c, API_Access__c=z.API_Access__c);

   return n_z;

}

werewolfwerewolf
Maybe try selecting the object you just inserted and including the fields you need, and then returning the results of that select instead.