Add workitems comment in a workflow

Which IIQ version are you inquiring about?

IIQ 8.4p1

Share all details related to your problem, including any error messages you may have received.

I am calling a workflow from a rule to open work items. How do I add comment to the workitems?
Currently I added comment postscript but that does not seem to work.
workflow - Generate Manual Revoke Access Workflow.xml (9.9 KB)

Hi @dk0200
Can you try this in your approval step?
Arg name=“workItemComments” value=“workitems for certification revocation”


I tried passing in it like this. It wouldnt save. Is this how you meant?

@dk0200 I don’t see workItemForm in your approval logic. Can you check ?

Hi @dk0200,

Can you try below snippet after adding in the approval.
Also save object and commit is option if it is not saving.

 <InterceptorScript>
        <Source>
		
		  import java.util.ArrayList;
import java.util.List;
	import sailpoint.object.Comment;
          import sailpoint.object.WorkItem;

          
          if (Workflow.INTERCEPTOR_OPEN_WORK_ITEM.equals(method)) {
			List comments=new ArrayList();
			Comment cmt=new Comment("Test Comments ","username");
			comments.add(cmt);
			item.setComments(comments);
			
			context.saveObject(item);
			context.commitTransaction();
          }
          
        </Source>
      </InterceptorScript>

Let us know if it solves purpose.

Thanks

I guess, in your workflow your are using the incorrect argument name, it should be workItemComments

I am not using any forms here. I am calling the workflow from this rule.
Generate manual work items Prod.xml (9.5 KB)

@ankush-shirbhate that worked. Thank you