Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

"Failed to find complex object collection definition" when executing Flow via sn_fd.FlowAPI

bagills
Tera Contributor

Our sub-instances are currently Yokohama, and our production instance is Washington DC.

 

In our Yokohama sub-instances, I was able to execute a Flow via script by copying the Code Snippet for the Flow and providing the appropriate 'changed_fields' Array.Object. Executing the following in an Xplore session works as expected:

try {
		var inputs = {};
		inputs['current'] = manufacturerGR; // GlideRecord   
		inputs['changed_fields'] = [
                {
                  "current_display_value": "true",
                  "current_value": "true",
                  "field_name": "manufacturer",
                  "previous_display_value": "false",
                  "previous_value": "false"
                }]; 
		inputs['table_name'] = 'core_company';
				
		// Execute Synchronously: Run in foreground.
		sn_fd.FlowAPI.getRunner().flow('global.company_sync').inForeground().withInputs(inputs).run();
		
	} catch (ex) {
		var message = ex.getMessage();
		gs.error(message);
	}

 
However, this flow is unable to be triggered via script in our Washington DC production environment. On execution of the above script, the following error is caught: "Failed to find complex object collection definition".

Removing the Try/Catch from the script, the uncaught exception is the following:
"com.snc.process_flow.exception.ProcessAutomationException: Failed to find complex object collection definition"

 

I have been unable to find any resources online that explains the exception and am unable to find another way to trigger this flow via script. Additionally, I have tried parsing the object in the 'changed_fields' array to JSON. I have also attempted to trigger the flow with the following function, as described in the docs linked here:

sn_fd.FlowAPI.executeFlow('global.company_sync', inputs);

 

1 REPLY 1

KimaniT
Tera Contributor

Remove following code and try again.

inputs['changed_fields'] = [
                {
                  "current_display_value": "true",
                  "current_value": "true",
                  "field_name": "manufacturer",
                  "previous_display_value": "false",
                  "previous_value": "false"
                }];