Create a UI action

  • 릴리스 버전: Australia
  • 업데이트 날짜 2026년 03월 12일
  • 소요 시간: 2분
  • Create a UI action to display a button on a change request for the Complete state.

    시작하기 전에

    Role required: admin

    이 태스크 정보

    The UI action must contain a condition that uses the state model script include to decide when the Complete button is displayed on the Change Request form. In this case, the Complete button is displayed only when the change has reached the Implement state.

    프로시저

    1. Open the Change Request form.
    2. Open the form context menu and select Configure > UI Actions.
    3. Locate and open the existing Implement UI action.
    4. Open the form context menu and click Insert and Stay to create a duplicate record.
    5. Modify the following fields with new values.
      Field Values
      Name Complete.
      Action name state_model_move_to_complete.
      Hint Progresses change to Complete state.
      Onclick moveToComplete();.
      Condition gs.hasRole('itil') && new ChangeRequestStateHandler(current).isNext("complete")
      Script Update function, state name, and state value.
      function moveToComplete(){
                        var ga = new GlideAjax("ChangeRequestStateHandlerAjax");         
                        ga.addParam("sysparm_name", "getStateValue");         
                        ga.addParam("sysparm_state_name", "complete"); 
                        ga.getXMLAnswer(function(stateValue) {              
                            g_form.setValue("state", stateValue);              
                            gsftSubmit(null, g_form.getFormElement(), "state_model_move_to_complete");         
                        });
                } 
                if (typeof window == 'undefined')   
                   setRedirect(); 
      
                function setRedirect() {   
                    current.update();   
                    action.setRedirectURL(current);
                }
      .
    6. Click Update.