簡體   English   中英

不是在crm 2011中從“功能區”按鈕觸發Javascript嗎?

[英]Javascript is not triggering from Ribbon button in crm 2011?

我在約會實體中創建了2個功能區按鈕,這些按鈕的功能為,單擊時將分別打開一個新的電話和任務,但未打開任務。電話工作正常。請提出建議。

請參閱RibbonDiffxml

<RibbonDiffXml>
        <CustomActions>
          <CustomAction Id="test.Form.appointment.MainTab.Include.AddExisting.CustomAction" 

Location="Mscrm.Form.appointment.MainTab.Include.Controls._children" Sequence="41">
            <CommandUIDefinition>
              <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" />
            </CommandUIDefinition>
          </CustomAction>
          <CustomAction Id="test.Form.appointment.MainTab.Include.addphone.CustomAction" Location="Mscrm.Form.appointment.MainTab.Include.Controls._children" 

Sequence="41">
            <CommandUIDefinition>
              <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" />
            </CommandUIDefinition>
          </CustomAction>
          <CustomAction Id="test.Form.appointment.MainTab.Include.AddTask.CustomAction" Location="Mscrm.Form.appointment.MainTab.Include.Controls._children" 

Sequence="41">
            <CommandUIDefinition>
              <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" />
            </CommandUIDefinition>
          </CustomAction>
        </CustomActions>
        <Templates>
          <RibbonTemplates Id="Mscrm.Templates"></RibbonTemplates>
        </Templates>
        <CommandDefinitions>
          <CommandDefinition Id="test.Form.appointment.MainTab.Include.AddExisting.Command">
            <EnableRules />
            <DisplayRules />
            <Actions>
              <Url WinMode="0" Address="$webresource:testes_TaskPhoneCallLookup">
                <CrmParameter Value="FirstPrimaryItemId" Name="data" />
              </Url>
            </Actions>
          </CommandDefinition>
          <CommandDefinition Id="test.Form.appointment.MainTab.Include.addphone.Command">
            <EnableRules />
            <DisplayRules />
            <Actions>
              <JavaScriptFunction FunctionName="createPhone" Library="$webresource:testcrm_/Scripts/test.Wealthmgmt.Appointment.Buttons" />
            </Actions>
          </CommandDefinition>
          <CommandDefinition Id="test.Form.appointment.MainTab.Include.AddTask.Command">
            <EnableRules />
            <DisplayRules />
            <Actions>
              <JavaScriptFunction FunctionName="createTask" Library="$webresource:testcrm_/Scripts/test.Wealthmgmt.Appointment.Buttons" />
            </Actions>
          </CommandDefinition>
        </CommandDefinitions>
        <RuleDefinitions>
          <TabDisplayRules />
          <DisplayRules />
          <EnableRules />
        </RuleDefinitions>
<LocLabels>
          <LocLabel Id="test.Form.appointment.MainTab.Include.AddExisting.Description">
            <Titles>
              <Title languagecode="1033" description="Add Task and Phone Call" />
            </Titles>
          </LocLabel>
          <LocLabel Id="test.Form.appointment.MainTab.Include.AddExisting.LabelText">
            <Titles>
              <Title languagecode="1033" description="Add Existing Activity" />
            </Titles>
          </LocLabel>
          <LocLabel Id="test.Form.appointment.MainTab.Include.addphone.Description">
            <Titles>
              <Title languagecode="1033" description="Add a new phone call" />
            </Titles>
          </LocLabel>
          <LocLabel Id="test.Form.appointment.MainTab.Include.addphone.LabelText">
            <Titles>
              <Title languagecode="1033" description="Add Phone Call" />
            </Titles>
          </LocLabel>
          <LocLabel Id="test.Form.appointment.MainTab.Include.AddTask.Description">
            <Titles>
              <Title languagecode="1033" description="Add new Task" />
            </Titles>
          </LocLabel>
          <LocLabel Id="test.Form.appointment.MainTab.Include.AddTask.LabelText">
            <Titles>
              <Title languagecode="1033" description="Add Task" />
            </Titles>
          </LocLabel>
        </LocLabels>
      </RibbonDiffXml>

Javascript是

function createTask(){


var guidCaller=Xrm.Page.data.entity.getId();
//alert(guidCaller);
var orgName = Xrm.Page.context.getServerUrl();
var extraqs = "&subject=New Task";
extraqs += "&hpcrm_timeblockid="+guidCaller;
var features = "location=no,menubar=no,status=no,toolbar=no,resizable=yes";
window.open(orgName+"main.aspx?etn=task&pagetype=entityrecord&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 = "&subject=New Phone Call";
extraqs += "&hpcrm_timeblockid="+guidCaller;
var features = "location=no,menubar=no,status=no,toolbar=no,resizable=yes";
window.open(orgName+"main.aspx?etn=phonecall&pagetype=entityrecord&extraqs=" + encodeURIComponent(extraqs), "_blank", features, false);

}

我猜測某些部署不正確。 使用調試器(F12)為createTask()createPhone()都在功能區javascript中放置一個斷點。 如果斷點被擊中,而不是任務被擊中,那么您可能應該嘗試重新部署功能區XML。 如果您遇到斷點,則可能是javascript錯誤,請逐步解決並找出原因。

注意! 用於設置斷點的javascript文件的名稱將不是test.Wealthmgmt.Appointment.Buttons。 這將是腳本塊(一些隨機數)。

我之前遇到過..嘗試重置IIS ,然后刷新您的頁面..如果相同

行為仍然存在,您應確保已調用該函數並執行此操作

應該在函數的第一行中發出警報,如果該行為仍然存在,請重新部署

再次解決

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM