Convert BR script into Custom Flow Action

Anderson_R
Tera Contributor

I'm trying to convert the following BR into a custom flow action with a script step. However, I'm having difficulty putting it together. Any help with the input variables, script, and output variables would be greatly appreciated. 

The business rule I'm trying to convert: 

(function executeRule(current, previous /*null when async*/) {
	// Call the script include
	new global.u_AttachmentUtils().copyAllAttachmentsToMe(current.parent.sys_class_name.toString(), current.getValue('parent'), current);
})(current, previous);


What I currently have in my flow action, but isn't working: 

Anderson_R_0-1713898136120.png

Any help is greatly appreciated! 

1 ACCEPTED SOLUTION

I have created a sample action

 

Action inputs

Karunakaran_0-1714035930728.png

Script step:

Karunakaran_1-1714035998778.png

 

I tested it with some random incidents. it worked.

Hope this helps.

 

Thank you.

 

View solution in original post

7 REPLIES 7

Hi @Anderson_R 

 

Yes, you need to create the custom action like a method with its parameter in the business rule.

 

The current object, dot walked field value from the current object should be passed from the previous step which is in the flow,

 

 

How to create a dot walked field as an input:

consider that the dot walked field is a string field. you need to define the input as string here in the action. While giving the input to action in the flow, you can dot walk from the Data picker or you can script it.

 

Consider a flow -->

 

1. trigger condition

2. Get record --> this can be from the trigger record

3. call the custom action --> as input, pass the parameters (Get Record, dot walked field value)

4. end

 

Hope this helps. Please let me know, if you need more details.

 

If you want to use the OOTB functionality to copy the attachments in flow designer, you can refer the below link.

Copy Attachment Action 

 

Thank you.

Regards,

Karunakaran.

I have created a sample action

 

Action inputs

Karunakaran_0-1714035930728.png

Script step:

Karunakaran_1-1714035998778.png

 

I tested it with some random incidents. it worked.

Hope this helps.

 

Thank you.

 

This helped a lot, thank you! I was about to create my custom action and flow, like so: 

1. Custom Action Input: 

Screenshot 2024-04-26 081926.png

2. Custom Action - Look Up Record Step:  

Screenshot 2024-04-26 081945.png

3. Custom Action - Script Step:  

Screenshot 2024-04-26 082005.png

4. The Flow - Calling the Custom Action w/Sys ID input. 

Screenshot 2024-04-26 082031.png