title: Mule dataweave issue with when condition
body: <p>Need help with a when condition in Dataweave transformation. My data weave transformer is populating email address in an output java object. The input email address comes from flow variable. I want to hydrate the output object only if email is stored in flow variable.</p>
  
  <p>Below is the code I have and if I try to add a when condition, it throws an error. Can anyone please help with this conditional logic?</p>
  
  <pre><code>maintainContactInformationData: {
          effectiveDate: flowVars.currentDate,
          workerContactInformationData: {
              emailAddressData: [{
                  emailAddress: flowVars.email ,
                  usageData: [{
                      typeData: [{
                          primary: true,
                          typeReference: {
                              ID: [{
                                  type: "Communication_Usage_Type_ID",
                                  value: "WORK"
                              } as :object {
                                  class : "com.workday.hr.CommunicationUsageTypeObjectIDType"
                              }]
                          } as :object {
                              class : "com.workday.hr.CommunicationUsageTypeObjectType"
                          }
                      } as :object {
                          class : "com.workday.hr.CommunicationUsageTypeDataType"
                      }]
                  } as :object {
                      class : "com.workday.hr.CommunicationMethodUsageInformationDataType"
                  }]  
              } as :object {
                  class : "com.workday.hr.EmailAddressInformationDataType"
              }] when flowVars.email != null,
  </code></pre>