diff --git a/Client-Side Components/UI Actions/Add Loggedin user as Incident assigned to/ReadMe.md b/Client-Side Components/UI Actions/Add Loggedin user as Incident assigned to/ReadMe.md new file mode 100644 index 0000000000..d017057fbe --- /dev/null +++ b/Client-Side Components/UI Actions/Add Loggedin user as Incident assigned to/ReadMe.md @@ -0,0 +1,2 @@ +>**UI Action** +When a new Incident record is created, user can come to incident ticket and assigned to themself. Once they click on UI Action. diff --git a/Client-Side Components/UI Actions/Add Loggedin user as Incident assigned to/code.js b/Client-Side Components/UI Actions/Add Loggedin user as Incident assigned to/code.js new file mode 100644 index 0000000000..06b301c362 --- /dev/null +++ b/Client-Side Components/UI Actions/Add Loggedin user as Incident assigned to/code.js @@ -0,0 +1,12 @@ +var currentUser = gs.getUserID(); //Getting loggedIn User Id + +//Checing wheather user is available or not in Assignee field +if(current.assigned_to == ""){ //checking assigned to is there or not + current.assigned_to = currentUser; //Setting the current loggedIn user + current.update(); //updating the record. + gs.addInfoMessage("Incident has been assigned to You."); + action.setRedirectURL(current); +} else { + gs.addErrorMessage("Incident is already assigned"); + action.setRedirectURL(current); +}