locked
RetrieveMultiple not fired for incident entity plug in when user selects views (my active cases,all active cases view etc) RRS feed

  • Question

  • Hi All:

    I have a requirement to filter out special cases(incident) (hippa flagged cases) from all crm views for  specific Bu and roles.

    I have written a plug in which fires on PreCreate event for incident entity on RetrieveMultiple message.But the plug in is not getting fired.

    The dotnet plug in contains logic to check the BU and roles associated with the current user and based on that appropriate Query filter is appended.

    I tried Prevalidation,Post event also. it is not working as well.

    Thanks in advance.
    Tuesday, December 25, 2012 4:43 AM

Answers

All replies

  • Hi Sujith,

    May I know how you are doing this?

    Can you explain more what you are doing in code and how you are playing with plugin registration ?

    So that I can help you very well !!! :)

    how are you getting value of the Incident in your code ? is it the way? look below.

     Entity entity = null;
                        if (context.MessageName.ToLower() == "create")
                        {
                            if (context.InputParameters.Contains("Target") &&
                                context.InputParameters["Target"] is Entity)
                            {
                                // Obtain the target entity from the input parmameters.
                                entity = (Entity)context.InputParameters["Target"];

                            }
                        }

    I used the same code for Incident plugin which is firing on create of Incident record in Pre-operation Stage,as Synchronous.

    Please don't forget to Vote and marked as answer If this post answers your question or was helpful, please click "Mark As Answer" on the post and "Mark as Helpful" Be wise..:)

    Tuesday, December 25, 2012 7:20 AM
  • Hi Sujith,

    In retrievemultiple or retrieve plugins you should use

    Entity entity= (Entity)context.OutputParameters["BusinessEntity"]

    Instead of using

    Entity entity = (Entity)context.InputParameters["Target"];

    Thank you,


    Dibyasingh Tripathy

    Tuesday, December 25, 2012 8:40 AM
  • Hi All:

    In Plug in  Execute method

    I tried to use the following codes

    a small skelton,

    MyPlugIn:IPlugIn

    {

    line no :1 Entity incident= (Entity)context.OutputParameters["BusinessEntity"];
    line no :2 string beforeXml = (String)context.InputParameters["FetchXml"];

    }

    I registered this plug in on RetrieveMultiple message on incident entity

    I checked all 3  event stages like prevalidation/preevent/post event

    It is throwing exception.I am not able to debug as well using plugin registration tool.I am getting the following error :"An error   has occured"

    I do not have direct access to CR Mserver .So i am debugging the plug ins using Plugin Registration tool.(Create profile,attch VS,then debug etc)

    I am able to debug all other scenarios such as Update plug ins using plug in registarion tool.But for retrieval message,I am not even able to

    create the profile.Every time,I am getting the error "An error has occured".

    It seems that the  plug in  code is fired for retrievemultiple message.When I comment line no1:1&2, i am able to see the 'My cases view' ,If i uncomment line no:1&2,I am getting the error "An error has occurred"  as shown in picture.

    plug in registraion message

    Is there any specific things/seetings required for RetrieveMultiple plug ins ?

    Thanks in Advance,

    Best Sujith



    • Edited by sujithapril Wednesday, December 26, 2012 5:49 AM
    Wednesday, December 26, 2012 5:23 AM
  • Hi Sujith,

    Are you done trying  unregistering and reregistering the plugin? You can check the network traffic by using Fiddler.Sometimes it is very helpful.  


    Dibyasingh Tripathy

    Wednesday, December 26, 2012 6:30 AM
  • Hi,
        You have to modify the query for the Case Views in pre-stage to include your additional conditions. You can go through the following blog article to achieve what you are looking for. In the plugin, add the condition check whether the current user belongs to a specific role/BU then update the query.

    http://blogs.msdn.com/b/ukcrm/archive/2011/03/10/using-plug-ins-to-modify-views.aspx


    Vikranth http://howto-mscrm.blogspot.com "Please Mark it as answer if it helps in resolving your query"

    • Proposed as answer by Vikranth Pandiri Wednesday, December 26, 2012 8:31 AM
    • Marked as answer by sujithapril Wednesday, December 26, 2012 12:35 PM
    Wednesday, December 26, 2012 8:30 AM
  • Oops,

    Thnaks Everyone

    I restarted my Remote desktop and there was a small mistake in the code,I corrected it.

    Thnaks every one   especially  vicky

    Wednesday, December 26, 2012 12:35 PM
  • I am having exactly the same situation. Could you please tell me what was the small mistake in the code. So that i can tele with my code. 
    My plugin is also not firing for cases.

    Wednesday, February 26, 2014 7:12 AM