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.

Invalid GlideRecord input format found

tuliogigante
Tera Contributor

Hi, 

 

I'm creating an UI Action that calls a subflow and it`s returning this error: 

Invalid GlideRecord input format found

 
When debugging I can see that the values that each variable receives is exactly the same inputs that my sub flow receives.
 
(function() {
 
try {
var inputs = {};
inputs['service_order'] = current.parent; // GlideRecord of table: sn_ind_tmt_orm_service_order
inputs['order_task'] = current.originated_from; // GlideRecord of table: sn_ind_tmt_orm_order_task

// Start Asynchronously: Uncomment to run in background. Code snippet will not have access to outputs.
// sn_fd.FlowAPI.getRunner().subflow('sn_ind_tmt_orm.consult_inventory').inBackground().withInputs(inputs).run();
 
// Execute Synchronously: Run in foreground. Code snippet has access to outputs.
var result = sn_fd.FlowAPI.getRunner().subflow('sn_ind_tmt_orm.consult_inventory').inForeground().withInputs(inputs).run();
var outputs = result.getOutputs();

// Current subflow has no outputs defined.
} catch (ex) {
var message = ex.getMessage();
gs.error(message);
}
 
})();
 
 
Any ideia in what can be wrong?
 
Regards
1 ACCEPTED SOLUTION

Michael Fry1
Kilo Patron

current - points to the GlideRecord. In your case, you can't have 2 currents because it's the same gliderecord being called. You can pass in one variable, ie current, and then in the subflow try and get the two fields you want. https://developer.servicenow.com/dev.do#!/reference/api/tokyo/server/sn_fd-namespace/ScriptableFlowA... 

View solution in original post

2 REPLIES 2

Michael Fry1
Kilo Patron

current - points to the GlideRecord. In your case, you can't have 2 currents because it's the same gliderecord being called. You can pass in one variable, ie current, and then in the subflow try and get the two fields you want. https://developer.servicenow.com/dev.do#!/reference/api/tokyo/server/sn_fd-namespace/ScriptableFlowA... 

tuliogigante
Tera Contributor

Many thanks @Michael Fry1, it's working fine.

 

Now it's like this:

 

var fallout = new GlideRecord('sn_ind_tmt_orm_order_task');
fallout.get(current.originated_from);

var inputs = {};
inputs['order_task'] = fallout;
 
 
 
Regards