Tuesday, 6 September 2016

Utilize Custom Action to Help Filtering The Lookup View in CRM Form

Overview

Sometimes in our project, we have requirement to filter lookup based on some conditions and it can be achieved using addCustomView or addCustomFilter function.

And sometimes it is just not too easy to do it in Javascript or the complex fetch xml, so in my blog I just want to share another method to get the filtered result same as you wanted, that is using Javascript + Custom Action!

Detail

Following my previous post: http://missdynamicscrm.blogspot.sg/2014/08/crm-2013-using-addcustomfilter-to-get-filtered-lookup-field-based-on-linked-entity.html

So, considering you have this filter:
image

To get the result as per expected, you can use Custom Action.

Steps:

1. You need to create a custom action that give you output, either STRING or ENTITYCOLLECTION

2. Inside the custom action code, if you want to return string, you can use comma delimited concept, or using | as delimiter, or you can just return the Final XML Filter already.

If you use EntityCollection, you might need to parse it again.

3. Then create a javascript that can call the Custom Action, you can use this method for easy way:
http://www.magnetismsolutions.com/blog/paulnieuwelaar/2015/08/12/Call-Action-in-CRM-2015-Easily-from-JavaScript-Library

4. Then you get the result as parameter, you can just set it to the filter = “the Result” (if you use Final XML Filter as the Output) or you parse the GUID if you use the comma or | delimited concept, or if you use EntityCollection then you need to parse it back.

5. See the result

Basically, you just need to get this result:

image

Either you just easily using String as output or other method it is up to u.

But the point here is we can use Custom Action for solving complex filtering and remember that we can use impersonation also to get the data you want if it is related to the other entities as well, imagine if we also need to have multiple entities involved then it might be easier if we use Custom Action as we just replace the DLL if there is any other changes using Plugin Registration Tool.

Hope this helps!

Thanks,
Aileen

21 comments:

  1. Very Nice Post Aileen,I have read the method to get the filtered result with a different method by using Javascript + Custom Action. It is really very helpful contact for .MS Dynamic CRM consultant services.

    ReplyDelete
  2. I am filtering the Source Campaign lookup based on Optionset Originating Lead
    Event:-OnChange
    Field:-Originating Lead
    Condition 1:If originating Lead value "Employee- Frank Hooper" then show all campaigns in lookup.
    Condition 2:For all other Originating Lead value it showed specific Campaigns in lookup.
    Problem:- if originating lead is "Employee- Frank Hooper" it search all campaigns that is good and if change originating lead other
    than"Employee- Frank Hooper" it also search well but when i go again to option set value"Employee- Frank Hooper" now it doesn't show any value.
    so what is reason second time it show unexpected behaviour

    ReplyDelete
  3. good article. I like to read this post because I met so many new facts about it actually. Thanks a lot. Lead Capture Software

    ReplyDelete
  4. Hello! Thank you so much for posting this small tutorial. I think it will be useful for many people who are interested in learning ms dynamics features and such tips like how to utilize Custom Action to Help Filtering The Lookup View in CRM Form.

    ReplyDelete
  5. Your post is very useful for all SAP learners. Thanks for providing such a great post...
    SAP FICO Online Training | SAP FSCM Online Training in India

    ReplyDelete
  6. This post is much helpful for us. This is really very massive value to all the readers and it will be the only reason for the post to get popular with great authority.
    IOS Training in Chennai

    ReplyDelete
  7. Thank you for sharing such a nice and interesting blog with us. I have seen that all will say the same thing repeatedly. But in your blog, I had a chance to get some useful and unique information. I would like to suggest your blog in my dude circle.
    SEO Company in Chennai

    ReplyDelete
  8. It's interesting that many of the bloggers to helped clarify a few things for me as well as giving.Most of ideas can be nice content.The people to give them a good shake to get your point and across the command .
    Cat Coaching in Chennai

    ReplyDelete
  9. Thank you for taking the time to provide us with your valuable information. We strive to provide our candidates with excellent care and we take your comments to heart.As always, we appreciate your confidence and trust in us
    Digital Marketing Company in India

    ReplyDelete
  10. wonderful information, I had come to know about your blog from my friend nandu , hyderaba.
    i have read atleast 7 posts of yours by now, and let me tell you, your website gives the
    best and the most interesting information. This is just the kind of information that i had
    been looking for, i'm already your rss reader now and i would regularly watch out for the new posts

    Oracle Fusion HCM Training

    ReplyDelete
  11. Its a wonderful post and very helpful, thanks for all this information. You are including better information regarding this topic in an effective way.Thank you so much

    Personal Installment Loans
    Payday Cash Advance loan
    Title Car loan
    Cash Advance Loan

    ReplyDelete
  12. i really like this blog.And i got more information's from this blog.thanks for sharing!!!!Digital Marketing Company in Chennai

    ReplyDelete
  13. This blog is having the good information. Got a creative work and this is very different one. We have to develop our creativity mind. This blog helps for this. Thank you for this blog. This is very interesting and useful.

    Self Employment Tax
    Tax Preparation Services
    Tax Accountant
    Tax Consultant
    Tax Advisor

    ReplyDelete
  14. Microsoft Dynamics CRM Implementation | USA | UK | CANADA| INDIA
    Microsoft Dynamics CRM is a platform created to provide organizations with tools to sell smarter, sell efficiently and productively, and heed everywhere. The solution allows a difference of features including social acumen, business knowledge, and fertility with One Microsoft solutions. Customers can prefer how Microsoft Dynamics CRM is used in a way that fits their business: in the cloud, on-premises, or with a cross combination.

    The customer can still obtain the method even when offline.
    Strong integration with Microsoft products.
    Many dashboards.
    Integrated marketing and self-regulation tools.
    Broad integration with third-party apps and methods.
    https://www.aryvartcrm.com/microsoft-dynamics-crm/

    ReplyDelete
  15. wonderful post and very helpful, thanks for all this information. You are including better information regarding this topic in an effective way.Thank you so much
    Online Tax Services
    Tax Professional
    Online Tax Preparation
    Tax Advisor


    ReplyDelete
  16. It's a wonderful post and very helpful, thanks for all this information. You are including better information regarding this topic in an effective way.Thank you so much.

    Allergy Medicines
    Ayurvedic Medicine For Immunity
    Hyperpigmentation cream
    Viral Fever Medicines

    ReplyDelete

My Name is..