State Model and UI actions issues

mbayefdieng
Giga Contributor

Hi everyone,   cameronrichard ctomasi

I am working on the state transition of my Normal Change model, and am facing this issue.

When I modify the script includes ChangeRequestStateHandler and ChangeRequestStateModel_normal, I see all the UI actions visible on the form, and the state field shows all transition states.

2017-02-17_08h47_08.png

these UI actions are visible as form buttons and list button,

What did I do wrong?

Script of ChangeRequestStateHandler:

var ChangeRequestStateHandler = Class.create();

// All references to statehandler constants should be through this class ChangeRequestStateHandler

ChangeRequestStateHandler.DRAFT = ChangeRequestStateHandlerSNC.DRAFT;

ChangeRequestStateHandler.ASSESS = ChangeRequestStateHandlerSNC.ASSESS;

ChangeRequestStateHandler.BUILD = "build";

ChangeRequestStateHandler.SCHEDULED = ChangeRequestStateHandlerSNC.SCHEDULED;

ChangeRequestStateHandler.AUTHORIZE = ChangeRequestStateHandlerSNC.AUTHORIZE;

ChangeRequestStateHandler.IMPLEMENT = ChangeRequestStateHandlerSNC.IMPLEMENT;

ChangeRequestStateHandler.CLOSED = ChangeRequestStateHandlerSNC.CLOSED;

ChangeRequestStateHandler.CANCELED = ChangeRequestStateHandlerSNC.CANCELED;

ChangeRequestStateHandler.prototype = Object.extendsObject(ChangeRequestStateHandlerSNC, {

      initialize: function(changeRequestGr) {

ChangeRequestStateHandlerSNC.prototype.initialize.call(this, changeRequestGr);

              This.STATE_NAMES["-6"] = ChangeRequestStateHandler.BUILD;

      },

      type: "ChangeRequestStateHandler"

  });

Script of ChangeRequestStateModel_normal

/*

STATE_NAMES: {

              "-5": "draft",

              "-4": "assess",

            "-6": "build",

              "-2": "scheduled",

              "-3": "authorize",

              "-1": "implement",

              "0": "review", \\ not a used state

              "3": "closed",

              "4": "canceled",

}

*/

var ChangeRequestStateModel_normal = Class.create();

ChangeRequestStateModel_normal.prototype = Object.extendsObject(ChangeRequestStateModelSNC_normal, {

      draft: {

              nextState: [ "assess" ],

              assess: {

                      moving: function() {

                              return this.toAssess_moving();

                      },

                      canMove: function() {

                              return this.toAssess_canMove();

                      }

              },

              canceled: {

                      moving: function() {

                              return this.toCanceled_moving();

                      },

                      canMove: function() {

                              return this.toCanceled_canMove();

                      }

              }

      },

      assess: {

              nextState: [ "build" ],

              draft: {//if technical approver requests more information

                      moving: function() {

                              return this.toDraft_moving();

                      },

                      canMove: function() {

                              return this.toDraft_canMove();

                      }

              },

              build: {

                      moving: function() {

                              return this.toBuild_moving();

                      },

                      canMove: function() {

                              if(this._gr.getValue("u_needs_build")=="Yes") return true;

                              return false;

                      }

              },

              scheduled: {

                      moving: function() {

                              return this.toScheduled_moving();

                      },

                      canMove: function() {

                              if(this._gr.getValue("u_needs_build")=="No") return true;

                              return false;

                      }

              },

              canceled: {

                      moving: function() {

                              return this.toCanceled_moving();

                      },

                      canMove: function() {

                              return this.toCanceled_canMove();

                      }

              }

      },

      build: {

              nextState: [ "scheduled" ],

              scheduled: {

                      moving: function() {

                              return this.toScheduled_moving();

                      },

                      canMove: function() {

                              return this.toScheduled_canMove();

                      }

              },

              canceled: {

                      moving: function() {

                              return this.toCanceled_moving();

                      },

                      canMove: function() {

                              return this.toCanceled_canMove();

                      }

              }

      },

      scheduled: {

              nextState: [ "authorize" ],

              authorize: {

                      moving: function() {

                              return this.toAuthorize_moving();

                      },

                      canMove: function() {

                              return this.toAuthorize_canMove();

                      }

              },

              canceled: {

                      moving: function() {

                              return this.toCanceled_moving();

                      },

                      canMove: function() {

                              return this.toCanceled_canMove();

                      }

              }

      },

      authorize: {

              nextState: [ "implement" ],

              scheduled: {//if on hold

                      moving: function() {

                              return this.toScheduled_moving();

                      },

                      canMove: function() {

                              return this.toScheduled_canMove();

                      }

              },

              implement: {

                      moving: function() {

                              return this.toImplement_moving();

                      },

                      canMove: function() {

                              return this.toImplement_canMove();

                      }

              },

              closed: {//if rejected

                      moving: function() {

                              return this.toClose_moving();

                      },

                      canMove: function() {

                              return this.toClose_canMove();

                      }

              },

              canceled: {

                      moving: function() {

                              return this.toCanceled_moving();

                      },

                      canMove: function() {

                              return this.toCanceled_canMove();

                      }

              }

      },

      implement: {

              nextState: [ "closed" ],

             

              authorize: {//if put on hold

                      moving: function() {

                              return this.toAuthorize_moving();

                      },

                      canMove: function() {

                              return this.toAuthorize_canMove();

                      }

              },

              closed: {

                      moving: function() {

                              return this.toClosed_moving();

                      },

                      canMove: function() {

                              return this.toClosed_canMove();

                      }

              },

              canceled: {

                      moving: function() {

                              return this.toCanceled_moving();

                      },

                      canMove: function() {

                              return this.toCanceled_canMove();

                      }

              }

      },

      closed: {},

      canceled: {},

      toBuild_moving: function() {

                                                        return true;

      },

      toBuild_canMove: function() {

                                                        return true;

      },

      type: "ChangeRequestStateModel_normal"

});

1 ACCEPTED SOLUTION

mbayefdieng
Giga Contributor

there is a typo in the code of ChangeRequestStateHandler:



ChangeRequestStateHandlerSNC.prototype.initialize.call(this, changeRequestGr);


              This.STATE_NAMES["-6"] = ChangeRequestStateHandler.BUILD;


      },





because of this capital T in this.


View solution in original post

16 REPLIES 16

mbayefdieng
Giga Contributor

Getting an "invalid update" error then in Assess State and trying to move to the next. cameronrichard


another typo in code - I resolved this