AnsweredAssumed Answered

Сreate a file from a template

Question asked by taibek on May 25, 2017
Latest reply on May 27, 2017 by taibek

I found this code to create a file from a template


      // Data to fill in the template var num = "42"; var buyer = "Acme, Inc"; var sum = "700$";  // Get template file var tempFile = search.findNode( "workspace://SpacesStore/262981fb-e141-43bd-ac63-9b8199eb1077" ); // Get target folder var folder = search.findNode( "workspace://SpacesStore/ef296491-90ff-4427-a06a-31fd4abf4245" ); // Name of new file to be created var name = "Invoice " + num;  // Create string with data to fill the template. // Parameters names (number, company, amount) match the names in the template. var data = jsonUtils.toJSONString( {"Number": num, "CustomerName": buyer, "Amount": sum} );  // Create new file template.generate( tempFile, folder, name, data );

 

But it does not work says not found
jsonUtils and
template.generate

Tell me how to fix this or how to create a file from the template correctly

Outcomes