Script types, before_, instead_, after_

Discuss problems installing or using TrackStudio.

Script types, before_, instead_, after_

Postby grahamb » Wed Aug 17, 2016 8:33 pm

Although I can reason when the three classes of triggers; before_, instead_of_ and after_ are applied, it's not clear to me what the practical differences are between the classes.

Presumably there are processes that a best carried out at a particular point, is there any guidance on this?

The kind of things I'm looking at are:

  • Setting the task shortname
  • Validating custom field content
  • Setting task deadline
  • Setting UDF based on hierarchical position
  • Setting the task assignee

I also have similar questions for triggers applied to messages.
Regards,

Graham
grahamb
 
Posts: 17
Joined: Wed Jan 28, 2009 7:16 pm

Re: Script types, before_, instead_, after_

Postby admin » Mon Aug 22, 2016 5:28 pm

Hello!

All 3 kind of scripts are executed when you save task or message. BEFORE executed before save, it's good place to check that all fields correct, modify values. If some value is wrong - just throw UserException("error message").

INSTEAD OF executed instead of save task/message, it's useful if you needn't new message, just like to modify something. For example, you can create message "Like" and increase like counter, but don't create messages in the history.

AFTER scripts are executed after message has been created, it's too late to modify task/message there, such scripts used to do some "post-action", like update info in external system, copy created task to knowledge base, etc.
Maxim Kramarenko (mailto: maximkr@trackstudio.com)
TrackStudio - Hierarchical Bug & Issue Tracking Software
http://www.trackstudio.com
admin
Site Admin
 
Posts: 8139
Joined: Thu Jan 01, 1970 3:00 am
Location: Smolensk, Russia


Return to TrackStudio Support

Who is online

Users browsing this forum: No registered users and 2 guests

cron