My response was crafted with AI assistance, tailored to provide detailed and actionable guidance for your query.
To create a Power Pages (formerly known as Power Apps Portals) form that allows anonymous users to submit a Case and an associated Contact, you can achieve this using a combination of basic configuration and JavaScript customization.
Since the user is anonymous, you need to allow access for the portal to create Contacts and Cases.
Enable Table Permissions for Cases and Contacts:
Assign Table Permissions to Forms:
Create a basic form in the Power Pages portal to collect the required data.
In Dynamics 365 or Power Apps:
Enable Anonymous Submission:
Create Metadata for Default Case Type:
Since Contact is required for a Case, you’ll need to programmatically create a Contact and associate it with the Case. To do this:
Add JavaScript to Automate Contact Creation:
Steps:
Here’s a sample script for this:
javascript Copy code
$(document).ready(function () { $("#SubmitButton").click(function (e) { e.preventDefault(); // Gather contact details from the form fields var firstName = $("#firstname").val(); var lastName = $("#lastname").val(); var email = $("#email").val(); // Create the Contact record via Web API $.ajax({ url: "/_api/contacts", type: "POST", contentType: "application/json", data: JSON.stringify({ firstname: firstName, lastname: lastName, emailaddress1: email }), success: function (contactResponse) { // Contact successfully created, now create the Case var contactId = contactResponse.contactid; // Assuming contactid is returned var description = $("#description").val(); // Create the Case record via Web API $.ajax({ url: "/_api/incidents", type: "POST", contentType: "application/json", data: JSON.stringify({ title: "Question", description: description, "customerid_contact@odata.bind": `/contacts(${contactId})` }), success: function () { alert("Case created successfully!"); window.location.reload(); // Reload or redirect to confirmation page }, error: function (err) { alert("Error creating Case: " + err.message); } }); }, error: function (err) { alert("Error creating Contact: " + err.message); } }); }); });
#firstname
#lastname
#email
To set default values like Case Type = "Question":
"Question"
Enable File Attachments:
Annotation
Redirect After Submission:
Error Handling and Validation:
This approach uses a combination of Power Pages OOTB features (for table permissions, entity forms, and metadata) and JavaScript for custom logic to handle the Contact and Case creation.
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 Abhilash Warrier as our Community Spotlight honoree for…
These are the community rock stars!
Stay up to date on forum activity by subscribing.
MVP-Daniyal Khaleel 70
Tom_Gioielli 22 Super User 2025 Season 2
mk1329 16