Hello,
You can force a specific entity form to be opened in javascript.
Check the following link for more details: docs.microsoft.com/.../openform
For the App, only include the specific form and not multiple forms.
One possible way, create a specific form for the App, in the onload add JavaScript to check the Form Type "formContext.ui.getFormType()" this will tell you if the form is in create, edit, readonly etc mode - codes are at the link following. If 'create' put a Dialog (e.g. openConfirmDialog or openErrorDialog) up and on close of the dialog perform a formContext.ui.close();
docs.microsoft.com/.../getformtype
You can also do things such as check the App being used
docs.microsoft.com/.../getcurrentappname
docs.microsoft.com/.../getcurrentappurl
How about setting a security role on a form?
https://docs.microsoft.com/en-us/dynamics365/customerengagement/on-premises/admin/assign-security-roles-form
LA
Forgive my ignorance, but would this JS be put into a web resource for the Contact entity? Would it slow things down in other apps if it's always checking what app is being used and if it's in a create mode?
I've always been told that JS is a last resort. Is this a safe use of it or should this be avoided?
There are things that you cannot do with business rules etc,
Yes would be in a Web Resource that you added to the Form Properties (not embedded/inserted in the form), and then hooked up to the From on OnLoad to call your JS functon.
Your talking about a few lines of JavaScript in the scheme of things (1,000's of lines already there from Microsoft) generally would not be noticeable to other users.
Under review
Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.
As AI tools become more common, we’re introducing a Responsible AI Use…
We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…
These are the community rock stars!
Stay up to date on forum activity by subscribing.
Tom_Gioielli 179 Super User 2025 Season 2
#ManoVerse 110
Gerardo RenterÃa Ga... 61 Most Valuable Professional