Script snap with ultra pipelines: original property mapping to doc which is modified


I have a question regarding this statement from the SnapLogic documentation on Ultra Pipeline tasks (

Script and Execute Script Snaps need you to pass the original document to the ‘write()’ method for the output view.

I am using a script snap in a pipeline to modify the original document to move some properties around (thereby changing the original document). I am wrapping my original document in a wrapper and putting it in the original property as demonstrated in the sample Script snap. However, “original” contains my modified doc. Will this be a problem if I try to use Ultra?

A snippet from my Script snap is included below:

execute : function () {"Executing Transform Script");
        while (this.input.hasNext()) {
                // Read the next document, wrap it in a map and write out the wrapper
                var doc =;
                var wrapper = new java.util.HashMap();
                wrapper.put("original", doc.clone());
                wrapper.put("integrationMessage", doc["integrationMessage"]);
                var studentGradesWrapper = doc["integrationMessage"]["body"]["gradingSheetInfo"]["gradingSheet"]["studentGrades"];
                var supplementalInfosWrapper = doc["integrationMessage"]["body"]["gradingSheetInfo"]["supplementalInfos"];
                ensureArray(supplementalInfosWrapper, "supplementalInfo");
                var studentIdsToCslwIdsMap = new java.util.HashMap();
                    function(supplementalInfo) {
                        studentIdsToCslwIdsMap.put(supplementalInfo["studentId"], supplementalInfo["coursesectionLW"]["objectId"]);
                    function(studentGrade) {

                this.output.write(doc, wrapper);
            catch(err) {
                var wrapper = new java.util.HashMap();
                wrapper.put("errorMsg", err);
1 Like

So long as you’re passing the original object that was returned by ‘’, it should work even if the object itself is modified.

Separately, can I ask if you tried to use the Mapper and the expression language to do the transformation and were unsuccessful? It would be helpful to know if you ran into roadblocks on that path.