Sitecore - 在 OnSavingItem 事件上创建新项目会将 Shell 重定向到新创建的项目

发布于 2024-09-27 03:24:37 字数 161 浏览 0 评论 0原文

遇到一个烦人的问题。

当用户编辑项目上的字段时,我们使用 OnSavingItem 事件处理程序在后台其他位置创建一些新项目。

问题是用户编辑字段的项目被重定向到我们在后台创建的不可见项目。

我们希望它保持在原来的位置...有什么想法吗?

谢谢

Got an annoying issue.

When a user edits a field on an item, we use a OnSavingItem event handler to create some new items elsewhere in the background as it were.

Problem is the item the users edited the field of gets redirected to the item we invisible created in the background.

We want it to stay where it is... Any ideas?

thanks

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

九公里浅绿 2024-10-04 03:24:37

如果您想禁用到刚刚创建的项目的传输,您还可以考虑实现以下代码:

// Before we copy the item we put notifications on to make sure we won't be transfered to the newly created item                        
Sitecore.Client.Site.Notifications.Disabled = true;

// Your action comes here

Sitecore.Client.Site.Notifications.Disabled = false;

If you want to disable the transfer to the item you've just created you could also consider implementing the following code:

// Before we copy the item we put notifications on to make sure we won't be transfered to the newly created item                        
Sitecore.Client.Site.Notifications.Disabled = true;

// Your action comes here

Sitecore.Client.Site.Notifications.Disabled = false;
ぽ尐不点ル 2024-10-04 03:24:37

您正在使用

<event name="item:saved">

处理程序吗?如果是这样,请不要忘记该事件也会在您创建的所有新项目上触发,从而可能触发递归事件循环。

Are you using the

<event name="item:saved">

Handler? If so, don't forget that this event is fired on all the new items you create as well, potentially triggering a recursive event loop.

望喜 2024-10-04 03:24:37

这个答案来自 SiteCore 论坛...归功于 John West

我认为您可以使用 item: saving 事件或 saveUI 管道。如果您需要处理通过 API 发生的更改,请使用事件;如果您只需要处理通过用户界面发生的更改,请使用管道。

您还可以考虑将逻辑添加到字段本身。

约翰·韦斯特 Sitecore 博客

This answer came from the SiteCore forum ... credit goes to John West

I think you could use the item:saving event or the saveUI pipeline. Use the event if you need to handle changes that occur through APIs, or use the pipeline if you only need to handle changes that occur through the user interface.

You could also consider adding the logic to the field itself.

John West Sitecore Blog

ぽ尐不点ル 2024-10-04 03:24:37

item:saved 比 saveUI 管道中的处理器重得多。例如,item:saved 在发布过程中被触发,这不是您真正想要的。我始终建议在管道或工作流程操作级别处理此类自定义。

item:saved is much heavier than a processor within the saveUI pipeline. For example, item:saved is triggered during publishing which is not what you really want. I always recommend handling such customizations either on the pipeline or workflow action level.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文