Need help converting scripted activity in Workflow to and Event in Flow Designer

gjz
Mega Sage

I am converting a workflow into a flow, but I've run into a problem that I need help with.  I'm hoping there is an OOTB solution and I can avoid writing yet another custom action.

 

We have a custom table (Division) to break down the OOTB Department table further.  On the division table is a field called Liaisons that is of the type "List", which references the User table.  The liaison field can have one or more users in the list.

 

In one of the workflows, there is a Run Script step that looks up the division and gets a list of liaisons in order to send an email to each individual.  So far, I've been unable to reproduce the functionality in Flow and I really don't want to write another custom action if I don't have to.

 

The workflow script is:

 

var mail_ = new GlideRecord('u_cmn_divisions');
mail_.get(current.variables.to_division.toString());
if(mail_.u_liaisons)
    {
        gs.eventQueue('staff_transfer_arriving',current,mail_.u_liaisons.toString().split(','));
        //gs.info('triggered_event');
    }
 
I've tried both flow actions "Create Event Action" and "Fire Event", neither work and I believe it is because of the List field, I think I'm doing something wrong.  Fire Event fails with an error, Create Event Action completes successfully, but no email is generated.
 
In the flow:
1. I look up the record in the division table.
2. Using the output from the look up, I use a function to split the liaison list for Event Parm1 in the Create Event Action. (and the Fire Event action).  The separator for the Split function is a comma.
 
Here are screen shots of my Flow:
gjz_0-1734724288692.png

 

gjz_2-1734724401067.png

This is the error message I get if I use Fire Event - really not helpful.

class com.snc.process_flow.engine.serialization.GRProxy$1 cannot be cast to class java.lang.String (com.snc.process_flow.engine.serialization.GRProxy$1 is in unnamed module of loader com.snc.orbit.container.tomcat8.Tomcat8$OrbitTomcat8ClassLoader @1a35dd74; java.lang.String is in module java.base of loader 'bootstrap')

 

Does anyone have a solution?

 

 

4 REPLIES 4

Benjamin A
Mega Sage

Hi @gjz,

 

I assume you are using Parm1 as the list of Who in the notification. In this case do you need to split the list? Wouldn't you simply want to cast the list to a string and add that as the Parm1 as a string value of sys_ids?

 

Can you attach a screen shot of the execution details? It sounds like your list is not being cast to a string properly from the datapill. One way to fix this without looking close may be to create a flow variable of type string and store your list value in there first then use that datapill in the event Parm1.

 

Thanks,

Ben

The list is split - which is why I used the function for Parm1.

gjz_0-1734731003199.png

 

It looks like the data is being passed to the action.

 

What input is the action you are using expecting though? Is it string? If so you need to pass it as a string and parse it in the action using a scripted step since the output of the split is an array.

Another "workaround" to using a list with the Fire an Event action is to script firing the action in a Pause action. See the screenshot below for an example.

 

Screenshot 2024-12-20 at 11.53.53 AM.png