Sometimes in our project, we have requirement to filter lookup based on some conditions and it can be achieved using addCustomView or addCustomFilter function.
To get the result as per expected, you can use Custom Action.
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.
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:
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!
Published at Tue, 06 Sep 2016 07:26:00 +0000