从 SharePoint 工作流报告错误的最佳方法是什么?
我在工作流程中有一个自定义操作,并且希望在出现问题时向用户报告错误。 最好的方法是什么?
UPD: 理想情况下,我希望将工作流程置于错误状态并将消息记录到工作流程日志中。 这似乎不可能。 我能到达的最接近的距离是多少? 我想要一个可重用的解决方案,用户在 SharePoint Designer 中使用我的自定义操作时可以轻松设置该解决方案。
为问题添加了更多详细信息。
@mauro 负责存储错误,但是如何以有意义的方式向用户显示错误?
@AdamSane 这似乎是一个相当脆弱的解决方案。 这不是在单个站点上设置一次的问题。 我需要其他人可以使用 SPD 添加一些内容。
I have a custom action in a workflow and would like to report an error to the user when something goes wrong. What's the best way of doing that?
UPD: Ideally I would like to put the workflow in the error state and log a message to the workflow log. That doesn't seem possible. What's the closest I can get to it? I want to a reusable solution,something that's easy for users to set up when using my custom action in SharePoint Designer.
Added more details to the question.
@mauro that takes care of storing the error, but how do I display the error to the user in a way which makes sense?
@AdamSane That's seems like a rather fragile solution. It's not a matter of setting this up once on a single site. I need something others can add using SPD.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
如果您需要用户因错误而采取某些操作(例如重试工作流程),是否可以为该用户创建一个任务,其中包含有关错误和工作流程位置的信息?
If you need the user to take some action as a result of the error (e.g. retrying the workflow) is it possible to create a task for that user with information on the error and the location of the workflow?
将错误添加到具有该用户名的隐藏列表中。 将列表上的可见性(对于用户)设置为仅读取/写入他们自己的值。 然后使用自定义 Web 部件或 FlexListViewer 查看该列表的内容并将其显示给用户。 一旦他们承认该错误,请将其从列表中删除。
如有必要,您可以在该消息列表上添加不同的工作流程操作,即暂停 2 天,然后发送电子邮件。 随便吧,看你的要求。
否则,您可以拥有一个自定义数据库表,用于几乎相同的事情,这样 sharepoint 可以为您完成大部分工作。
更新 这可以打包为一项功能,并根据需要部署到每个站点。 这种方法的优点(将列表项添加到列表、查询、提醒用户以及向用户发送电子邮件)都内置于共享点本身中。 在这种情况下,您可以仅关注自定义逻辑,同时让 sharepoint 关注实现细节。
Add the error to a hidden list with that users name. Set the visibility on the list (for users) to only read/write their own values. Then use a custom web part or FlexListViewer to view the contents of that list and display it to the user. Once they acknowledge that error, remove it from the list.
If necessary, you can add a different workflow action on that message list, that says pause for 2 days and then email. Whatever, depending on your requirements.
Otherwise you can have a custom db table that you use for pretty much the same thing, this way sharepoint does most of the work for you.
Update This can be packaged up as a feature and deployed to each site as needed. The strengths of this approach (adding a list item to a list, querying, alerting a user, and emailing a user) are all built into the sharepoint itself. In this case you can focus on your custom logic only, while letting sharepoint focus on the implementation details.
就我个人而言,我会根据问题将其记录到日志文件或事件日志中。 我认为使用用户权限存储它是一个坏主意,如果该用户没有正确的权限会发生什么? 或者更糟糕的是,他们通过在资源管理器视图中浏览列表来获得更高的权限?
日志文件将是最好的方法,这样您只依赖于可用的文件系统 - 您不必担心在连接到数据库等时捕获发生的错误。
Mauro
Personally I would log it to either a log file or the event log depending on the issue. I think storing it using a users permissions would be a bad idea, what happens if that user does not have the correct rights? or worse still they get elevated permissions by browsing the list in explorer view?
The log file would be the best way, that way you rely only on the file system being available - you dont have to worry about trapping errors happening whilst connecting to the database etc.
Mauro
当您抛出错误时,您的错误处理程序可以向用户发送电子邮件,或者如果列表很大,则更好,将错误状态添加到工作流程项 - 我认为这是默认功能,但因为那里会提到错误。
http://www.sharepointsecurity .com/blog/sharepoint/sharepoint-2007-development/fault-handling-in-sharepoint-workflows/
when you throw the error your error handler can then email the user, or better if the list is massive, add the error state to the workflow item - i think this is default functionality though as the error would be mentioned there.
http://www.sharepointsecurity.com/blog/sharepoint/sharepoint-2007-development/fault-handling-in-sharepoint-workflows/