Hi @Nadda Muhammad,
I'm glad to hear you solve the problem ,if you have any issue about SharePoint, you are welcome to raise a ticket in this forum.
By the way, since the Microsoft Q&A community has a policy that "The question author cannot accept their own answer. They can only accept answers by others." and according to the scenario introduced here: Answering your own questions on Microsoft Q&A, I would make a brief summary of this thread:
[select multiple rows in sharepoint and add the amount in amount column in Js]
Issue Symptom:
How to select multiple items in sharepoint list and get the sum of some field value. Then pass the data to a new form and set the default value by the caculated value.
Solution:
Solved by setting the variable in a workflow and using following code
<script type="text/javascript">
function getUrlParameter( name ){
name = name.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]");
var regexS = "[\\?&]"+name+"=([^&#]*)";
var regex = new RegExp( regexS );
var results = regex.exec( window.location.href );
if( results == null ) return "";
else return results[1];
}
function populateNewForm(){
document.getElementById("Training_67194962-c685-4033-8744-701fd9f26beb_$LookupField").value = getUrlParameter("Training");
}
_spBodyOnLoadFunctionNames.push("populateNewForm")
</script>
Here is the link for reference
Pass URL parameter to SharePoint new form (NewForm.aspx) to auto-populate a lookup field
You could click the "Accept Answer" button for this summary to close this thread, and this can make it easier for other community member's to see the useful information when reading this thread. Thanks for your understanding!