Work-Relay DocumentationCore Design and ExecutionForms Using FormsHow to Run Form Action From Lightning Component

How to Run Form Action From Lightning Component

To run form action from lightning component one has to fire WR_BPM:ApplicationEvent event and pass following JSON object as "data" parameter:

{
	"target": "{FORM_ID}",
	"busEvent": {
		"source": "external",
		"actions": {
			"{FORM_ACTION_NAME}": {
              "parameters": {
                  "{FORM_ACTION_PARAMETER_NAME}": "{PARAMETER_VALUE}"
               }
           }
        }
    }
}
Click to copy

Parameter value should be replaced with value that needs to be passed from Lightning component or any value from the form itself. To pass form values as action parameters use form objects, such as {$Form}, {$Variables}, form Context Object ect.

Function in below example will run 'Check options' action on the form.

runAction : function(component, event, helper) {
    var params = 'January;March';
        
    var appEvent = $A.get("e.WR_BPM:ApplicationEvent");
    var jsonObject = {
		"target": "{FORM_ID}",
			"busEvent": {
             "source": "external",
              "actions": {
                  "Check options": {
                      "parameters": {
                          "options": params
                       }
                   }
               }
          }
     };
     
     appEvent.setParams({"data" : jsonObject});
     appEvent.fire();
        
}
Click to copy

See form action setup:

and picklist setup:

Execution of action triggered from the Lightning Component will check January and March options of picklist:

0 Comments

Add your comment

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.