getting error in main flow "Error: o,Detail: Unexpected token: o"

NS16
Mega Sage

Hi Experts,

I have created new action in the flow, when I testing that action in action level it working as expected(getting expected output) but when add that action in the main flow I am getting below error.

Error: o,Detail: Unexpected token: o

Can you please help me to resolve this issue

Here is script and I am passing input as a string

 

 

(function execute(inputs, outputs) {
    
     var rs = JSON.parse(inputs.response);
     outputs.groupoutput = extractGroupNames(rs);

      function extractGroupNames(response) {
          var groupNames = [];
          if (response && response.MemberOf) {
              for (var i = 0; i < response.MemberOf.length; i++) {
                
                  var match = response.MemberOf[i].match(/CN=([^,]+)/);
                  if (match && match[1]) {
                      groupNames.push(match[1]);
                  }
              }
          }
          return groupNames;
      }
  })(inputs, outputs);

 

 

Many thanks,

NS

 

1 ACCEPTED SOLUTION

NS16
Mega Sage

Hi Experts,

I am able to resolved it.

Solution- Instead of passing input as a string I passed it as a JSON and it worked and make some changes in script, here is my final working script.

(function execute(inputs, outputs) {
    
     var rs = inputs.response;
     outputs.groupoutput = extractGroupNames(rs);

      function extractGroupNames(response) {
          var groupNames = [];
          if (response && response.MemberOf) {
              for (var i = 0; i < response.MemberOf.length; i++) {
                
                  var match = response.MemberOf[i].match(/CN=([^,]+)/);
                  if (match && match[1]) {
                      groupNames.push(match[1]);
                  }
              }
          }
          return groupNames;
      }
  })(inputs, outputs);

View solution in original post

2 REPLIES 2

Prince Arora
Tera Sage
Tera Sage

@NS16 

 

Please make sure that you have published the action before use in flow and send the proper parameters whatever is required.

 

If my answer solved your issue, please mark my answer as  Correct & 👍Helpful based on the Impact.

NS16
Mega Sage

Hi Experts,

I am able to resolved it.

Solution- Instead of passing input as a string I passed it as a JSON and it worked and make some changes in script, here is my final working script.

(function execute(inputs, outputs) {
    
     var rs = inputs.response;
     outputs.groupoutput = extractGroupNames(rs);

      function extractGroupNames(response) {
          var groupNames = [];
          if (response && response.MemberOf) {
              for (var i = 0; i < response.MemberOf.length; i++) {
                
                  var match = response.MemberOf[i].match(/CN=([^,]+)/);
                  if (match && match[1]) {
                      groupNames.push(match[1]);
                  }
              }
          }
          return groupNames;
      }
  })(inputs, outputs);