+*************************************************
+Writing Multiple Output Events from a Final State
+*************************************************
+
+.. container:: paragraph
+
+ APEX-PDP now supports sending multiple events from a final state in a Policy. The task assocaiated with the final
+ state can populate the fields of multiple events, and then they can be passed over as the output events from the final
+ state of a policy.
+
+.. note::
+ inputfields and outputfields are not needed as part of the task definition anymore. Fields of an event are already
+ defined as part of the event definition. Input event (single trigger event) and output event/events can be populated
+ to a task as part of the policy/state definition because the event tagging is done there anyway.
+
+.. container:: paragraph
+
+ Consider a simple example where a policy *CDSActionPolicy* has a state *MakeCDSRequestState* which is also a final
+ state. The state is triggered by an event *AAIEvent*. A task called *HandleCDSActionTask* is associated with
+ *MakeCDSRequestState*.There are two output events expected from *MakeCDSRequestState* which are *CDSRequestEvent*
+ (request event sent to CDS) and *LogEvent* (log event sent to DMaaP).
+ Writing an APEX policy with this example will involve the below changes.
+
+*Command File:*
+
+.. container:: listingblock
+
+ .. container:: title
+
+ Define all the concepts in the Policy. Only relevant parts for the multiple output support are shown.
+
+ .. container:: content
+
+ .. code::
+
+ ## Define Events
+ event create name=AAIEvent version=0.0.1 nameSpace=org.onap.policy.apex.test source=AAI target=APEX
+ ..
+ event create name=CDSRequestEvent version=0.0.1 nameSpace=org.onap.policy.apex.test source=APEX target=CDS
+ event parameter create name=CDSRequestEvent parName=actionIdentifiers schemaName=CDSActionIdentifiersType
+ ..
+ event create name=LogEvent version=0.0.1 nameSpace=org.onap.policy.apex.test source=APEX target=DMaaP
+ event parameter create name=LogEvent parName=status schemaName=SimpleStringType
+ ..
+
+ ## Define Tasks
+ task create name=HandleCDSActionTask
+ task contextref create name=HandleCDSActionTask albumName=EventDetailsAlbum
+ task logic create name=HandleCDSActionTask logicFlavour=JAVASCRIPT logic=LS
+ #MACROFILE:"src/main/resources/logic/HandleCDSActionTask.js"
+ LE
+ ..
+
+ ## Define Policies and States
+ policy create name=CDSActionPolicy template=Freestyle firstState=MakeCDSRequestState
+ policy state create name=CDSActionPolicy stateName=MakeCDSRequestState triggerName=AAIEvent defaultTaskName=HandleCDSActionTask
+ # Specify CDSRequestEvent as output
+ policy state output create name=CDSActionPolicy stateName=MakeCDSRequestState outputName=CDSActionStateOutput eventName=CDSRequestEvent
+ # Specify LogEvent as output
+ policy state output create name=CDSActionPolicy stateName=MakeCDSRequestState outputName=CDSActionStateOutput eventName=LogEvent
+ policy state taskref create name=CDSActionPolicy stateName=MakeCDSRequestState taskName=HandleCDSActionTask outputType=DIRECT outputName=CDSActionStateOutput
+
+*Task Logic File:*
+
+.. container:: listingblock
+
+ .. container:: title
+
+ Create outfields' instance if required, populate and add them the output events
+
+ .. container:: content
+
+ .. code:: javascript
+
+ ..
+ var cdsRequestEventFields = java.util.HashMap();
+ var actionIdentifiers = executor.subject.getOutFieldSchemaHelper("CDSRequestEvent","actionIdentifiers").createNewInstance();
+ actionIdentifiers.put("blueprintName", "sample-bp");
+ cdsRequestEventFields.put("actionIdentifiers", actionIdentifiers);
+ executor.addFieldsToOutput(cdsRequestEventFields);
+
+ var logEventFields = java.util.HashMap();
+ logEventFields.put("status", "FINAL_SUCCESS");
+ executor.addFieldsToOutput(logEventFields);
+
+.. container:: paragraph
+
+ With the above changes, the task populates the fields for both the expected events, and the corresponding state which
+ is *MakeCDSRequestState* outputs both *CDSRequestEvent* and *LogEvent*
+