[Sample Code] Set Lookup View dynamically in Dynamics 365 or Power Apps Model driven app form

Here is a sample code you can use to dynamically set the lookup view conditionally in Dynamics 365 or Model driven power apps. Remember to pass execution context from FORM to JS. Hope this helps.