script step within flow designer that pulls worknotes/comments into an array and selects the latest.

CandyDee
Kilo Sage

Can anyone help with the below

Write a script on the action (action is jira update comments action) such that if the action needs the latest comment put the values in an array and pick the latest- 

Basically im' trying to past across work comments using flow designer to Jira via integration hub. Im stuck on the guidance provided by servicenow.

I thought that expanding the script action on the 'comment' field of the action and inputting the script below was close but not getting there.

I can get snow stories being created in Jira using another flow i have, this is to pass worknotes across to update the comments of the jira issue.

find_real_file.png

 

 

1 ACCEPTED SOLUTION

Hitoshi Ozawa
Giga Sage
Giga Sage

Hi CandyDee,

Back to the original question.

"Add Comment" step is used to add a comment and not to retrieve them. Note, that there may be several comments and work notes attached to a record.

Following is a sample flow to retrieve comments and work notes attached to an incident.

This is the general flow. (1) First, I'm retrieving and incident record using "Look Up Record" step. (2) Then using "Look Up Records" to get all comments and work notes. (3) Then looping through the retrieved records to get each comment and work note.

find_real_file.png

1. Using "Look Up Record" to retrieve a record with comments or work notes. Not sure from the question which record is being retrieved because the trigger is on Service Catalog but mentions Integration Hub. This step should be changed to get the record to retrieve .

find_real_file.png

2. Retrieve comments and work notes related to the record. "Name" is the name of the table. In the example, I'm getting comments and work notes related to an incident table so have "Incident". Should change to fit the requirement.

"Element ID" is the sys_id of the record. Using data pill to get the "sys_id" from the retrieved record in step 1.

"Element" is type of journal records. I want to get "work_notes" and "comments" here.

find_real_file.png

3. There may be several comments and work notes related to a record to using "For Each Item in" step to get individual record returned in step 2. Used data pill to set Item to "journal Entry Records".

find_real_file.png

4. I'm just using a log statement here to log each comment and work note. Comment and work note is in field "Value". Using data pill to set Message to "Value" field under "journal Entry Record".

find_real_file.png

 

View solution in original post

7 REPLIES 7

Allen Andreas
Administrator
Administrator

Hi,

Please delete your other thread if you're going to have a new one.

This is a duplicate of the same thing, essentially, that you posted here: https://community.servicenow.com/community?id=community_question&sys_id=d7d7988fdb10d510457ae6be1396...

Please mark reply as Helpful, if applicable. Thanks!


Please consider marking my reply as Helpful and/or Accept Solution, if applicable. Thanks!

deleted the other post, though it wasnt clear so i rewrote it so it made more sense.

Hi,

It's better to post additional information in a question instead of creating a new question. Some members are competing on points and when there are 2 similar questions, it's becomes difficult to decide on who should get the credit.

Hello,

Thanks...I feel I covered that already in my original reply. It's not about competing for points or who gets credit. It's about the conversation being split amongst two threads and potentially volunteers wasting their time helping in one post, when the other may be already done and solved, etc.

Anyways, as I mentioned, I covered it well enough in my reply above and they've replied that they deleted it. It had no responses to it (which is why I said what I said above). It was deleted before you even posted your reply.

Glad my reply was Helpful. Thanks!


Please consider marking my reply as Helpful and/or Accept Solution, if applicable. Thanks!