Sitecore Path Analyzer: how to undeploy / remove a deployed map configuration
When creating new/custom Path Analyzer maps in Sitecore, sometimes the chosen data does not match the desired result or there is an error in the rules configuration (making them "not working") – in such cases, it would be helpful to "un-deploy" the map, just like one has to initially "Deploy" it using the Marketing Asset deployment workflow to activate it.
But how can this be achieved?
There is no general "un-deploy" option for existing Path Analyzer maps.
Unfortunately a simple "Unpublish" does not to work, as Path Analyzer maps underlay different behaviour with xConnect, rather than the regular item publishing. You may try to simply delete the deployed Map configuration, but in cases we saw, that didn't actually remove the configuration from xConnect data aggregation.
So, in the worst case, this procedure needs some manual work on the Database.
Know and use the Path Analyzer admin-page
But: it's noteworthy to consult the Path Analyzer admin-page as a first step, if one of the actions there might support your Use Case for redeploying or un-deploying a Path Analyzer map:
/sitecore/admin/pathanalyzer.aspx
Un-deploy approach #1: clearing the application cache
- Delete the Path Analyzer map configuration item
- Restart the IIS application pool for the CM server and check if the PA map is removed
Un-deploy approach #2: remove data in TreeDefinitions db-table
This may be applicable if the map you want to remove, is still listed in the TreeDefinitions database table – or causing log errors – after the #1 approach.
IMPORTANT: please backup the database – or at least the "TreeDefinitions"-table – before executing this operation!
- In SQL Server Management Studio, in the Reporting database, remove all the data from the "TreeDefinitions"-table, by executing the following command:
Delete * from TreeDefinitions
- This should resolve any issue with
Processing_GetTaskById
procedure
When could this actually matter?
We had a situation with custom Path Analyzer map having been deployed, but then suddenly starting to write a lot – and I really mean A LOT – of errors to the Sitecore logfile.
In exchange with the Sitecore Support, we figured out that the only way to prevent this from happening was the above described approaches, ultimately manually clearing the TreeDefinitions table in the database.
6904 18:50:04 ERROR [Path Analyzer] Error during aggregation. Exception: System.AggregateException Message: One or more errors occurred. Source: Sitecore.Framework.Rules.Core at Sitecore.Framework.Rules.RuleEngine.Run(IEnumerable1 rules, IEnumerable1 scopedResolvers) at Sitecore.PathAnalyzer.Rules.RulesValidator.ValidateRule(Interaction interaction, String rulesXml, ConditionParameters parameters) at Sitecore.PathAnalyzer.Construction.TreeBuilder.IsApplicable(Interaction interaction, String rulesXml, ConditionParameters conditionParameters) at Sitecore.PathAnalyzer.Construction.TreeBuilder.Build(Interaction interaction) at Sitecore.PathAnalyzer.Processing.AggregationContextCollector.Collect(Interaction interaction) at Sitecore.PathAnalyzer.Processing.TreeAggregator.Aggregate(ItemBatch`1 batch) at Sitecore.PathAnalyzer.Processing.Agents.TreeAggregatorAgent.Execute() Nested Exception Exception: Sitecore.Framework.Rules.RuleExecutionException Message: An error occured evaluating the primary condition of the rule. See the inner exception for details. Nested Exception Exception: System.ArgumentException Message: No rule fact resolver could be found for Type:'Sitecore.XConnect.Segmentation.Predicates.ISegmentationServiceContext', Role:''. Source: Sitecore.Framework.Rules.Core at Sitecore.Framework.Rules.FactProvider._.Resolve(IFactIdentifier identifier) at Sitecore.Framework.Rules.RuleExecutionContextExtensions.Fact[T](IRuleExecutionContext context, String roleName) at Sitecore.XConnect.Segmentation.Predicates.Interactions.ChannelTypeMatches.Evaluate(IRuleExecutionContext context) at Sitecore.Framework.Rules.BinaryCondition.Evaluate(IRuleExecutionContext context) at Sitecore.Framework.Rules.BinaryCondition.Evaluate(IRuleExecutionContext context) at Sitecore.Framework.Rules.RuleEngine.Run(IRule rule, IFactProvider factProvider)
6904 18:50:04 ERROR [Path Analyzer] Cannot apply rule on the interaction. Exception: System.AggregateException Message: One or more errors occurred. Source: Sitecore.Framework.Rules.Core at Sitecore.Framework.Rules.RuleEngine.Run(IEnumerable1 rules, IEnumerable1 scopedResolvers) at Sitecore.PathAnalyzer.Rules.RulesValidator.ValidateRule(Interaction interaction, String rulesXml, ConditionParameters parameters) at Sitecore.PathAnalyzer.Construction.TreeBuilder.IsApplicable(Interaction interaction, String rulesXml, ConditionParameters conditionParameters) Nested Exception Exception: Sitecore.Framework.Rules.RuleExecutionException Message: An error occured evaluating the primary condition of the rule. See the inner exception for details. Nested Exception Exception: System.ArgumentException Message: No rule fact resolver could be found for Type:'Sitecore.XConnect.Segmentation.Predicates.ISegmentationServiceContext', Role:''. Source: Sitecore.Framework.Rules.Core at Sitecore.Framework.Rules.FactProvider._.Resolve(IFactIdentifier identifier) at Sitecore.Framework.Rules.RuleExecutionContextExtensions.Fact[T](IRuleExecutionContext context, String roleName) at Sitecore.XConnect.Segmentation.Predicates.Interactions.ChannelTypeMatches.Evaluate(IRuleExecutionContext context) at Sitecore.Framework.Rules.BinaryCondition.Evaluate(IRuleExecutionContext context) at Sitecore.Framework.Rules.BinaryCondition.Evaluate(IRuleExecutionContext context) at Sitecore.Framework.Rules.RuleEngine.Run(IRule rule, IFactProvider factProvider) "[Path Analyzer] Cannot apply rule on the interaction."