Sign In Register

How can we help you today?

Start a new topic
Solved

removeScriptData in Response handler doesn't actually remove it, it just undoes your changes

The only way to get data from the Request handler to the Response handler is with Spark.setScriptData. However, in the Response handler, keys removed with Spark.removeScriptData incorrectly still appear in the Response result


 Request code: 

Spark.setScriptData("removeme", "toremove");
Spark.setScriptData("changeme", "tochange");

  Response code:    

Spark.setScriptData("removeme", "willremove");
Spark.removeScriptData("removeme");
//test will be null
var test = Spark.getScriptData("removeme");
Spark.setScriptData("changeme", "changed");
Spark.setScriptData("addme", "added");

     Response result:   

 "scriptData": {
  "removeme": "toremove",
  "addme": "added",
  "changeme": "changed"
 }

 In fact, removeScriptData basically undoes all changes: notice how it is "toremove" not "willremove" in the result. If we comment out the call to removeScriptData, it is "willremove".  


Added to the bug report pipeline


Thanks,


Oisin.

Any update on this issue? Is there a proper way to remove scriptData passed to the response handler from the request handler, including the key?

Hi,


Just to let you know that a fix is in place for this and is part of the release that is scheduled for this week.  It will be ready very shortly.  Keep an eye out for the release notes in the Announcements section.


Kind regards,


Tech Support

Login to post a comment