I'm looking for a way to use SSJS to retrieve results for various ImportDefinitions. I see that one could do it with API (here), but I'm not certain how that translates to SSJS.

Is there anything that would be something like the below? The below doesn't work in CloudPages and the "Write" does not give any results as to why it fails.

1   | <script runat=server>
2   |    Platform.Load("core","1");
3   |     
4   |    var results = ImportDefintion.Retrieve({Property:"ImportDefExternalKey",SimpleOperator:"equals",Value:"ImportDefName"});
4   |
5   |    Write(Stringify(results));
6   | </script>

Do a retrieve on "ImportResultsSummary" object via WSProxy.

<script runat="server">
try {
   var prox = new Script.Util.WSProxy();
   var cols = [
   var filter = {
      Property: "ImportDefinitionCustomerKey",
      SimpleOperator: "equals",
      Value: "123456789"

   var result = prox.retrieve("ImportResultsSummary", cols, filter);
   Write("result: " + Stringify(result));
} catch(ex) {
    Write("An error has occurred: " + Stringify(ex));
  • That is being recognized in CloudPages, but it's throwing the error "result: {"Status":"Error: Index and count must refer to a location within the string.\r\nParameter name: count","RequestID":"xxxx-1234-xxxx","Results":null,"HasMoreRows":false}" instead of what's in var cols. Any chance you are able to recreate this error and know how to fix it? In the var filter "value" I'm placing the externalkey of the ImportDef ('xxxx...' is a placeholder).
    – Harley
    Jul 26 '19 at 1:10
  • 1
    @Harley I accidentally included the object in the cols array... oops. I have updated the example. Jul 26 '19 at 3:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.