Created
October 11, 2019 16:18
-
-
Save anil826/e9e5f99db6b31960a5773da24228e1ea to your computer and use it in GitHub Desktop.
Data Table row calculation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//This event trigger on Salesforce Table data render | |
//Please replace the component-id/merge-id | |
formyoula.form_fields["598a-89a0-b2ba"].on("table:results:render:rowCallback", function(row) { | |
//Get all the table data. | |
var table_data = $("#salesforce_table_598a-89a0-b2ba").DataTable().data().toArray(); | |
//Check for table data | |
if(table_data.length){ | |
//Init the temp variable for calculation | |
var total_quantity = 0; | |
//Loop on table data | |
$(table_data).each(function(i, sf_row_data){ | |
//Add the Planned_Quantity__c | |
total_quantity += parseInt(sf_row_data.Planned_Quantity__c); | |
}); | |
//Set the total value in a hidden field | |
formyoula.form_fields['Hidden Field'].set('value', total_quantity); | |
} | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment