Can a UI Action trigger call a business rule?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-12-2008 03:16 AM
We have the need to copy an existing change request to create a new one. The copy is to include fields on the change request along with any associated task, configuration items, Affected CI's and attachments. Primary use will be to create reoccurring change request (something that happens weekly, bi weekly, etc.). Initially I am looking at 3 options. The first copies without dates (planned start, planned end, etc.) The second copies and sets the dates out 1 week (weekly change request) and 3rd set s the dates out two weeks (bi-weekly change request). Anything that is not weekly or bi-weekly uses the first and manually set the dates.
I could do this as 3 UI Actions (form context menu) but would have to duplicate some of the code in each UI Action. I prefer to handle this as a business rule with functions and use a parameter to determine which functions are called. Currently I have the first two started so they clone the change request and task. The two UI Actions write a value to a field on the change request and then updates the change request. This triggers the business rule and the value set in the field is the parameter that determines which functions to call. The preferred way would be for the UI Action call the business rule directly and pass it the needed parameter to eliminate the need to update the change request to trigger the business rule. Is this possible?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-12-2008 05:49 AM
I have created a few UI actions that do something similar. I have a few different paths the actions could take and i create a function within the UI action. Makes for a rather long script, but it is all contained in the same place.
I think you could create a global business rule for each function and then just call it the same way you would a function.. I think.. I will see if i can find an example.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-12-2008 05:59 AM
You can even create one business rule and fill it with 'similar' functions. Functions listed in global business rules can be called from anywhere in the system, in UI Actions, Client scripts etc....
UI Actions were originally part of Business Rules and are more or less the same.
Rik.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-12-2008 07:02 AM
Another option (and it's sometimes neater) is to make a script include.
You can create your script include in System Defintion -> Script Incldues
Then anywhere you want to reference the functions in the include you could do:
gs.include()
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-12-2008 07:17 AM
Thanks for the suggestions. Scripts Includes is something I have never looked at before. Both recommendations have definitely pointed me to a better direction.