UI アクションによるタスク関係

  • リリースバージョン: Xanadu
  • 更新日 2024年08月01日
  • 所要時間:4分
  • タスク関係を定義した後、UI アクションを使用して、新しいタスクを古いタスクから作成するときにタスク関係を定義できます。

    以下にいくつかの例を示します。

    警告:
    これらの例は、すべてのインスタンスで機能するとは限りません。これらは、説明のための例として提供されています。

    UI アクションの例

    インシデントを発生させる

    この UI アクションにより、変更管理チームは変更要求から直接インシデントを記録し、変更によってインシデントが発生したことを記録できます。

    変更要求 [change_request] テーブルに UI アクションを作成し、スクリプトに以下の内容を記述します。
    var inccaus =new GlideRecord("incident");
    inccaus.short_description= current.short_description;
    inccaus.comments= current.comments.getHTMLValue();
    // inccaus.parent = current.sys_id;
    inccaus.insert();
    CauIncident();
     
    gs.addInfoMessage("Incident "+ inccaus.number+" created");
    action.setRedirectURL(current);
    action.setReturnURL(inccaus);
     
     
    function CauIncident(){
    var m2m =new GlideRecord('task_rel_task');
    m2m.initialize();
    m2m.child= current.sys_id;
    m2m.parent= inccaus.sys_id;
    m2m.type.setDisplayValue("Caused by::Causes");
    m2m.insert();}

    問題を発生させる

    この UI アクションにより、変更管理チームは変更要求から問題を記録し、変更によって問題が発生したことを記録できます。

    変更要求 [change_request] テーブルに UI アクションを作成し、スクリプトに以下の内容を貼り付けます。
    var probcaus =new GlideRecord("problem");
    probcaus.short_description= current.short_description;
    probcaus.comments= current.comments.getHTMLValue();
    // probcaus.parent = current.sys_id;
    probcaus.insert();
    CauProblem();
     
    gs.addInfoMessage("Problem "+ probcaus.number+" created");
    action.setRedirectURL(current);
    action.setReturnURL(probcaus);
     
     
    function CauProblem(){
    var m2m =new GlideRecord('task_rel_task');
    m2m.initialize();
    m2m.child= current.sys_id;
    m2m.parent= probcaus.sys_id;
    m2m.type.setDisplayValue("Caused by::Causes");
    m2m.insert();}

    問題の修正

    この UI アクションを使用すると、問題から変更要求を生成し、変更によって問題が修正されたことを記録できます。

    問題 [problem] テーブルに UI アクションを作成し、次のコードを貼り付けます。
    var fixchg =new GlideRecord("change_request");
    fixchg.short_description= current.short_description;
    fixchg.comments= current.comments.getHTMLValue();
    // fixchg.parent = current.sys_id;
    fixchg.insert();
    FixChange();
     
    gs.addInfoMessage("Change "+ fixchg.number+" created");
    action.setRedirectURL(current);
    action.setReturnURL(fixchg);
     
     
    function FixChange(){
    var m2m =new GlideRecord('task_rel_task');
    m2m.initialize();
    m2m.child= current.sys_id;
    m2m.parent= fixchg.sys_id;
    m2m.type.setDisplayValue("Fixes::Fixed by");
    m2m.insert();}