{Code Tip} Set a Default View on a Lookup Conditionally using JavaScript


This blog post explains how to use JavaScript to set a default view on a lookup field conditionally in a Model Driven App. The requirement is to filter the lookup values of the contact entity on the account entity based on the selected option in the ownership column. The implementation involves using the setDefaultView() method of the lookup control in JavaScript. This method takes a view ID as a parameter and sets it as the default view for the lookup field. The code snippet provided demonstrates how to use this method in the OnChange event handler of the ownership field to dynamically change the default view of the contact lookup field based on the selected option.


Article 14m

Login now to access my digest by 365.Training

Learn how my digest works
Features
  • Articles, blogs, podcasts, training, and videos
  • Quick read TL;DRs for each item
  • Advanced filtering to prioritize what you care about
  • Quick views to isolate what you are looking for right now
  • Save your favorite items
  • Share your favorites
  • Snooze items you want to revisit when you have more time