Notifications
Announcements
No record found.
I am looking at using the JavaScript navigateto to open up a form of another entity and associate that record that ultimately gets created with the record they triggered the create from. It is an M:M relationship type
I have had a look at the Documentation https://docs.microsoft.com/en-us/powerapps/developer/model-driven-apps/clientapi/reference/xrm-navigation/navigateto but just wondering if someone has an example of using the optional relationship parameter?
Hi,
Please check below article which has sample code given in comments section on the blog.
www.inogic.com/.../
var pageInput = {}; var accountId = Xrm.Page.data.entity.getId(); accountId = accountId.replace(“{“, “”).replace(“}”, “”); pageInput.createFromEntity = { entityType : “account”, id : accountId , name : Xrm.Page.getAttribute(“name”).getValue() } pageInput.relationship = { attributeName: “parentcustomerid”, namme: “contact_customer_accounts”, relationshipType: 1, roleType: 1 } pageInput.pageType = “entityrecord”; pageInput[“entityName”] = “contact”; // Set default values for the Contact form var formParameters = {}; formParameters[“firstname”] = “Sample”; formParameters[“lastname”] = “Contact new “; formParameters[“emailaddress1”] = “contact@adventure-works.com”; formParameters[“jobtitle”] = “Sr. Marketing Manager”; formParameters[“donotemail”] = “1”; formParameters[“description”] = “Default values for this record were set programmatically.”; pageInput.data = formParameters; // Open the form. Xrm.Navigation.navigateTo(pageInput).then( function (success) { console.log(success); }, function (error) { console.log(error); });
Hi Partner,
"Relationship" attribute is used to set lookup field on entity form, it is available only in "Entity Form" not "Entity List".
And as you said your entities have N:N relationship, so you need to set "relationship type" to "1".
And in Kumar's link, you could refer to the comments after the article.
Best Regards,
Leo
Thanks guys I will check that out. I did do some googling prior to asking but didn’t think to check the comments on pages!
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 70 Super User 2025 Season 2
Gerardo Rentería Ga... 33 Most Valuable Professional
Daniyal Khaleel 32 Most Valuable Professional