Is it possible to have custom logic behind the Create Incident button?

EmilyAWN
Tera Expert

We would like the Create Incident button to look at the knowledge base the current article is in, and create a record based on that knowledge base's assigned record type, while still creating the appropriate record in cxs_relevant_doc/_task.

 

In the IT knowledge base, the button creates an INC.

In the HR knowledge base, it creates an HR case.

In the Legal knowledge base, it creates a Legal ticket.

Etc., etc.

 

I'm not sure if the solution is to change the button's behavior, or to change the views for each knowledge base and have a different button for each view, or something else, or if it just isn't possible.

 

 

1 REPLY 1

Sainath N
Mega Sage
Mega Sage

@EmilyAWN : In this case, you can go by single button and add the differentiating logic in the script. Add similar structure of code in your UI Action script.

if (current.knowledge_base == 'sys_id_of_it_knowledge_base') {
    createIncident();
} else if (current.knowledge_base == 'sys_id_of_hr_knowledge_base') {
    createHrCase();
} else if (current.knowledge_base == 'sys_id_of_legal_knowledge_base') {
    createLegalRequest();
}

function createIncident() {
    // Add your Incident creation logic.
}

function createHrCase() {
    //Add your HR Case creation logic
}

function createLegalRequest() {
    //Add your Legal Request creation logic.
}

 

Please mark this as correct answer and helpful if it resolved, or mark this helpful if this help you to reach towards solution.