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
chaithaly gowdachaithaly gowda 

what does if(sforce.one) mean?

I was analising a code and came across if(sforce.one){ }, not sure what it does. can someone enlighten me about this
Best Answer chosen by chaithaly gowda
AbhishekAbhishek (Salesforce Developers) 
Hi Chaithaly,

Sforce means one Object. The Salesforce Platform includes an event mechanism for navigation and messaging. This is exposed in Visualforce as a JavaScript object called sforce. ... one object. For example sforce.

If you have any more questions you refer to the below document which has complete information about it.

https://developer.salesforce.com/docs/atlas.en-us.pages.meta/pages/salesforce1_dev_jsapi_sforce_one.htm

Kindly let me know if it helps you and close your query by marking it as solved so that it can help others in the future. It will help to keep this community clean. 

Thanks,
Salesforce Support.

All Answers

Pawel BorysPawel Borys
It is commonly used to check whether the component is displayed in lightning or classic context. In classic the sforce variable returns null.
AbhishekAbhishek (Salesforce Developers) 
Hi Chaithaly,

Sforce means one Object. The Salesforce Platform includes an event mechanism for navigation and messaging. This is exposed in Visualforce as a JavaScript object called sforce. ... one object. For example sforce.

If you have any more questions you refer to the below document which has complete information about it.

https://developer.salesforce.com/docs/atlas.en-us.pages.meta/pages/salesforce1_dev_jsapi_sforce_one.htm

Kindly let me know if it helps you and close your query by marking it as solved so that it can help others in the future. It will help to keep this community clean. 

Thanks,
Salesforce Support.
This was selected as the best answer