0 Replies Latest reply on Oct 4, 2010 7:58 AM by RosieGp

    Passing Flex datagrid values to CFM

    RosieGp Level 1

      In my flex code I have a datagrid showing all the records related to a single Employee_ID. What I need is to send an email with all the Job_unctions of a partiicular employee???

      For Example:

      Employee_ID      Employee_Name      Job_Functions

      1                       Joe                           Sales Representitive

      1                       Joe                           Assistant

      1                       Joe                           Personal Secetary

       

      SQL Query:

      Select Distinct Employee_ID, Employee_Name, Job_Functions

                From EmployeeDB

       

      Flex Code:

       

      function EmployeeResult(event:ResultEvent):void{

      EmpRes = event.result as ArrayCollection;

       

       

       

       

       

       

       

       

      }

       

       

       

      EmpJob" dataProvider="{EmpRes}" rowCount="{EmpRes.length}">

       

       

       

       

       

       

       

      <mx:columns>

       

       

       

       

      <mx:DataGridColumn headerText="Job Functions" dataField="Job_Functions"/>

       

       

       

       

      </mx:columns>

       

       

       

       

      </mx:DataGrid>

       

      Now this datagrid displays the data as following:

       

      Job Functions:

      Sales Representitive

      Assistant

      Personal Secetary

       

      I need to send an email with all this info:

       

      Flex Code:

       

       

       

       

      var Employee_Name:String = Employee_Name.toString();

       

      var Job_Functions:String = Job_Functions.toString();

       

       

       

       

       

      This will only show the following in the email:

       

      Employee ID: 1

      Employee Name: Joe

      Job Functions: Sales Representitive

       

       

      How do I change  the above code so that it shows me the following:

       

      Employee ID: 1

      Employee Name: Joe

      Job Functions: Sales Representitive

                            Assistant

                            Personal Secetary

       

       

      Any help is appreciated.

       

       

      Thanks.

       

       

       

      remoteObj.sendEmailFunction(Employee_ID,Employee_Name,Job_Functions);

       

      Coldfusion Code:

       

      <cffunction name="sendEmailFunction" access="remote" returntype="void">
          <cfargument name="Employee_ID" type="any" required="no">
          <cfargument name="Employee_Name" type="string" required="no">

          <cfargument name="Job_Functions" type="any" required="no">

      <cfmail to="#mail#@yahoo.com" subject="Employee Job Functions"  type="html">


                          <b>Employee ID:</b> #Employee_ID#
                          <br>
                          <b>Employee Name:</b> #Employee_Name#
                          <br>
                          <b>Job Functions:</b> #Job_Functions#

      </cfmail>

       

       

       

       

       

      </cffunction>

       

       

      var Employee_ID:String = Employee_ID.toString();

       

      <mx:DataGrid

       

      EmpRes = event.result

       

      private

      id="