1、CRM2011編程實戰——清空指定頁簽下面的所有選項,並對頁簽下面的指定控制項進行操作

來源:互聯網
上載者:User

標籤:style   blog   http   java   color   os   io   for   

需求:當頁面載入時,“呼叫編號”保持不變,“任務號”自動更新,“接報時間”和“發生日期”自動化佈建為當天日期和時間,其它選項全部恢複為初始狀態。

欄位說明:

控制項名稱

控制項名稱

控制項名稱

反饋單登入

tab_4

任務號

hxcs_ftaskcode

接報時間

hxcs_fdatetimeofcasehappended

 

發生日期

hxcs_fdatetimeofcasehappended

呼叫編號

hxcs_fcallnum

重要電話

hxcs_fissendout

 

是否重複反饋

hxcs_fisrepeatreport

是否派單給其它部門

hxcs_fisimportanttel

 

是否回複

hxcs_fisreply

 

目前狀態

hxcs_fcurrentstate

 

 

 

Js代碼如下:

function controlTagCtlClear() {    var t = Xrm.Page.ui.tabs.get("tab_4"); //頁簽名稱    var ctrlName;    if (t != null && t != undefined && t.sections != null) {        t.sections.forEach(function (sec, index) {            sec.controls.forEach(function (ctrl, filter) {                ctrlName = ctrl.getName();                if (ctrlName == "hxcs_fcallnum" || ctrlName == "hxcs_ftaskcode") {                }                else if (ctrlName == "hxcs_fisrepeatreport" || ctrlName == "hxcs_fissendout" || ctrlName == "hxcs_fisreply" || ctrlName == "hxcs_fisimportanttel") {                    ctrl.getAttribute().setValue(0);                }                else if (ctrlName == "hxcs_fcurrentstate") {                    ctrl.getAttribute().setValue(1);                }                else if (ctrlName == "hxcs_fdatetimeofrequesthelp" || ctrlName == "hxcs_fdatetimeofcasehappended") {                    ctrl.getAttribute().setValue(new Date());                }                else {                    ctrl.getAttribute().setValue(null);                }            })        })    }}function getAutoTaskNo() {    if (Xrm.Page.ui.getFormType() == 1)//只在建立記錄時賦值    {        var datatime = getAutoNoValue();        Xrm.Page.getControl("hxcs_ftaskcode").getAttribute().setValue(datatime);    }}//yyMMddhhmmssfunction getAutoNoValue() {    var date = new Date();    var year = date.getFullYear();    var month = date.getMonth() + 1;    var day = date.getDate();    var hour = date.getHours();    var minute = date.getMinutes();    var second = date.getSeconds();    var clientDatetime = year.toString() + month.toString() + day.toString() + hour.toString() + minute.toString() + second.toString();    return clientDatetime;}

表單設定:

擴充:

//控制指定頁簽隱藏or顯示function controlTagShow(tName, isShow) {    var t = Xrm.Page.ui.tabs.get(tName);    if (t != null && t != undefined) {        t.setVisible(isShow);    }}//控制指定頁簽下面的所有控制項開啟or禁用function controlTagCtlDisabled(tName, isEnable) {    var t = Xrm.Page.ui.tabs.get(tName);    if (t != null && t != undefined && t.sections != null) {        t.sections.forEach(function (sec, index) {            sec.controls.forEach(function (ctrl, filter) {                ctrl.setDisabled(isEnable);            })        })    }}


聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.