2

i am creating a static vf page which have following code :

<apex:page>
    <body>
        <fieldset>
            <legend>Accounts/Contacts/Cases/Opportunities</legend>
            <ul>
                <li>Go to Setup</li>
                <li>Go to App Setup >> Customize >> Accounts/Contacts/Cases/Opportunities</li>
                <li>Click on Page Layouts.</li>
                <li>Edit the Page Layouts.</li>
                <li>Click on Buttons sections.</li>
                <li>Drag Schedule Meeting button in custom buttons area.</li>
                <li>Save the page layout.</li>
            </ul>
        </fieldset>
        <fieldset>
            <legend>Leads</legend>
            <ul>
                <li>Go to Setup</li>
                <li>Go to App Setup >> Customize >> Leads</li>
                <li>Click on Page Layouts.</li>
                <li>Edit the Page Layouts.</li>
                <li>Click on Buttons sections.</li>
                <li>Drag Schedule Meeting, Invite to GoToMeeting and Schedule a Rep buttons to the custom buttons area.</li>
                <li>Save the page layout.</li>
                <li><font color="red">
    <i>"Note: The "Schedule a Rep" button should only be used if your organization enables Users to Assign meetings to the GoToMeeting Accounts of other Users. This feature enables the User to select from a list of GoToMeeting users, view their calendars, then assign and invite Leads and Contacts to their meetings </i>
    </font></li>
                <li>Next, go to Leads "Search Layouts".</li>
                <li>Click on "Edit" link next to "Leads List View".</li>
                <li>Go to "Available Buttons" and select "Invite to GoToMeeting".</li>
                <li>Click on "Add".</li>
                <li>Click on "Save".</li>
            </ul>
        </fieldset>
        <fieldset>
            <legend>Custom Objects</legend>
            To add the "Scheduled Meeting" button to the detail page of any custom object, copy the followiong code: 
            {!REQUIRESCRIPT("/soap/ajax/10.0/connection.js")} 
            {!REQUIRESCRIPT("/soap/ajax/10.0/apex.js")} 
            var namespace = 'GTM'; 
            var clsNamespace =''; 
            if (namespace != '' && namespace != null) { clsNamespace = namespace +'.'; namespace = namespace + '__'; }location.href='/apex/'+namespace+'GTMWizard1?recordId='+'INSERT MERGE FIELD HERE';
            <ul>
                <li>Go to Setup</li>
                <li>Go to App Setup >> Create >> Objects</li>
                <li>Go to your Custom Object</li>
                <li>On your Custom Object go to "Buttons, Links, and Actions"</li>
                <li>Click on "New Button or Link"</li>
                <li>Name your button "Schedule Meeting"</li>
                <li>For "Display Type" select Detail Page Button</li>
                <li>For "Behavior" select "Execute JavaScript"</li>
                <li>For "Content Source" select "onClick javascript"</li>
                <li>Paste the code you just copied</li>
                Highlight "INSERT MERGE FIELD HERE" , then select Record ID from the "Insert Merge Field" picklist
                <br/> Click "Save"
                <br/>
                <li>Scroll up to the Page Layout section</li>
                <li>Edit the Page Layouts</li>
                <li>Click on Buttons sections</li>
                <li>Drag Schedule Meeting button to the custom buttons area</li>
                <li>Click Save</li>
                <br/> To add the "Invite to GoToMeeting" button to the detail page of any custom object, copy the followiong code:
                <br/> var namespace = 'GTM__';
                <br/> location.href = '/apex/'+namespace+'MeetingInvite?recordId='+'INSERT MERGE FIELD HERE';
                <br/>
                <br/>
                <li>Go to Setup</li>
                <li>Go to App Setup >> Create >> Objects</li>
                <li>Go to your Custom Object</li>
                <li>On your Custom Object Go to "Buttons, Links, and Actions"</li>
                <li>Click on "New Button or Link"</li>
                <li>Name your button "Invite to GoToMeeting"</li>
                <li>For "Display Type" select Detail Page Button</li>
                <li>For "Behavior" select "Execute JavaScript"</li>
                <li>For "Content Source" select "onClick JavaScript"</li>
                <li>Paste the code you just copied into the body of the merge field section</li>
                <li>Highlight "INSERT MERGE FIELD HERE" , then select Record ID from the "Insert Merge Field" picklist</li>
                <br/>
                <li>Click "Save"</li>
                <br/>
                <li>Scroll up to the Page Layout section
                    <li>Edit the Page Layouts</li>
                    Click on Buttons sections</li>
                <li>Drag Schedule Meeting button to the custom buttons area</li>
                <li>Click Save</li>
                <br/>
                <h3>Done!</h3>
            </ul>
        </fieldset>
    </body>
</apex:page>

I am getting

Function REQUIRESCRIPT may not be used in this type of formula in above code.

Help me to resolve this..

3
  • Shubham- Let me know my Ans worked for you or not?
    – Ratan Paul
    Commented Jan 18, 2016 at 3:15
  • i like to print the js code as it is..i would not care if it is working or not..can you help in this Commented Jan 18, 2016 at 3:21
  • Shubham check my updated ans i.e. edit
    – Ratan Paul
    Commented Jan 18, 2016 at 5:22

1 Answer 1

3

Like error says you can't use like expression i.e.

{!REQUIRESCRIPT("/soap/ajax/10.0/connection.js")}
{!REQUIRESCRIPT("/soap/ajax/10.0/apex.js")}

Instead use script tag to load connection.js and apex.js files

<script src="/soap/ajax/10.0/connection.js"> </script >

<script src="/soap/ajax/10.0/apex.js"> </script >

One more thing.. Wrap all your Javascript code inside script tag then only your script work else won't

<script>
var namespace = 'GTM'; 
            var clsNamespace =''; 
            if (namespace != '' && namespace != null) { 
             clsNamespace = namespace +'.'; 
             namespace = namespace + '__'; 
            }
            location.href='/apex/'+namespace+'GTMWizard1?recordId='+'INSERT MERGE FIELD HERE';
</script>

Edit

Looks like you just want to display the script then use

you need help of controller here

public class A {
    public  String str1{get;set;}
     public  String str2{get;set;}
    public  A() {
    str1= '{!REQUIRESCRIPT("/soap/ajax/10.0/connection.js")}';
     str2= '{!REQUIRESCRIPT("/soap/ajax/10.0/apex.js")}';
    }    
}

Page

<apex:outputText value="{!str1}"/><br/>
<apex:outputText value="{!str2}"/>
2
  • 3
    Alternatively: <apex:includeScript value="/soap/ajax/10.0/connection.js" />... REQUIRESCRIPT is only for custom buttons and links.
    – sfdcfox
    Commented Jan 18, 2016 at 3:06
  • @sfdcfox Correct.. we can use either <script> or <apex:includeScript> .
    – Ratan Paul
    Commented Jan 18, 2016 at 3:08

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .