web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Customer experience | Sales, Customer Insights,...
Suggested Answer

Prevent a Main Form from being used to create a new contact

(0) ShareShare
ReportReport
Posted on by 283
I've got a separate app for a department that works with kids. This app has one form to view the kids info and another for parents info.
In this app ONLY kids records would be created, so I don't want a user to accidentally fill in the parents form.
Unfortunately, it seems like D365 defaults to your last used Main Form when you click the New button on the contact ribbon.
Is there any way to make one Main Form the default creation form? Or to not allow a contact to be created with a certain form?
  • Suggested answer
    Charles Abi Khirs Profile Picture
    3,569 on at

    Hello,

    You can force a specific entity form to be opened in javascript.

    Check the following link for more details: docs.microsoft.com/.../openform

  • Suggested answer
    Fubar Profile Picture
    2,761 on at

    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

  • Suggested answer
    Yoshika Suzuki Profile Picture
    Microsoft Employee on at
  • Lucas H Profile Picture
    283 on at

    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?

  • Suggested answer
    Fubar Profile Picture
    2,761 on at

    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.

Helpful resources

Quick Links

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Women in Power Builds Momentum

Expanding mentorship, skilling, and AI innovation

Congratulations to the August Top 10 Community Leaders

These are the community rock stars!

Leaderboard > Customer experience | Sales, Customer Insights, CRM

#1
Syed Aqib Raza Profile Picture

Syed Aqib Raza 95

#2
Daniyal Khaleel Profile Picture

Daniyal Khaleel 83 Most Valuable Professional

#3
11manish Profile Picture

11manish 65 Super User 2026 Season 2

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans