I am trying to set the value from flow designer script but it is not working
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
I am trying to set the subcategory value from the flow but it is not working
(function execute(inputs, outputs) {
var dbType = fd_data._1__get_catalog_variables.database_type;
var subCategory = "";
if (dbType == "cmdb_ci_db_mssql_database") {
subCategory = "mssql";
}
else if (dbType == "cmdb_ci_db_ora_instance") {
subCategory = "oracle";
}
else if (dbType == "cmdb_ci_db_mongodb_instance") {
subCategory = "mongo_db";
}
else if (dbType == "cmdb_ci_db_db2_instance") {
subCategory = "db2";
}
else if (dbType == "cmdb_ci_db_mysql_instance") {
subCategory = "mysql";
}
else if (dbType == "cmdb_ci_db_postgresql_instance") {
subCategory = "postgresql";
}
else if (dbType == "cmdb_ci_cassandra_instance") {
subCategory = "cassandra";
}
else if (dbType == "Maria") {
subCategory = "maria_db";
}
else {
subCategory = "other";
}
// return backend value of subcategory
return subCategory;
})(inputs, outputs);
2 REPLIES 2
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
things to check and try to use toString()
1) add log and see what value came in variable
2) are you comparing correct choice value for that variable
3) are you setting correct choice value for the field
(function execute(inputs, outputs) {
var dbType = fd_data._1__get_catalog_variables.database_type.toString();
gs.info('variable value' + dbType);
var subCategory = "";
if (dbType == "cmdb_ci_db_mssql_database") {
subCategory = "mssql";
} else if (dbType == "cmdb_ci_db_ora_instance") {
subCategory = "oracle";
} else if (dbType == "cmdb_ci_db_mongodb_instance") {
subCategory = "mongo_db";
} else if (dbType == "cmdb_ci_db_db2_instance") {
subCategory = "db2";
} else if (dbType == "cmdb_ci_db_mysql_instance") {
subCategory = "mysql";
} else if (dbType == "cmdb_ci_db_postgresql_instance") {
subCategory = "postgresql";
} else if (dbType == "cmdb_ci_cassandra_instance") {
subCategory = "cassandra";
} else if (dbType == "Maria") {
subCategory = "maria_db";
} else {
subCategory = "other";
}
// return backend value of subcategory
return subCategory;
})(inputs, outputs);
If my response helped please mark it correct and close the thread so that it benefits future readers.
Regards,
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
Hope you are doing good.
Did my reply answer your question?
If my response helped please mark it correct and close the thread so that it benefits future readers.
Regards,
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader