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
VijoVijo 

The controller method getSubject()

Hi All,

I have seen this method used a couple of times, but no standard doc exists to explain it. Searched for it in the controller methods in standard salesforce documentation, but nothing.

Can anyone please shed an idea of what the controller method, getSubject does and how it works.

Thank you 

Best Answer chosen by Admin (Salesforce Developers) 
sfdcfoxsfdcfox

Apparently, it's an alternative form of getRecord(). From what I can tell, it operates identically to getRecord() in respect to the data that is returned. They both return the same data, and point to the same sobject record in memory (evidenced by the debug logs).

All Answers

sfdcfoxsfdcfox

Apparently, it's an alternative form of getRecord(). From what I can tell, it operates identically to getRecord() in respect to the data that is returned. They both return the same data, and point to the same sobject record in memory (evidenced by the debug logs).

This was selected as the best answer
jwetzlerjwetzler

Yes getSubject() is deprecated, and no longer even in the docs. They do the same thing, but use getRecord() instead.

jwetzlerjwetzler

And if you found references to this method in any recent salesforce documentation, please post the links and I'll see if we can get them fixed up.

sfdcfoxsfdcfox

https://www.google.com/search?q=sobject+getsubject

 

What I can tell, it appears that the references to getSubject are all old code demos/blog posts/etc. I don't know of any reference in any current documentation to getSubject (it appears that there isn't, though).

VijoVijo

My bad.. I just checked, and it was an old tutorial (2008) that I was referring to.It was one of the google search I got.

I really wonder.. wouldn't salesforce just have that included in the documentation, and say " people.. we will be depreciating this.. please use getRecord() from now on.." like they did for attributes in visualforce....?

Also..I have some code that uses this method.. should I be changing it..?

 

@sfdcfox--- Hi.. you are right.. the newer documentation does not have it....atleast as far as I have checked..!!!  

 

Thank you all for your response.. really appreciate it..