The CreatorCon Call for Content is officially open! Get started here.

Allow a user to add others to the watchlist from the portal

Moedeb
Tera Guru

I would like to be able to have a user when making a catalog request via the portal to also have an option to add others to the watchlist for that request item.

 

EG: EA requesting on behalf of an Executive, wants to add their own name to the watch list so they can keep an eye on the request on behalf of the executive, or even just the requester going on leave and wants someone else to be able to see the updates.

 

I thought it would be as easy as mapping the question to the watchlist field and onsubmit adding those in the field, however this doesn't appear to be as simple as I thought.

Any help would be very much appreciated.

 

1 ACCEPTED SOLUTION

Moedeb
Tera Guru

I have managed to figure this out based on a few people's posts, so feel it best I share my overall solution.

Firstly, thank you to Vishal as your first link was helpful - First Link

I also found the script I needed here and wanted to give credit to Pradeep Sharma for their post

 

Firstly what I did was created a Variable Set for the watch list, so I could easily add it to any request or record producer that I wanted the ability to have a user add others to the watch list.

In the variable set I created a variable and called it 'add_to_watchlist' - this was set as a List Collector field.

 

I then created a Business Rule as follows:

Name: (really whatever you like)

Table: Incident [incident]  *If you are doing this for a request item the table would need to be Requested Item [sc_req_item]

Active: Selected

Advanced: Selected

When to run Tab

When: before

Order: 100 (really whatever suits you)

Insert: Selected

Update: Selected

Delete: unselected

Query: unselected

Filter Conditions and Role Conditions - leave as default

 

Actions Tab

Leave as is

 

Advanced Tab

Condition: Blank

Script:

(function executeRule(current, previous /*null when async*/) {

if(current.variables.add_to_watchlist)
{
current.watch_list = current.variables.add_to_watchlist;
}

})(current, previous);

 

Then save and add the variable set to the record producer (catalog request if doing a request item)

View solution in original post

6 REPLIES 6

Omkar Mone
Mega Sage

Hi 

You can add these selected users in the Workflow attached and then add from Run Script activity there.

What are your thoughts on this?

 

Let me know.

 

Moedeb
Tera Guru

I have managed to figure this out based on a few people's posts, so feel it best I share my overall solution.

Firstly, thank you to Vishal as your first link was helpful - First Link

I also found the script I needed here and wanted to give credit to Pradeep Sharma for their post

 

Firstly what I did was created a Variable Set for the watch list, so I could easily add it to any request or record producer that I wanted the ability to have a user add others to the watch list.

In the variable set I created a variable and called it 'add_to_watchlist' - this was set as a List Collector field.

 

I then created a Business Rule as follows:

Name: (really whatever you like)

Table: Incident [incident]  *If you are doing this for a request item the table would need to be Requested Item [sc_req_item]

Active: Selected

Advanced: Selected

When to run Tab

When: before

Order: 100 (really whatever suits you)

Insert: Selected

Update: Selected

Delete: unselected

Query: unselected

Filter Conditions and Role Conditions - leave as default

 

Actions Tab

Leave as is

 

Advanced Tab

Condition: Blank

Script:

(function executeRule(current, previous /*null when async*/) {

if(current.variables.add_to_watchlist)
{
current.watch_list = current.variables.add_to_watchlist;
}

})(current, previous);

 

Then save and add the variable set to the record producer (catalog request if doing a request item)

Nathaniel Alves
Kilo Expert

Thank you for this sound solution! Just note, if you need to be able to remove someone from the watch list after the business rule runs (say someone types in an incorrect email address) you will need to uncheck the "update" box on the business rule otherwise it will just put it back as soon as you save the ticket. 

Thanks!

Nate