web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Service | Customer Service, Contact Center, Fie...
Suggested Answer

Prevent users from removing someone else's items from queue

(1) ShareShare
ReportReport
Posted on by 65
Hi, is there a way to prevent users from removing other people's items and cases from a queue?
I have the same question (0)
  • Suggested answer
    Cui Hao Profile Picture
    Microsoft Employee on at
    Hi,

    There is no display rule for this Remove button, which proves that as long as you select the record Remove will appear, there is no OOB method to restrict this Remove button.


    I tested it in the direction of security roles and found it to be workable.
    I've given the user all permissions except the delete permission, with User level permissions. Although the user can still Remove at this point, they can't see other people's items in the queue, so they can't Remove someone else's items.


    I hope this helps.



    If my answer was helpful, please click Like, and if it solved your problem, please mark it as verified to help other community members find more. If you have further questions, please feel free to contact me.


    Best regards,
    Cui Hao
  • Suggested answer
    Cui Hao Profile Picture
    Microsoft Employee on at
    Hi,
     
    Do you have any other questions?
    If it solved your problem, please mark it as verified to help other community members find more. 
     
     

    Best regards,​​​​​​​
    Cui Hao
  • YB Profile Picture
    65 on at
    Hi, the goal of using queues is that users can collaborate and work on other people's cases whenever needed. For that reason, I need the users to be able to see other people's cases that are added to the queue and be able to pick them and work on them. So, I don't want to prevent them from seeing other people's items in the queue. I only want to prevent them from removing other people's cases in the queue. Is that possible?
  • Suggested answer
    Cui Hao Profile Picture
    Microsoft Employee on at
    Hi,
     
    I have implemented your needs with the plugin.
    I use the Plugin Registration Tool to register plugins.
     
    The code I wrote has fully realized your needs, you can make reference to it:
     public class PreventRemoveFromQueue : IPlugin
     {
         public void Execute(IServiceProvider serviceProvider)
         {
             ITracingService tracingService = serviceProvider.GetService(typeof(ITracingService)) as ITracingService;
             IPluginExecutionContext context = serviceProvider.GetService(typeof(IPluginExecutionContext)) as IPluginExecutionContext;
             if (context.InputParameters.ContainsKey("QueueItemId"))
             {
                 IOrganizationServiceFactory serviceFactory = serviceProvider.GetService(typeof(IOrganizationServiceFactory)) as IOrganizationServiceFactory;
                 IOrganizationService service = serviceFactory.CreateOrganizationService(context.UserId);
                 try
                 {
                     Guid queueItemId = (Guid)context.InputParameters["QueueItemId"];
                     ColumnSet columns = new ColumnSet();
                     columns.AllColumns = true;
                     Entity queueItem = service.Retrieve("queueitem", queueItemId, columns);
                     if (!queueItem.Attributes.Contains("workerid"))
                     {
                         return;
                     }
                     EntityReference workerRef = (EntityReference)queueItem.Attributes["workerid"];
                    
                     if (workerRef.Id != null && workerRef.Id != context.UserId)
                     {
                         throw new InvalidPluginExecutionException("Not allowed to remove queue items picked by other users!");
                     }
                 }
                 catch (Exception ex)
                 {
                     throw new InvalidPluginExecutionException(ex.Message);
                 }
             }
         }
     }
     
    My code bases the retrieval on the Workby field, only if the item is assigned to a user or not assigned, that user can remove the operation.
    After testing, my code runs successfully and does what you need, but there is still a point where it can be optimized, you can change the retrieve all columns to show retrieve certain columns.
     
     
    If my answer was helpful, please click Like, and if it solved your problem, please mark it as verified to help other community members find more. If you have further questions, please feel free to contact me.

    Best regards,
    Cui Hao
  • Suggested answer
    Cui Hao Profile Picture
    Microsoft Employee on at
    Hi,
     
    If you have questions feel free to ask me.
    If it solved your problem, please mark it as verified to help other community members find more. 
     
     
    Best regards,
    Cui Hao
     
     
     
  • Cui Hao Profile Picture
    Microsoft Employee on at
    Hi,
     
    Did you get a chance to implement the solution I suggested? If any part of the process is unclear, feel free to reach out to me anytime.
     
     
    Best regards,
    Cui Hao

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Meet the Microsoft Dynamics 365 Contact Center Champions

We are thrilled to have these Champions in our Community!

Congratulations to the March Top 10 Community Leaders

These are the community rock stars!

Leaderboard > Service | Customer Service, Contact Center, Field Service, Guides

#1
FSRon Profile Picture

FSRon 60

#2
Mallesh Deshapaga Profile Picture

Mallesh Deshapaga 32

#2
Gerardo Rentería García Profile Picture

Gerardo Rentería Ga... 32 Most Valuable Professional

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans