Print this page

Multiple Javascript onclick button/link on a object page.

Knowledge Article Number 000187159
Description There are multiple scenario in which user will be having a standard and custom button / link on their page, which may have onclick Javascript functionality.

In such cases if the Javascript used within these buttons does not maintain same API version level it may result in random error while executing the buttons / link.

Example:
 
{faultcode:'sf:INVALID_FIELD', faultstring:'INVALID_FIELD: 
SELECT ManagerId, Sales_Group__c, Sales_Org__c
       ^
ERROR at Row:1:Column:8
No such column 'ManagerId' on entity 'User'. If you are attempting to use a custom field, be sure to append the '__c' after the custom field name. Please reference your WSDL or the describe call for the appropriate names.', detail:{InvalidFieldFault:{exceptionCode:'INVALID_FIELD', exceptionMessage:'
SELECT ManagerId, Sales_Group__c, Sales_Org__c
       ^
ERROR at Row:1:Column:8
No such column 'ManagerId' on entity 'User'. If you are attempting to use a custom field, be sure to append the '__c' after the custom field name. Please reference your WSDL or the describe call for the appropriate names.', row:'1', column:'8', }, }, }
  • The above error may occur randomly even though the ManagerId field on the User object is visible and available for querying API tool such Workbench.
  • But if you capture the network logs the call is been made to API version 10.0 instead of API version specified within the executing JS file.

Reason for the above behavior:
  • It's because of the way the JS is loaded, and the scope of the sforce.connection object.  The JS is loaded before it is called (onclick).  Since the buttons are all on the same page, the sforce.connection object gets reassigned multiple times, finally being left at version 8.  It's just the nature of JS.
                
Resolution
Steps to be taken :
1. Check if different versions of connection.js( 8, 10, 15, and 28 etc) are loaded
2. The object detail page buttons and that are loading all the different versions. Standardize them all on one version, preferably the highest available version ex: 28.0 and check for outcome. 

 




promote demote