Deactivated custom entities not displaying in the associated view

Answered Deactivated custom entities not displaying in the associated view

  • Tuesday, February 19, 2008 12:29 AM
     
     

    Does anyone know how to get deactivated custom entities to display on the associated view?


    I've tried adding the registry key as described on http://support.microsoft.com/kb/934805 (which was a hotfix for CRM3), but that does not work.

All Replies

  • Tuesday, February 19, 2008 8:45 AM
    Moderator
     
     

    Which version of CRM are you using ?

  • Tuesday, February 19, 2008 9:11 AM
     
     
    Probably should have mentioned that.... CRM 4

     

  • Tuesday, March 04, 2008 11:15 PM
     
     

     

    Nobody has had this issue?
  • Wednesday, March 05, 2008 1:00 AM
     
     

     

    Hi.

     

    1. Open the isv.config and add a new NavBarItem called Contacts

    <NavBarItem Icon="/_imgs/ico_18_debug.gif" Url="/ISV/ContactsAssosiatedView.aspx" Id="ContactsNavItem" PassParams="1">

          <Titles>

    <Title LCID="1033" Text="Contacts" />

    </Titles>

    </NavBarItem>

     

    2. Hide the current Contacts link that opens the associated view.

     

    function OnCrmPageLoad()

    {
         document.all.navContacts.style.display = "none";
    }

     

    OnCrmPageLoad();

     

    3. Point the new NavBarItem to a custom URL with an iframe to a fetchxml grid.

    4. Use the id parameter that is passes to the aspx and do a simple fetch on the contacts where the parent customer is the accountid.

        The fetch will return all contact associated with the account.

     

    Cheers,

    Adi

     

  • Wednesday, March 05, 2008 6:02 AM
    Moderator
     
     
    Hi,
    Below is the code to hide:

    ---------------------------------------------------------------------------­--------------
    Planning Tasks Nav  Item.
                  document.getElementById("navTasks").style.display = "none";

    Campaign Activities:
                  document.getElementById("navCampaignActivities").style.display
    = "none";

    Campaign Responses:
                  document.getElementById("navCampaignResponses").style.display
    = "none";

    Workflows:
                  document.getElementById("navAsyncOperations").style.display =
    "none";
    ---------------------------------------------------------------------------­--------------

    If you feel this resolves your problem, pls rate this post as Helpful

     

     

    you use that in javascript onload function.

     

    Regards,

    Imran

     

    http://microsoftcrm3.blogspot.com

     

  • Thursday, March 06, 2008 9:21 AM
     
     

    Maybe I didn't explain my problem clear enough...

     

    I have created a custom entity that is linked to the Accounts entity with a N:1 relationship (so that it shows up in the sidemenu on the account screen).

     

    I create several of these custom entities linked to one particular account so that they all show in the associated view. From the associated view I then click actions and click deactivate. The custom entity disappears from the associated view, but if you do an advanced find for the custom entity you can still see it.

  • Friday, March 07, 2008 2:01 AM
    Moderator
     
     Answered
    Hi Trent,

     

    Update: details are now available, condensed version is still here.


    it's possible to adjust the view using plug-ins which in CRM 4 now allow you to tap into select process as well. For example, associated view executes RetrieveMultiple requests filtering on statecode and parent account so the code that removes statecode filter might look like the following:

     

    Code Snippet

    using Microsoft.Crm.Sdk;
    using Microsoft.Crm.Sdk.Query;

    namespace Acme.Plugins
    {
      public class AssociatedPlugin: IPlugin
       {
          public void Execute(IPluginExecutionContext context)
          {
              if (context.PrimaryEntityName == "new_acme"
                  && context.InputParameters.Contains(ParameterName.Query))
              {
                  QueryExpression qe = context.InputParameters[ParameterName.Query] as QueryExpression;
                  if (qe.Criteria != null
                      && qe.Criteria.Conditions != null
                      && qe.Criteria.Conditions.Count == 2)
                  {
                      ConditionExpression ce = qe.Criteria.Conditions[0] as ConditionExpression;
                      if (ce != null
                          && ce.AttributeName == "statecode"
                          && ce.Operator == ConditionOperator.Equal
                          && ((int)ce.Values[0]) == 0)
                      {
                          qe.Criteria.Conditions.Remove(ce);
                      }
                  }
              }
          }
       }
    }

     

     

    Compile and register this plug-in: RetrieveMultiple message, new_acme as a primary entity, pre stage, syncrhronous, parent pipeline.

     

    In production you might want to add additional checks to ensure that the request is coming from associated view but the code above should get you started.

     

    Hope this helps

    ----------

    George

    MCBMS Professional - CRM Developer

    blog: http://crm.georged.id.au

     

  • Friday, March 07, 2008 10:54 PM
     
     

    Thanks George!!!!

  • Monday, March 16, 2009 3:03 PM
     
     
    This solution (plugin) works great but kills workflows on that entity... (at least on my machines) 

    Anyone get this working with workflows as well?  What was done?

    Cheers
    Nick
  • Monday, March 16, 2009 3:59 PM
     
      Has Code
    Fixed it by changing this line:

    context.InputParameters.Contains(ParameterName.Query)))

    to

    //if from async process (workflow) don't run

    if ((context.CallerOrigin.ToString() != "Microsoft.Crm.Sdk.AsyncServiceOrigin")&&(context.InputParameters.Contains(ParameterName.Query)))  

     

    Basically telling the plugin to ignore anything running from a workflow... so it doesn't raise an error and kill the workflow process.

    I hope this helps someone.

    Cheers
    Nick