We assume that we have a persistent order which is stored in ./config/live/my/jobChain,template.order.xml.
We want to add an order to the job chain /some/jobChain by a standalone job.

In the following example we use the <show_order ... what="payload"/> command to get the order parameters.

 <?xml version="1.0" encoding="ISO-8859-1"?> 
 
 <job>
     <params>
         <param  name="orderTemplateFilename" value="/my/jobChain,template.order.xml"/>
         <param  name="addOrderToJobChain" value="/some/jobChain"/>
     </params>
 
     <script  language="javascript">
         <![CDATA[
 
 function spooler_process() {
 
     //read parameter which has a filename of the template *.order.xml as value
     var orderTemplateFilename      = spooler_task.params.value('orderTemplateFilename');
 
     //read parameter of a job chain path on which an order will be added
     var addOrderToJobChain         = spooler_task.params.value('addOrderToJobChain');
 
     var orderTemplateParamsElement = getOrderParamsElement(orderTemplateFilename);
 
     //1.Option: using spooler.execute_xml to add order
     var xmlCommand                 = '<add_order job_chain="'+addOrderToJobChain+'" at="now">'+orderTemplateParamsElement +'</add_order>';
     var answer = spooler.execute_xml(xmlCommand);
     spooler_log.info("XML Command: " + xmlCommand);
     spooler_log.info("Answer: " + answer);
 
     //2.Option: using add_order method on a job chain object
     var jobChain         = spooler.job_chain( addOrderToJobChain );
     var order            = spooler.create_order();
     order.at             = 'now';
     order.params.xml     = orderTemplateParamsElement||'<params/>';
     jobChain.add_order(order);
 
     return false;
}
 
 
 /**
 * @param Filename of an order
 * @return String <params> element of JobScheduler answer from <show_order ...> command
 */
 function getOrderParamsElement(orderFilename) {
 
     //remove extension of order filename and split, so that job_chain=orderFilenames[0] and orderID=orderFilenames[1]
     var orderFilenames = orderFilename.replace( /\.order\.xml$/, "").split(',');
 
     //execute <show_order .../> command with what="payload" to get the parameters
     var xmlCommand     = '<show_order job_chain="'+orderFilenames[0]+'" order="'+orderFilenames[1]+'" what="payload"/>';
     var answer         = spooler.execute_xml( xmlCommand );
     var paramsElement  = "";
 
     //match not empty params element
     var paramsElementMatch = answer.match(/<params[^>]*>.+<\/params>/);
     if(paramsElementMatch) {
         paramsElement  = paramsElementMatch[0];
         //remove attributes in params element
         paramsElement  = paramsElement.replace(/(<params)[^>]*(>.+<\/params>)/,"$1$2");
     }
 
     spooler_log.info("XML Command: " + xmlCommand);
     spooler_log.info("Answer: " + answer);
     spooler_log.info("Params Element: " + paramsElement);
 
     return paramsElement;
 }
         ]]>
     </script>
 
     <run_time />
 </job>

The second option above is better because you can modify the parameters in a simple way:

     //2.Option: using add_order method on a job chain object
     var jobChain         = spooler.job_chain( addOrderToJobChain );
     var order            = spooler.create_order();
     order.at             = 'now';
     order.params.xml     = orderTemplateParamsElement||'<params/>';
     order.params.set_var('hello', 'world');
     jobChain.add_order(order);

Further References

Job and Order Parameters