Expand my Community achievements bar.

SOLVED

Notify Multiple Users on Task Release

Avatar

Level 2

A group in our org has 9 custom user fields on the Project object that are various points of contact for the projects. They also have a custom task status called "Released". The requirement is that, when a task is set to Released, those points of contact are notified. Each POC field may or may not be populated. What we DON'T want to do is create an update for each POC, as that would junk things up.

 

Here's my current scenario. We're creating an "empty" update for each POC (no text), which results in no update actually being created. This works, but the notifications aren't informative (because the update is empty). They need to at least see the Task name and that it was released.

RAshley_0-1721914538474.png

I'm inclined to think the solution is to create a single Update with the needed text and then somehow send multiple notifications (after validating the presence of data in each POC field) on that Update. But how?

 

1. How it SHOULD work is to build a dynamic array that's passed to the Notify field on the Create Update module. From what I can tell this doesn't work, and in fact creates individual updates per notification.

 

2. As an alternative, I could @mention each POC in the text, but I haven't been able to figure out how to build the HTML for that.

 

Any ideas on how to get either of these solutions to work?

Any approaches I haven't thought of?

 

Thanks

Topics

Topics help categorize Community content and increase your ability to discover relevant content.

1 Accepted Solution

Avatar

Correct answer by
Level 6

Hey--my brain wasn't so fried after all!  I figured out a way to make the scenario work without the router and all those router paths.  I first tested that I could create a tagged note using a Custom API Call module.  Here's that test module (for 2 tagged users)--the body was too large to fit in one screenshot, so I pasted it into Notepad and screenshotted that.

35 url and method.pnghardcode body.png

I then went to work trying to make a dynamic API call.  I cloned my original scenario, getting rid of the router and its paths.

api scenario.png

I then created a group of variables--if the non-null count was greater than zero, then I got the first item in my array as user 1 (otherwise, the variable is null); if the non-null count was greater than 1, then I got the second item in my array as user 2 (otherwise, the variable is null); and so on.

20.png

Next I created a new array of the ID values of these variables, removing the null values and concatenating the result into a comma-delimited string (when first building the scenario, I did need to have all 4 of my test fields populated with a user so I could pull the IDs).

22.png

I then formatted this string for use in the body of a Custom API Call module.  I added the syntax needed at the beginning and end of the tagged users portion and used the Replace function to insert the syntax between the IDs.

24.png

Lastly I added this to the body of my Custom API Call module.

35 body.png

This seems to be working.

Again, a notifyExpression object in the Note API would be ideal, but this is a bit shorter than all the router path work.

 

 

 

 

 

 

View solution in original post

10 Replies

Avatar

Level 4

Hi,

 

I'm struggling with similar issue as I need to add one update, but notify multiple people.

I was able to add @user tags to my note text by mimicking the WF link:

1  - add them as html to text aggregator as

<a target="_blank" href="https://{your_link}.workfront.com/user/{user_ID}" style="background-color: var(--spectrum-blue-100); padding: 0 2px; border-radius: 2px" data-mention="USER_{user_ID}" data-lexical-mention="true">@{user_name}"</a> (your values are in {})

2 - add this text to your note text

 

This will add it to the comment, but it does not send notification to anyone, and I can't figure out how to achieve both (1 note/update and multiple notifications to different users)

Avatar

Level 6

There's a 'Note Tag' record type option under the Create Record module.  It feels like this should work (adding a tag to an existing note), but it keeps throwing an error when I try running it.

My other (clunky) thought was to (1) determine the total number of POC fields that are populated; (2) pass those non-null values through a router (with separate paths for each possible total, 0-9); (3) and break those POC IDs out into separate user entries under the Notify option in the Create Record >> Note type (e.g., if your total is 4, you should have a module with inputs going into four different user slots under the Notify option).  Honestly, this approach feels like a lot of work--perhaps someone may have better luck with creating a Note Tag record than I've had.

Avatar

Level 6

Okay, I was able to make it work using the second method.  It might be overkill and you might be able to streamline this a bit, but it did work when I tested it.

