gsyst

导航

Dynamics CRM4.0 菜单、工具栏自定义

首先导出配置文件:系统设置-->自定义-->导出自定义项 导出ISV配置(ISV.CONFIG)

<?xml version="1.0" encoding="utf-8"?>
<IsvConfig>
  <configuration version="3.0.0000.0">
    <Entities>
      <!--对应的实体 name-实体名 -->
      <Entity name="account">
        <!-- 菜单  -->
        <MenuBar>
          <!-- Custom Menus that you may add -->
        </MenuBar>
        <!-- 工具栏节  -->
        <!-- ValidForCreate-新建时有效 ValidForUpdate-更新时有效 -->
        <ToolBar ValidForCreate="0" ValidForUpdate="1">
          <!-- 按钮节 -->
          <!-- Icon-按钮图标 PassParams-是否传递系统默认的几个参数(typename,type,id,orgname,userlcid,orglcid) -->
          <!-- WinMode-新窗口模式(0-window 1-Modal Dialog 2-Modeless Dialog)JavaScript-要执行的脚本,一般为方法名 -->
          <!-- WinParams-特殊参数 具体用法还没研究 Url-打开的页面,一般和JavaScript参数选其一 -->
          <Button Icon="/_imgs/ico_18_debug.gif" PassParams="1" WinParams="" WinMode="0" Url="" JavaScript="UpToHeadcompany();">
            <Titles>
              <Title LCID="2052" Text="我的按钮" />
            </Titles>
            <ToolTips>
              <ToolTip LCID="2052" Text="我的按钮" />
            </ToolTips>
          </Button>
        </ToolBar>
        <!-- 左侧导航 -->
        <NavBar>
          <NavBarItem Icon="/_imgs/ico_16_4.gif" Url="about:blank" Id="navItem">
            <Titles>
              <Title LCID="1033" Text="我的菜单" />
            </Titles>
          </NavBarItem>
        </NavBar>
        <!-- 列表页相关 -->
        <Grid>
          <!-- 菜单栏 -->
          <MenuBar>
            <Buttons>
              <Button Icon="/_imgs/Tools/ico_contract_template.gif" JavaScript="alert(1);">
                <Titles>
                  <Title LCID="1033" Text="我的菜单" />
                </Titles>
                <ToolTips>
                  <ToolTip LCID="1033" Text="我的菜单" />
                </ToolTips>
              </Button>
            </Buttons>
          </MenuBar>
        </Grid>
      </Entity>
    </Entities>
  </configuration>


按钮的事件也可以表单的onload事件中动态绑定

for (var index in document.getElementsByTagName("LI")) {
    if (document.getElementsByTagName("LI")[index].title == "我的按钮") {
        document.getElementsByTagName("LI")[index].onclick = MyEvent;
        break;
    }
}

保存文件,再导入自定义实体即可(系统设置--〉自定义--〉导入自定义项,浏览--〉上载--〉导入所选自定义项)
刷新页面即可看到效果

posted on 2012-12-07 10:33  gsyst  阅读(323)  评论(0编辑  收藏  举报