0

我在约会实体中创建了 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);

}
4

2 回答 2

0

我以前遇到过这个问题..尝试重置IIS,然后刷新您的页面..如果相同

行为仍然存在,您应该确保调用该函数并这样做

应该在函数的第一行发出警报,如果行为仍然存在,请重新部署

再次解决

于 2013-01-30T22:03:56.927 回答
0

我猜有些东西没有正确部署。使用调试器 (F12) 在功能区 javascript 中放置一个断点,createTask()然后创建createPhone(). 如果您的断点被击中,但不是任务,您可能应该尝试重新部署您的功能区 XML。如果你的断点被击中,它可能是一个 javascript 错误,单步执行它并找出它。

笔记!用于设置断点的 javascript 文件的名称不会是 test.Wealthmgmt.Appointment.Buttons。它将是脚本块(一些随机数)。

于 2013-01-22T16:49:56.793 回答