For my test I just used 4 custom user fields; I made them user typeahead fields on a project form.  I didn't want to fool with creating a webhook (and that's not the part that's giving you trouble), so I just used a single test project and manually ran my scenario after populating and/or de-populating the user fields.

Here's my overall scenario.

01.png

I used a Read a Record module to output my project ID and 4 user fields.  I then created an array of these 4 fields.

02.png

Next I removed the empty fields from the array.

03.png

I then did a count of the items in the non-null array (for use in creating the router filters).

04.png

Next I added an iterator to go through the items in the array.

05.png

The only way I could figure out how to extract the User ID from the user fields was to add a Parse JSON module.  I had to create a data structure to identify the three components of the typeahead field--objCode, name, ID.

06.png

I then added an Array Aggregator with the Iterator as the source module and the user ID as the aggregated field.

07.png

From here I could add a router and build filtered paths for each of the possible totals of non-null user fields (note: I did not test the scenario with all 4 users fields being blank--it may be necessary to add some error handling to account for that possibility).

I created set variables / create record modules for each path, with the number of variables and notify item slots corresponding to that path's non-null total.  Here's the path where 2 of the user fields were filled out and 2 were left blank.

11.png12.png

Again, this is a bit much, but it worked for my test.  Hopefully it can give you some ideas.

 

 

Avatar

Level 2

I have a few kinks to work out but initial tests look good. Thank you!!!

 

That being said, there really should be a simpler way to do this.

Avatar

Level 2

It's working, except that the users are getting emails but no in-app notifications, which seems very odd to me.

Avatar

Level 6

I ran my scenario in the sandbox preview.  I got both in-app notifications and emails (when I put myself as one of the contacts).

I do wish that the API had something similar to predecessorExpression (in the Task object) for Notes.  I was able to use a Custom API Call module to create a tagged note, but I had to break out the different user notifications (it'd be nice just put them in a delimited string like you can with task predecessors).  It may be possible to incorporate all the needed syntax (e.g., curly brackets) with the user IDs and pass all of that as one big variable to the Custom API Call (thus eliminating the need for the router paths in my original scenario), but my brain's a little too fried at the moment to figure that out.

Avatar

Correct answer by
Level 6

Hey--my brain wasn't so fried after all!  I figured out a way to make the scenario work without the router and all those router paths.  I first tested that I could create a tagged note using a Custom API Call module.  Here's that test module (for 2 tagged users)--the body was too large to fit in one screenshot, so I pasted it into Notepad and screenshotted that.

35 url and method.pnghardcode body.png

I then went to work trying to make a dynamic API call.  I cloned my original scenario, getting rid of the router and its paths.

api scenario.png

I then created a group of variables--if the non-null count was greater than zero, then I got the first item in my array as user 1 (otherwise, the variable is null); if the non-null count was greater than 1, then I got the second item in my array as user 2 (otherwise, the variable is null); and so on.

20.png

Next I created a new array of the ID values of these variables, removing the null values and concatenating the result into a comma-delimited string (when first building the scenario, I did need to have all 4 of my test fields populated with a user so I could pull the IDs).

22.png

I then formatted this string for use in the body of a Custom API Call module.  I added the syntax needed at the beginning and end of the tagged users portion and used the Replace function to insert the syntax between the IDs.

24.png

Lastly I added this to the body of my Custom API Call module.

35 body.png

This seems to be working.

Again, a notifyExpression object in the Note API would be ideal, but this is a bit shorter than all the router path work.

 

 

 

 

 

 

Avatar

Level 2

I will definitely try this, assuming a note can be attached to a task as opposed to a project. My scenario is currently creating an update on the task, but I like your solution much better.

Avatar

Level 6

You can attach a note to either.  My scenario above attaches it to a project, but if you want to add it to a task, in the Custom API Call module, you can change the noteObjCode to TASK and pass the task's ID to the objID:

KristenS_WF_0-1722876585997.png

 

Avatar

Level 2

It's working!!!

2 small caveats:

1. I'm getting emails but still no in-app notifications. Not sure why.

2. I had to use this to add a note to a task:

"topNoteObjCode":"TASK",
"topObjID":"{<object id>}",

 I can't thank you enough!