I have written one visualforce page and added custom visualforce tab for that page. Now I have opened that tab in Console application. It is not working.

Could you please help me on this.


<apex:page >
<script src="/soap/ajax/33.0/connection.js" type="text/javascript"></script>
<script src="/soap/ajax/33.0/apex.js" type="text/javascript"></script>
<script type="text/javascript">
    function fun()
            var qr = sforce.connection.query("Select Id, MasterLabel From venkatproject__Test2__mdt");
            alert('I am here');
            var records = qr.getArray("records");
<apex:form >
<apex:pageBlock >
<apex:pageBlockButtons location="bottom">
<apex:commandLink styleClass="btn" style="text-decoration:none;padding:4px;" value="New Case" id="clink" onclick="fun(); return false;"/>

` Thanks Venkat

  • any errors on console? – night crawler Apr 11 '17 at 7:02
  • I did not found any error. Could you please share me where I can see the console error. "Unrecognized Content-Security-Policy directive 'reflected-xss'." and "Failed to load resource: the server responded with a status of 404 (Not Found)" This is found when I press F12 – Venkat Apr 11 '17 at 7:08
  • I have used this post This solution was helped for me – Venkat Apr 11 '17 at 7:45

It will work, but need to some small addition : -

after <apex:page> just add below line : -

 <script type="text/javascript">
        var __sfdcSessionId = '{!GETSESSIONID()}';

i have run your code in Console application and it is showing all the alert. Please find the attached screenshot

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.