Skip to main content

I'm having a bit of trouble trying to fetch comments for email notifications from activities that occur more than once. Here's a quick example

 

16878iDD476D24405E2852.jpg

 

In the above scenario, this is what happens:

 

1) Next-Level Manager Approval sends a work item to a user. They enter a comment on the OOTB action form - "Comment 1". It is sent to Addtional Information.

 

2) Additional Information sends a work item to a user. The notification email contains the comment, "Comment 1" previously entered during the Next-Level Manager action form submission. The user enters a comment on the OOTB action form - "Comment 2". It is sent back to Next-Level Manager Approval.

 

3) Next-Level Manager Approval sends a work item to a user. The notification email contains the comment, "Comment 2" previously entered during the Additional Information action form submission. The user enters a comment on the OOTB action form - "Comment 3". It is approved this time and sent to the next activity.

 

4) The activity that follows Next-Level Manager Approval (on approval) sends a work item to a user. The notification email contains "Comment 1", when it should contain "Comment 3".

 

I am using the Last function to obtain the last entered comment - Last(SPComments/Comment/Body, ""). It does not appear that this will work if any activity executes more than once.

 

Is there any way to fetch the correct comment in this scenario?

 

 

csunder


 


Which last function are you refering to? And how is the workflow set up to store the comments?


 


Ian


Ian,

 

I am using the Last Item function in the Lists group of inline functions. Apologies, I didn't have the correct function name.

 

I currently do not store the comments in any type of data field. I had tried to do so by using a data event to transfer SPCommentsFormCommentsCommentsCommentBody to a data field. If I remember correctly, this achieved the same result.

 


Hi,


 


Perhaps, you can use SPComments custom inline function from K2 community site (this is applied to SharePoint 2010), see link below.


http://community.k2.com/t5/K2-blackpearl/Get-SPComments-Custom-Inline-function/ba-p/1023


 


You will have to update the SPCommentFunctions.cs file to change:


System.Xml.XmlNodeList commentsList = xmlComments.SelectNodes("FormComments/Commentsnlast()]/Comment");


To:


System.Xml.XmlNodeList commentsList = xmlComments.SelectNodes("FormComments/Commentsnlast()]/Commentelast()]");


 


the solution will need to rebuild for the DLL below.
SourceCode.Workflow.Functions.SPCommentFunctions.dll


 


After that you should be able to add this custom inline function and use in your project.


 


 


-khanh-


Reply