I am facing below issue in flow designer
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-13-2022 12:21 AM
Hi Team,
I am facing below error
Error: Cannot set property "u_agent_health" of undefined to "undefined",Detail: Cannot set property "u_agent_health" of undefined to "undefined"
(function execute(inputs, outputs) {
//query the ritm with inputs.ritm_sysid, then use that record for the variables.
var reqitem = new GlideRecord('sc_req_item');
reqitem.addQuery('sys_id',inputs.ritm_sysid);
reqitem.query();
if(reqitem.next())
{
//check if there are any other governance records for this app yet:
var govrec = new GlideRecord('u_app_governance');
govrec.addQuery('u_cmdb_applications_services_name',inputs.app.sys_id);
govrec.query();
if (govrec.next()){
//update it with all the variables
gs.info('GOVACTION: I have found the gov record');
govrec.u_agent_health = reqitem.variables.agent_health;
govrec.u_alerting_for_powerful_function_to_secops_enabled = reqitem.variables.alerting_for_powerful_function_to_secops_enabled;
govrec.u_branch_runbook_s_created_in_servicenow = reqitem.variables.branch_runbook_created_in_servicenow;
govrec.u_branch_support_trained = reqitem.variables.branch_support_trained;
govrec.update();
}
} else {
govrec.u_agent_health = reqitem.variables.agent_health;
govrec.u_alerting_for_powerful_function_to_secops_enabled = reqitem.variables.alerting_for_powerful_function_to_secops_enabled;
govrec.u_branch_runbook_s_created_in_servicenow = reqitem.variables.branch_runbook_created_in_servicenow;
govrec.u_branch_support_trained = reqitem.variables.branch_support_trained;
govrec.insert();
}
})(inputs, outputs);

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-13-2022 12:47 AM
Hi,
Try using getValue() and setValue instead of dotwalking.
Example below
//govrec.u_agent_health = reqitem.variables.agent_health;
govrec.setValue('u_agent_health', reqitem.variables.agent_health.toString());
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-13-2022 02:13 AM
in both conditions can I use same(
govrec.setValue('u_agent_health', reqitem.variables.agent_health.toString());
)

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-13-2022 02:37 AM
Yes, it will work fine in both conditions.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-13-2022 06:47 AM
I have a yes/no variable in catalog item, However I don't have yes/no in custom table, so i have used True/False.
For True/false it is always showing false only in custom table.
I have used below code.
govrec.setValue('u_agent_health', reqitem.variables.agent_health.toString());
if (reqitem.variables.agent_health = 'yes') {
govrec.setValue('u_agent_health', true);
} else {
govrec.setValue('u_agent_health', false);
}
for other variables it is working fine, However for agent_health it is not working means in RITM it is set to false, but in custom table it is set to true.
I am not sure why, Is my script is correct