Home Forums Business Model Rules how to create a new act template?

Viewing 3 reply threads
  • Author
    Posts
    • #7475
      Rafael ReisRafael Reis
      Participant

      Hi, I have a business rule that is suppose to lock down a document after a certain amount of time, but for other document it’s suppose to lock down right after the document is created, so it’s two different rules, so I was thinking about to create a new template, but I am not sure how to do that. I was hopping that someone could give me some direction on that.

      0
    • #7489
      Ed ShawEd Shaw
      Keymaster

      One way I can think of is to create a workflow that is triggered on the Act’create event.  In your workflow it could do a test on the act’s template type and for your special template, start a timer step that waits for your “certain amount of time” (specified in milliseconds).  All of the other acts   would just fall straight through.  The final step in the workflow, that both branches would go through is where you would “lock down” the document (maybe you are setting the security in a certain way, or setting it to read-only?).  At a high-level that should do it.

      1
    • #7498
      Owen PondOwen Pond
      Participant

      Some more information about creating templates

      For development purposes, the fastest way to create a template is through the Admin application. Log into admin and navigate to Document Codes->Document Templates and click on the + button.

      To do that same thing programatically, you will need to create and commit an instance of the class DocumentTemplate.

      When your development is complete, you will likely want to “seed” this template into the database so that it is “guaranteed” to be available. We do this by customizing the SysUpgrade class. SysUpgrade’seed is executed each time the application wants to reseed; normally after recreating the database or when encountering a Load step during an upgrade. To get your template to seed, you would add a new before action to the seed event and create your template from within this event. Make sure to not create any nested transactions when adding code to SysUpgrade’seed.

      1
    • #9083
      Rob DudaRob Duda
      Participant

      Better than customizing the SysUpgrade class is to use the PERSISTENCE_INITIALIZER aspect. During the seed operation the framework looks for any class that has this aspect and runs the initializePersistence event that you must override on the class you added the aspect to. The nice thing is that you can keep the SysUpgrade class as-is which eases future product upgrades and your code is isolated to a class event (again easing future product upgrades) Just make sure you NEVER commit anything that you add to the seed. You won’t experience issues in a non-clustered environment but committing before the seed is actually finished release the lock on the version table that blocks multiple JVMs from running the seed in a cluster. Do a search for the aspect and you should see a few classes (since Opal) where the aspect is being used. (ActTemplateSeeder for instance)

      0
Viewing 3 reply threads
  • You must be logged in to reply to this topic.