1

servicenow を使い始めましたが、TimeLines と doubleClick イベントに問題があります。

スケジュール ページと ScriptInclude (疑似コードとしてのコード) を構成しました。

スケジュールページ

glideTimeline.setReadOnly(true); glideTimeline.showLeftPane(true);
glideTimeline.registerEvent("getItems", "MyTimelineScriptInclude");


function doubleClickCustomFunction(evt) {
   try {
      alert('double click: ' + "evt: " + evt + ', target: ' + target );
      action.setRedirectURL( 'my_application.do?sys_id=' + target );
   catch (exception) {
      gs.log(exception);
   }
},

MyTimelineScriptInclude

var MyTimelineScriptInclude = Class.create();
MyTimelineScriptInclude.prototype = Object.extendsObject(AbstractTimelineSchedulePage, {


   _getTickets: function(){
      tickets = foo();
      return tickets;
   }

   getItems: function() {
      try {

         var ticket_list = this._getTickets();

         for (var ticket in ticket_list) {
            this._representTicket(ticket_list[ticket].sys_id);
         }


      } catch(exception) {
         this._debugLog(exception, "getItemsException");
      }
   },


   _representTicket: function(sys_id) {

      // ticket Object;
      ticket_object = getTicket(sys_id);
      var timelineItem = new TimelineItem('my_application' , ticket_object.sys_id);
      _representSpans( timelineItem , ticket_object );
      this.add(timelineItem);


   },

   _representSpans: function( timelineItem , ticket_object ) {

         var timelineItemSpan1 = timelineItem.createTimelineSpan(''); // I'm not including any value into the span creator.
         timelineItemSpan1.setTimeSpan( ticket_object.startDateTime1.getNumericValue() , ticket_object.endDateTime1.getNumericValue() );
         timelineItemSpan1.setSpanText(ticket_object.spanText);
         timelineItemSpan1.setSpanColor(ticket_object.spanColor);
         timelineItemSpan1.setTooltip(ticket_object.spanTooltip);


         var timelineItemSpan2 = timelineItem.createTimelineSpan(''); // I'm not including any value into the span creator.
         timelineItemSpan2.setTimeSpan( ticket_object.startDateTime2.getNumericValue() , ticket_object.endDateTime2.getNumericValue() );
         timelineItemSpan2.setSpanText(ticket_object.spanText);
         timelineItemSpan2.setSpanColor(ticket_object.spanColor);
         timelineItemSpan2.setTooltip(ticket_object.spanTooltip);

         var timelineItemSpan3 = timelineItem.createTimelineSpan(''); // I'm not including any value into the span creator.
         timelineItemSpan3.setTimeSpan( ticket_object.startDateTime2.getNumericValue() , ticket_object.endDateTime2.getNumericValue() );
         timelineItemSpan3.setSpanText(ticket_object.spanText);
         timelineItemSpan3.setSpanColor(ticket_object.spanColor);
         timelineItemSpan3.setTooltip(ticket_object.spanTooltip);
   },
});

問題は、タイムライン行をダブルクリックすると doubleClickCustomFunction がトリガーされることですが、evt データを取得できないため、リダイレクトが実行されません。

よろしくお願いします</p>

4

1 に答える 1

1

ServiceNow のスケジュール ページはクライアント側のスクリプトを使用するため、doubleClickCustomFunction がスケジュール ページのクライアント スクリプトの一部である場合、サーバー側の呼び出し (action.setRedirect および gs.log) は失敗します。

デフォルトのダブルクリック関数には、次のパラメーターが含まれています: event、this、strRecordSysID、strUserSysID カスタムのダブルクリック オーバーライドを使用していないため、これらのパラメーターが自動的に使用可能になるかどうかはわかりません。ただし、これは、スクリプト インクルード内に記述された他のカスタム オーバーライド (elementMoveX など) の場合です。

それ以外に、window.event がクライアント スクリプトの一部である場合は、関数内で呼び出してみてください。

于 2014-05-01T02:04:08.487 に答える