Script to map picklist selections to category and sub categories.

Script to map picklist selections to category and sub categories.

I'm trying to find a way to map multiple picklist values to their respective categories and sub categories in bulk. Rather than creating form rules for each individual selection, I'm trying to write a script that will map these selections. 

var udf_char135 = await CS.getValue("udf_char135");
// Check the value of the "udf_char135" field and set the category and subcategory accordingly
if (selectionValue == "Outlook") {
    category = "Desktop Applications";
    subcategory = "Outlook";
} else if (selectionValue == "Teams") {
    category = "Desktop Applications";
    subcategory = "Outlook";
} else if (selectionValue == "Laptop") {
    category = "Hardware";
    subcategory = "Laptop";
} // Add more conditions for other picklist options if needed

// Set the value of the "Category" and "Subcategory" fields
CS.setValue("Category", category);
CS.setValue("Subcategory", subcategory);
CS.end();

Any help would be greatly appreciated.

                New to ADSelfService Plus?