Skip to main content
Suggested answer

Opening a form which has every contact of a account (relationship)

editSubscribe (0) ShareShare
ReportReport
Posted on by
Hello there,
I am currently trying to open a little window which includes the contacts of a account. I found the navigateTo function, but I do not understand the relationship parameter.
I thought you can open the window using that, but I cant get it running.

Here is a rough picture of my goal, made in Photoshop. I only want the /Zugeordnete Ansicht: Kontakte/ part of the little window.



(Zugeordnete Ansicht: Kontakte -> Assigned View: Contacts, when translated word by word)

That below is my current attempt to open it like in the picture. I tried different entityNames like account, contact and relationship. Both account and contact just sent me to the record or the entitylist, depending on which pageType I specified.
For the attributeName I tried account and contact. 

Now for entityName relationship, when using that, there was an error message saying /The record you are trying to access does not have a form to display. Please contact your administrator for assistance./ 
 
var relationShip = {};
relationShip[/relationshipType/] = 1;
relationShip[/name/] = /contact_customer_accounts/;
relationShip[/attributeName/] = /account/;
relationShip[/roleType/] = 1;
var entityFormOptions = {};
entityFormOptions[/entityName/] = /relationship/;
entityFormOptions[/entityId/] = /295caa62-0000-eb11-80c6-005056900000/;
entityFormOptions[/relationship/] = relationShip;
entityFormOptions[/pageType/] = /entityrecord/;
var navigationOptions = {
    target: 2,
    height: {value: 80, unit:/%/},
    width: {value: 70, unit:/%/},
    position: 1
};
// Open the form.
Xrm.Navigation.navigateTo(entityFormOptions, navigationOptions).then(
    function (success) {
        console.log(success);
    },
    function (error) {
        console.log(error);
    });
Now openForm also has a relationship parameter, but well I didnt understand I either.

If it isnt possible to open a Window/Form like in the picture using openForm or navigateTo, how would you do it? And also, what would the relationship parameter stand for otherwise/what would you use it for?

Thanks for reading, hopefully someone has an answer.