Discussions
Categories
Groups
Community Home
Categories
INTERNAL ENABLEMENT
POPULAR
PUBLIC CLOUD
PRIVATE CLOUD
Quick Links
MY LINKS
HELPFUL TIPS
Back to website
Home
Web CMS (TeamSite)
Rule Name
gits
Hi
I need to get the Name of the Rule that is being currently applied in my component out of the many rules that the component may have. I was looking for ways in my customized SampleContentRetriever class to get the rule name but cant' find anything.
I wonder if it may be possible to pass it from my Action verbalization, but not sure how to pass the Rule Name there either.
Appreciate your help.
Thanks
TeamSite 7.3.2
Windows 2008 R2
Find more posts tagged with
Comments
gits
Any one with suggestions?
Thanks
nipper
No idea if it is available.
I have been resorting to loading some of the OOTB components (like dump context), and seeing if they list anything.
Rick Poulin
The rule name doesn't appear anywhere within what's sent to the rules engine. It's just the file name in which the rule XML is stored. As such, the only way to find that would be to use context.getThisComponentModel(), find the datum element for the rule (better hope you only have a single one), and then read its text value IF the rule name is even still in there. Not a supported API, btw.
gits
The thing is that getting the component model will only provide me the list of rules that it contains, but in my component, there are multiple rules applied so if 1st is false, 2nd is checked, and so on.
so only rules engine knows what rule got executed. correct?
Thanks
Rick Poulin
Pretty much, yes. The bottom line is that you probably shouldn't be making any code decisions based on a name that can easily be named wrong by the user. Instead, one of the actions should be something like setting a request parameter, which is then actually available to your component for triggering whatever additional code forks.
gits
Actually idea is for us to use that rule as a campaign name for our content.
Other option we had was to just add an additional field in the component and use that.
but we were trying to see if it can be made automated instead of user controlled.
Thanks