title: Javascript is not triggering from Ribbon button in crm 2011?
body: <p>i have created 2 ribbon buttons inside the appointment entity,the functionality of these buttons are ,while clicking it will open a new phone call and task respectively, but task is not getting opened.Phone call is working fine.Please suggest..</p>
  
  <p>Please see the RibbonDiffxml</p>
  
  <pre><code>&lt;RibbonDiffXml&gt;
          &lt;CustomActions&gt;
            &lt;CustomAction Id="test.Form.appointment.MainTab.Include.AddExisting.CustomAction" 
  
  Location="Mscrm.Form.appointment.MainTab.Include.Controls._children" Sequence="41"&gt;
              &lt;CommandUIDefinition&gt;
                &lt;Button Id="test.Form.appointment.MainTab.Include.AddExisting" Command="test.Form.appointment.MainTab.Include.AddExisting.Command" Sequence="9" 
  
  ToolTipTitle="$LocLabels:test.Form.appointment.MainTab.Include.AddExisting.LabelText" 
  
  LabelText="$LocLabels:test.Form.appointment.MainTab.Include.AddExisting.LabelText" 
  
  ToolTipDescription="$LocLabels:test.Form.appointment.MainTab.Include.AddExisting.Description" TemplateAlias="o1" 
  
  Image16by16="/_imgs/ribbon/AddExistingStandard_16.png" Image32by32="/_imgs/ribbon/AddExistingStandard_32.png" /&gt;
              &lt;/CommandUIDefinition&gt;
            &lt;/CustomAction&gt;
            &lt;CustomAction Id="test.Form.appointment.MainTab.Include.addphone.CustomAction" Location="Mscrm.Form.appointment.MainTab.Include.Controls._children" 
  
  Sequence="41"&gt;
              &lt;CommandUIDefinition&gt;
                &lt;Button Id="test.Form.appointment.MainTab.Include.addphone" Command="test.Form.appointment.MainTab.Include.addphone.Command" Sequence="8" 
  
  ToolTipTitle="$LocLabels:test.Form.appointment.MainTab.Include.addphone.LabelText" 
  
  LabelText="$LocLabels:test.Form.appointment.MainTab.Include.addphone.LabelText" 
  
  ToolTipDescription="$LocLabels:test.Form.appointment.MainTab.Include.addphone.Description" TemplateAlias="o1" Image16by16="/_imgs/ribbon/entity16_4210.png" 
  
  Image32by32="/_imgs/ribbon/entity32_4210.png" /&gt;
              &lt;/CommandUIDefinition&gt;
            &lt;/CustomAction&gt;
            &lt;CustomAction Id="test.Form.appointment.MainTab.Include.AddTask.CustomAction" Location="Mscrm.Form.appointment.MainTab.Include.Controls._children" 
  
  Sequence="41"&gt;
              &lt;CommandUIDefinition&gt;
                &lt;Button Id="test.Form.appointment.MainTab.Include.AddTask" Command="test.Form.appointment.MainTab.Include.AddTask.Command" Sequence="10" 
  
  ToolTipTitle="$LocLabels:test.Form.appointment.MainTab.Include.AddTask.LabelText" 
  
  LabelText="$LocLabels:test.Form.appointment.MainTab.Include.AddTask.LabelText" 
  
  ToolTipDescription="$LocLabels:test.Form.appointment.MainTab.Include.AddTask.Description" TemplateAlias="o1" Image16by16="/_imgs/ribbon/entity16_4212.png" 
  
  Image32by32="/_imgs/ribbon/entity32_4212.png" /&gt;
              &lt;/CommandUIDefinition&gt;
            &lt;/CustomAction&gt;
          &lt;/CustomActions&gt;
          &lt;Templates&gt;
            &lt;RibbonTemplates Id="Mscrm.Templates"&gt;&lt;/RibbonTemplates&gt;
          &lt;/Templates&gt;
          &lt;CommandDefinitions&gt;
            &lt;CommandDefinition Id="test.Form.appointment.MainTab.Include.AddExisting.Command"&gt;
              &lt;EnableRules /&gt;
              &lt;DisplayRules /&gt;
              &lt;Actions&gt;
                &lt;Url WinMode="0" Address="$webresource:testes_TaskPhoneCallLookup"&gt;
                  &lt;CrmParameter Value="FirstPrimaryItemId" Name="data" /&gt;
                &lt;/Url&gt;
              &lt;/Actions&gt;
            &lt;/CommandDefinition&gt;
            &lt;CommandDefinition Id="test.Form.appointment.MainTab.Include.addphone.Command"&gt;
              &lt;EnableRules /&gt;
              &lt;DisplayRules /&gt;
              &lt;Actions&gt;
                &lt;JavaScriptFunction FunctionName="createPhone" Library="$webresource:testcrm_/Scripts/test.Wealthmgmt.Appointment.Buttons" /&gt;
              &lt;/Actions&gt;
            &lt;/CommandDefinition&gt;
            &lt;CommandDefinition Id="test.Form.appointment.MainTab.Include.AddTask.Command"&gt;
              &lt;EnableRules /&gt;
              &lt;DisplayRules /&gt;
              &lt;Actions&gt;
                &lt;JavaScriptFunction FunctionName="createTask" Library="$webresource:testcrm_/Scripts/test.Wealthmgmt.Appointment.Buttons" /&gt;
              &lt;/Actions&gt;
            &lt;/CommandDefinition&gt;
          &lt;/CommandDefinitions&gt;
          &lt;RuleDefinitions&gt;
            &lt;TabDisplayRules /&gt;
            &lt;DisplayRules /&gt;
            &lt;EnableRules /&gt;
          &lt;/RuleDefinitions&gt;
  &lt;LocLabels&gt;
            &lt;LocLabel Id="test.Form.appointment.MainTab.Include.AddExisting.Description"&gt;
              &lt;Titles&gt;
                &lt;Title languagecode="1033" description="Add Task and Phone Call" /&gt;
              &lt;/Titles&gt;
            &lt;/LocLabel&gt;
            &lt;LocLabel Id="test.Form.appointment.MainTab.Include.AddExisting.LabelText"&gt;
              &lt;Titles&gt;
                &lt;Title languagecode="1033" description="Add Existing Activity" /&gt;
              &lt;/Titles&gt;
            &lt;/LocLabel&gt;
            &lt;LocLabel Id="test.Form.appointment.MainTab.Include.addphone.Description"&gt;
              &lt;Titles&gt;
                &lt;Title languagecode="1033" description="Add a new phone call" /&gt;
              &lt;/Titles&gt;
            &lt;/LocLabel&gt;
            &lt;LocLabel Id="test.Form.appointment.MainTab.Include.addphone.LabelText"&gt;
              &lt;Titles&gt;
                &lt;Title languagecode="1033" description="Add Phone Call" /&gt;
              &lt;/Titles&gt;
            &lt;/LocLabel&gt;
            &lt;LocLabel Id="test.Form.appointment.MainTab.Include.AddTask.Description"&gt;
              &lt;Titles&gt;
                &lt;Title languagecode="1033" description="Add new Task" /&gt;
              &lt;/Titles&gt;
            &lt;/LocLabel&gt;
            &lt;LocLabel Id="test.Form.appointment.MainTab.Include.AddTask.LabelText"&gt;
              &lt;Titles&gt;
                &lt;Title languagecode="1033" description="Add Task" /&gt;
              &lt;/Titles&gt;
            &lt;/LocLabel&gt;
          &lt;/LocLabels&gt;
        &lt;/RibbonDiffXml&gt;
  </code></pre>
  
  <p>And Javascript is </p>
  
  <pre><code>function createTask(){
  
  
  var guidCaller=Xrm.Page.data.entity.getId();
  //alert(guidCaller);
  var orgName = Xrm.Page.context.getServerUrl();
  var extraqs = "&amp;subject=New Task";
  extraqs += "&amp;hpcrm_timeblockid="+guidCaller;
  var features = "location=no,menubar=no,status=no,toolbar=no,resizable=yes";
  window.open(orgName+"main.aspx?etn=task&amp;pagetype=entityrecord&amp;extraqs=" + encodeURIComponent(extraqs), "_blank", features, false);
  
  
  }
  
  
  function createPhone(){
  
  var guidCaller=Xrm.Page.data.entity.getId();
  //alert(guidCaller);
  var orgName = Xrm.Page.context.getServerUrl();
  var extraqs = "&amp;subject=New Phone Call";
  extraqs += "&amp;hpcrm_timeblockid="+guidCaller;
  var features = "location=no,menubar=no,status=no,toolbar=no,resizable=yes";
  window.open(orgName+"main.aspx?etn=phonecall&amp;pagetype=entityrecord&amp;extraqs=" + encodeURIComponent(extraqs), "_blank", features, false);
  
  }
  </code></pre>