File tree Expand file tree Collapse file tree 1 file changed +28
-0
lines changed
Server-Side Components/Business Rules/Trigger Flow Expand file tree Collapse file tree 1 file changed +28
-0
lines changed Original file line number Diff line number Diff line change 1+ //Trigger flow from Business rule
2+ //Flow can be triggered in foreground or in background
3+ /*Triggering automated workflows after record creation or update.
4+ Passing dynamic data to flows for processing (e.g., notifications, approvals, integrations).
5+ Improving performance by running flows asynchronously.*/
6+
7+ ( function executeRule ( current , previous /*null when async*/ ) {
8+ current . state = 1 ;
9+ ( function ( ) {
10+
11+ try {
12+ var inputs = { } ;
13+ inputs [ 'current' ] = current ; // GlideRecord of table:
14+ inputs [ 'table_name' ] = '<table name>' ;
15+
16+ // Start Asynchronously: Uncomment to run in background.
17+ sn_fd . FlowAPI . getRunner ( ) . flow ( '<flow name>' ) . inBackground ( ) . withInputs ( inputs ) . run ( ) ;
18+
19+ // Execute Synchronously: Run in foreground.
20+ // sn_fd.FlowAPI.getRunner().flow('<flow name>').inForeground().withInputs(inputs).run();
21+
22+ } catch ( ex ) {
23+ var message = ex . getMessage ( ) ;
24+ gs . error ( message ) ;
25+ }
26+
27+ } ) ( ) ;
28+
You can’t perform that action at this time.
0 commit comments