Discussions
Categories
Groups
Community Home
Categories
INTERNAL ENABLEMENT
POPULAR
THRUST SERVICES & TOOLS
CLOUD EDITIONS
Quick Links
MY LINKS
HELPFUL TIPS
Back to website
Home
Web CMS (TeamSite)
Triggering a script on SetEA or DeleteEA events
Shell
I want to have a trigger which updates a metadata field if another metadata field is changed.
eg. We have a replicant of up to 20 categories which for metadata search purposes need to be concatenated. See sample metadata below.
TeamSite/Metadata/Search Categories=Category1 ,Category2 ,Category3
TeamSite/Metadata/Category Replicant/0/Category=Category1
TeamSite/Metadata/Category Replicant/1/Category=Category2
TeamSite/Metadata/Category Replicant/2/Category=Category3
I know that the events I want to watch are SetEA and DeleteEA and they are being captured in our events log which is a good start.
[Fri Aug 23 17:06:59 2002] ITEG\mhansen master SetEA \default\main\PwC_Consulting_Test_Branch\WORKAREA\testing \templatedata\axa\general\data\test TeamSite/Metadata/Category Replicant
[Fri Aug 23 17:06:59 2002] ITEG\mhansen master SetEA \default\main\PwC_Consulting_Test_Branch\WORKAREA\testing \templatedata\axa\general\data\test TeamSite/Metadata/Category Replicant/0/Category
[Fri Aug 23 17:06:59 2002] ITEG\mhansen master SetEA \default\main\PwC_Consulting_Test_Branch\WORKAREA\testing \templatedata\axa\general\data\test TeamSite/Metadata/Category Replicant/0/Category Effective Date
[Fri Aug 23 17:06:59 2002] ITEG\mhansen master SetEA \default\main\PwC_Consulting_Test_Branch\WORKAREA\testing \templatedata\axa\general\data\test TeamSite/Metadata/Category Replicant/0/Category Expiry Date
[Fri Aug 23 17:06:59 2002] ITEG\mhansen master SetEA \default\main\PwC_Consulting_Test_Branch\WORKAREA\testing \templatedata\axa\general\data\test TeamSite/Metadata/Content Author
[Fri Aug 23 17:06:59 2002] ITEG\mhansen master SetEA \default\main\PwC_Consulting_Test_Branch\WORKAREA\testing \templatedata\axa\general\data\test TeamSite/Metadata/Content Owner
I also know that I need to use the custom iwat.ipl rather than another because there is no specific event for SetEA and DeleteEA.
I have also written a script which I want to run when the event is triggered. The script expects that the filename is passed in as the parameter to the script.
What I don't know is ...
1) What information the iwat.ipl makes available and if it can even pass in the name of the file. The CLT Manual (page 43) for IWAT does not specify any environment variables are available like other triggers have. So I am not sure how I am actually supposed to work out what file has been updated.
2) how to "Activate" the event in NT which will cause my program to run passing in the parameter of the file which has caused the even to occur... KB Article 1424 is a little helpful but not much.
I assume I need something like the following after reading that article. But I am still not sure how I get my filename!!
Application: c:\iw-home\iw-perl\bin\iwperl.exe
AppParameters: c:\iw-home\bin\iwatsub.ipl
c:\iw-home\iw-perl\bin\iwperl.exe
c:\iw-home\bin\custom\components\set_searchable_categories.ipl
AppDirectory: c:\temp (or where you want the application to execute)
3) Do I have to execute my program for all metadata attribute changes or can I limit it to certain fields AND if they add 10 categories can I make it just execute once rather than 10 times??
We have the following products installed:
- TeamSite 5.0.2
- TeamSite Templating 5.0.2
We are on a Windows platform.
Has anyone done something like this before??
Thanks, Shell.
Find more posts tagged with
Comments
Adam Stoller
You'd need to use 'iwat.exe' not 'iwat*.ipl' - the usage of which you can get by running: iwat -h
usage: c:\iw-home\bin\iwat.exe [-h] [-v] [-s servername] eventpattern program
So - in your case it would be something like:
iwat SetEA IWHOME/iw-perl/bin/iwperl path/to/your/script
(where IWHOME is the path to your iw-home directory)
I can't remember right now, but you may need to double-quote the last two parts so that they appear as one parameter:
iwat SetEA "IWHOME/.../iwperl /path/to/your/script"
I suggest the first instance of your script simply dump to a log file the arguments passed in on the command line:
open(DBG, ">c:/temp/iwat_test.txt") || die "$!";
my $i = 0;
foreach(
@ARGV){
print DBG "$i) $_\n";
$i++;
}
close(DBG);
That way you can look at what is being passed in, and use that to help you design the actual script you want.
Unfortunately, I believe that this will trigger for *each* EA that is set - so if you are setting N EA's on a single file, it will probably fire N times.
This could reduce overall performance of your TeamSite server if you have lots of files with lots of EAs being set farily often.
Another possibility is to do this via a workflow rather than on the event itself - thus if you have an explicit SetMetadata step in your workflow, you could follow it up with an externaltask that checks each file associated with the workflow and acts accordingly based on relevant information.
--fish
(Interwoven, Curriculum Development)
james1
Just FYI: I believe that if you use <checkbox> or <select multiple='t'> instead of <replicant>, then there will automatically be an EA with the concatenation of all selected choices. And you even get to specify the delimiter, as an attribute of <checkbox> or <select>.
-- James
Shell
Hi James,
The reason we are not using a checkbox type of thing is because although they can only choose up to 20 categories the list of categories to choose from is much larger and depends on the branch you a viewing what the options are.
Thanks anyway, Shell
Shell
Hey Adam,
Thanks for your thoughts. We had thought of putting it in workflow but had held off because it meant that the value was not set until AFTER the content had been submitted.
Since we are creating this field to allow searching through metadata search it means that only submitted content will be updated for searching.
If TeamSite was able to search on replicants then it would not be an issue at all.
Thanks, Shell.
Adam Stoller
Why does using a workflow mean this has to happen *after* submission - rather than before-but-during the submission process? Or do you not want this to happen in association with submission at all?
I don't have personal experience with it - but you might check out TeamXML and its use of XYZ-Find either by looking at material available on our web site, support site, or perhaps contacting an Interwoven Sales representative. I'm not suggesting plucking down cash for TeamXML *just* for the XYZ-Find functionality - but to look at all the features the product provides and consider whether or not it might be a good fit for what you are trying to do.
--fish
(Interwoven, Curriculum Development)