locked
Activities Related to Account - Customize View RRS feed

  • Question

  • Hi,

    I have to customize Activities and history views in the account form to filter record displayed.

    I'm going to do this with a plugin, but I cannot find the message on which execute the plugin: how can I intercept the fetchXML that builds those activities lists?

    Then I also have to change the view name from Related "Regarding" Records to Related Records: how can this be done?

     

    Thanks a lot

     

     

    Marco

    Thursday, July 29, 2010 10:22 AM

Answers

  • It provides not FetchXml. It provides Query. Check this article about RetrieveMultiple message handling.
    Microsoft CRM Freelancer

    My blog (english)
    Мой блог (русскоязычный)
    Friday, July 30, 2010 10:33 AM
    Moderator
  • Resolved with help of your article.

    Registered on Rollup message.

    Here is sample code:

     

    object[] inputParamTarget = (object[])context.InputParameters[ParameterName.Target];
    
       for (int i = 0; i < inputParamTarget.Length; i++)
       {
       if (inputParamTarget[i] is QueryExpression)
       {
        QueryExpression query = (QueryExpression)inputParamTarget[i];
    
        FilterExpression fExprHasRegarding = new FilterExpression();
    
        ConditionExpression conditionHasRegarding = new ConditionExpression("regardingobjectid", ConditionOperator.NotNull);
    
        entityType.Conditions.Add(conditionHasRegarding);
    entityType.FilterOperator = LogicalOperator.And; query.Criteria.Filters.Add(fExprHasRegarding);
    ((object[])context.InputParameters[ParameterName.Target])[i] = query; } }

     

    Marco

     

    • Marked as answer by Marco Dodaro Sunday, August 1, 2010 1:28 AM
    Sunday, August 1, 2010 1:25 AM

All replies

  • Hi,

    you have to write you plugin on Execute message,

    check

     http://community.dynamics.com/blogs/hardworkdays/comments/48412.aspx

    you will have idea how to use it


    Mahain My Blog
    Thursday, July 29, 2010 10:29 AM
    Moderator
  • Hi, Marco.

    In the case of activities regarding account you should handle 2 types of messages - RetrieveMultiple and Pollup. Rollup is not supported out of box but it can be enabled. Check following article - http://a33ik.blogspot.com/2010/01/handling-rollup-message-with-plugins-in.html

     

    About changing view type you should check following url - http://www.stunnware.com/crm2/topic.aspx?id=js11


    Truth is opened the prepared mind

    My blog (english)
    Мой блог (русскоязычный)
    Thursday, July 29, 2010 10:33 AM
    Moderator
  • Hi Andriy,

    thanks a lot for your suggestions!

    Following your second link I've successfully changed dropdown's value.

    Now I'm checking for the first issue.

    @Mahender Pal: I had already tried, but in my case the execute message is not raised, so I have to find another way..

     

    Friday, July 30, 2010 8:21 AM
  • Try to check with RetrieveMultiple


    Mahain : http://mahenderpal.wordpress.com
    Friday, July 30, 2010 8:28 AM
    Moderator
  • RetrieveMultiple works, but it doesn't provide the fetchXML query that I need to modify.
    Friday, July 30, 2010 10:30 AM
  • It provides not FetchXml. It provides Query. Check this article about RetrieveMultiple message handling.
    Microsoft CRM Freelancer

    My blog (english)
    Мой блог (русскоязычный)
    Friday, July 30, 2010 10:33 AM
    Moderator
  • Sorry, I made a mistake: neither RetrieveMultiple is fired.

    The right message (as you have suggested me before) is Rollup on activity pointer and account.

    I'm now checking your article to understand how to manage the query (that is also contained in inputparameters passed with Rollup message).

     

    Marco

    Friday, July 30, 2010 11:00 AM
  • Resolved with help of your article.

    Registered on Rollup message.

    Here is sample code:

     

    object[] inputParamTarget = (object[])context.InputParameters[ParameterName.Target];
    
       for (int i = 0; i < inputParamTarget.Length; i++)
       {
       if (inputParamTarget[i] is QueryExpression)
       {
        QueryExpression query = (QueryExpression)inputParamTarget[i];
    
        FilterExpression fExprHasRegarding = new FilterExpression();
    
        ConditionExpression conditionHasRegarding = new ConditionExpression("regardingobjectid", ConditionOperator.NotNull);
    
        entityType.Conditions.Add(conditionHasRegarding);
    entityType.FilterOperator = LogicalOperator.And; query.Criteria.Filters.Add(fExprHasRegarding);
    ((object[])context.InputParameters[ParameterName.Target])[i] = query; } }

     

    Marco

     

    • Marked as answer by Marco Dodaro Sunday, August 1, 2010 1:28 AM
    Sunday, August 1, 2010 1:25 AM