Assigned to me UI ACTION

Ankit Kumar6
Tera Contributor

I have a requirement to create a UI Action (button) on incident  that should assign the current login user to assigned_to field.

Note: assigned to should be a member of assignment group then only it will accept the value. otherwise to create a popup to say you are not a member of this group

1 ACCEPTED SOLUTION

glad it helped,

 

kindly mark my answer as correct and close this thread. so it will appear into solved queue. 

View solution in original post

15 REPLIES 15

Gaurav Shirsat
Mega Sage

Hello Ankit

I have Acknowledged from your statement,these are some suggestions from my side:-

1)First You have to check whether the user is member of that group or not?

You can find out if the currently logged in user is the member of a particular group using isMemberOf() from the gs. getUser() method.
2)then you have to perform the server side code to assign that particular user assignment
3)If the user is not the member of that group you can simply use addInfoMessege() method to show pop up on the screen using on load client script 

 Please Mark Correct and Helpful

Thanks and Regards

Gaurav Shirsat

correct that is my requirement.

Alok Das
Tera Guru

Hi Ankit,

The comment of Ankur has a point that make the UI action only visible when the logged in user is a member of logged in group but in the scenario where the logged in user changes the assignment group the UI action will not be available for that scenario condition gets executed while loading of the form.

You can use the below script to assign the Current logged in user the current ticket and display a error message if the logged in user is not a assignment group member. Also, if user tries to assign the ticket with empty assignment group below script will throw an error message to enter an assignment group..

if (!current.assignment_group.nil()) {
    if (gs.getUser().isMemberOf(current.assignment_group)) {
        current.assigned_to = gs.getUserID();
        current.update();
    } else {
        gs.addErrorMessage("You are not a member of assignment group");
    }
} else {
    gs.addErrorMessage("Please enter a assignment group");
}

Note: With the above approach the UI action will be always visible. If you want to get the UI action visible based on the assignment group validation then you could go with the Ankur suggestion.

Kindly mark my answer as Correct and Helpful based on the Impact.

Regards,

Alok

Harsh Vardhan
Giga Patron

any update on this thread? 

 

if my answer helped you, kindly mark it as correct and close this thread .

i have made some changes now its working fine thanks your code help me alot.