What am I missing?? Please help with this script

Community Alums
Not applicable

Getting "Could not save record because of a compile error: JavaScript parse error at line (42) column (82) problem = missing } in compound statement (<refname>; line 42)" when trying to save the script in this record producer for our service catalog. Please help!

 

current.caller_id = gs.getUserID();
current.location = gs.getUser().getLocation();
var grLookup = new GlideRecord("dl_u_assignment");
grLookup.addQuery("location", gs.getUser().getLocation());
grLookup.query();
if (grLookup.next()) {
    current.assignment_group = grLookup.assignment_group;
}
current.contact_type = "self-service";
current.impact = 2;
current.urgency = 2;
current.priority = 3;
if (current.category == "ERP") {
    if (current.subcategory == "D365") {
        if (current.u_level3_category == "Production Control") {
            current.applyTemplate("ERP - Production Control");
        } else if (current.u_level3_category == "Inventory Management") {
            current.applyTemplate("ERP - Inventory Management");
        } else if (current.u_level3_category == "Master Planning") {
            current.applyTemplate("ERP - Master Planning");
        } else if (current.u_level3_category == "Modules") {
            current.applyTemplate("ERP - Modules");
        } else if (current.u_level3_category == "Procurement and Sourcing") {
            current.applyTemplate("ERP - Procurement and Sourcing");
        } else if (current.u_level3_category == "Product Information Management") {
            current.applyTemplate("ERP - Product Information Management");
        } else if (current.u_level3_category == "Sales and Marketing") {
            current.applyTemplate("ERP - Sales and Marketing");
        } else if (current.u_level3_category == "Tablet") {
            current.applyTemplate("ERP - Tablet");
        } else if (current.u_level3_category == "Warehouse Management") {
            current.applyTemplate("ERP - Warehouse Management");
        } else if (current.u_level3_category == "Finance") {
            current.applyTemplate("ERP - Finance");        
if (current.category == "Inquiry / Help") {
    if (current.subcategory == "HR"); {
        current.applyTemplate("HR Incidents");  
if (current.category == "Applications") {
    if (current.subcategory == "Workday"); {
        current.applyTemplate("HR Workday Incidents");
}
gs.addInfoMessage("Thank you - we'll take a look and see what we can do to help");
1 ACCEPTED SOLUTION

J Siva
Tera Sage

Hi @Community Alums 

} is missing in multiple places.

PFB for the valid script.

current.caller_id = gs.getUserID();
current.location = gs.getUser().getLocation();

var grLookup = new GlideRecord("dl_u_assignment");
grLookup.addQuery("location", gs.getUser().getLocation());
grLookup.query();
if (grLookup.next()) {
    current.assignment_group = grLookup.assignment_group;
}
current.contact_type = "self-service";
current.impact = 2;
current.urgency = 2;
current.priority = 3;
if (current.category == "ERP") {
    if (current.subcategory == "D365") {
        if (current.u_level3_category == "Production Control") {
            current.applyTemplate("ERP - Production Control");
        } else if (current.u_level3_category == "Inventory Management") {
            current.applyTemplate("ERP - Inventory Management");
        } else if (current.u_level3_category == "Master Planning") {
            current.applyTemplate("ERP - Master Planning");
        } else if (current.u_level3_category == "Modules") {
            current.applyTemplate("ERP - Modules");
        } else if (current.u_level3_category == "Procurement and Sourcing") {
            current.applyTemplate("ERP - Procurement and Sourcing");
        } else if (current.u_level3_category == "Product Information Management") {
            current.applyTemplate("ERP - Product Information Management");
        } else if (current.u_level3_category == "Sales and Marketing") {
            current.applyTemplate("ERP - Sales and Marketing");
        } else if (current.u_level3_category == "Tablet") {
            current.applyTemplate("ERP - Tablet");
        } else if (current.u_level3_category == "Warehouse Management") {
            current.applyTemplate("ERP - Warehouse Management");
        } else if (current.u_level3_category == "Finance") {
            current.applyTemplate("ERP - Finance");
        }
    }
}
if (current.category == "Inquiry / Help") {
    if (current.subcategory == "HR") {
        current.applyTemplate("HR Incidents");
    }
}
if (current.category == "Applications") {
    if (current.subcategory == "Workday") {
        current.applyTemplate("HR Workday Incidents");
    }
}

 Hope this helps.

Regards,

Siva

View solution in original post

2 REPLIES 2

J Siva
Tera Sage

Hi @Community Alums 

} is missing in multiple places.

PFB for the valid script.

current.caller_id = gs.getUserID();
current.location = gs.getUser().getLocation();

var grLookup = new GlideRecord("dl_u_assignment");
grLookup.addQuery("location", gs.getUser().getLocation());
grLookup.query();
if (grLookup.next()) {
    current.assignment_group = grLookup.assignment_group;
}
current.contact_type = "self-service";
current.impact = 2;
current.urgency = 2;
current.priority = 3;
if (current.category == "ERP") {
    if (current.subcategory == "D365") {
        if (current.u_level3_category == "Production Control") {
            current.applyTemplate("ERP - Production Control");
        } else if (current.u_level3_category == "Inventory Management") {
            current.applyTemplate("ERP - Inventory Management");
        } else if (current.u_level3_category == "Master Planning") {
            current.applyTemplate("ERP - Master Planning");
        } else if (current.u_level3_category == "Modules") {
            current.applyTemplate("ERP - Modules");
        } else if (current.u_level3_category == "Procurement and Sourcing") {
            current.applyTemplate("ERP - Procurement and Sourcing");
        } else if (current.u_level3_category == "Product Information Management") {
            current.applyTemplate("ERP - Product Information Management");
        } else if (current.u_level3_category == "Sales and Marketing") {
            current.applyTemplate("ERP - Sales and Marketing");
        } else if (current.u_level3_category == "Tablet") {
            current.applyTemplate("ERP - Tablet");
        } else if (current.u_level3_category == "Warehouse Management") {
            current.applyTemplate("ERP - Warehouse Management");
        } else if (current.u_level3_category == "Finance") {
            current.applyTemplate("ERP - Finance");
        }
    }
}
if (current.category == "Inquiry / Help") {
    if (current.subcategory == "HR") {
        current.applyTemplate("HR Incidents");
    }
}
if (current.category == "Applications") {
    if (current.subcategory == "Workday") {
        current.applyTemplate("HR Workday Incidents");
    }
}

 Hope this helps.

Regards,

Siva

Community Alums
Not applicable

Fixed! Thank you!