Hi Guys,
My goal is open some form of record using Xrm.Navigation.navigateTo method and show an associated view of the Documents entity (Sharepoint locations) at the same time. The form does not have the Documents subgrid but the form has Documents in Related tab (Navigation items). So, I tried to call navigateTo method passing a relationship object in pageInput parameter but it had no effect to display an associated view for Documents.
My parameters:
var pageInput = {
pageType: "entityrecord",
entityName: "vs360_job",
entityId: "cb03f692-686a-e811-814e-480fcff4b171",
relationship: { attributeName: 'regardingobjectid', name: 'vs360_job_SharePointDocumentLocations', navigationPropertyName: 'regardingobjectid_vs360_job', relationshipType: 0, roleType: 1 }
};
var navigationOptions = {
target: 2,
height: {value: 80, unit:"%"},
width: {value: 70, unit:"%"},
position: 1
};
Xrm.Navigation.navigateTo(pageInput, navigationOptions)
Docs:
https://docs.microsoft.com/en-us/powerapps/developer/model-driven-apps/clientapi/reference/xrm-navigation/navigateto
Can anyone have experience with the relationship parameter? Is it possible to implement my wish to display associated view?
Kind regards
I don't think this is achievable (SharePoint Documents cannot be displayed as a subgrid on a form).
What is achievable is to display a Document Tab on your form, as documented (as a preview feature), here:
https://docs.microsoft.com/en-us/powerapps/maker/model-driven-apps/add-documents-tab-entity-main-form
Then as Linn said, you might be able to automatically set focus on that document tab with a form script (but that might be disturbing from a user experience perspective if opening the form always defaults to that tab).
https://docs.microsoft.com/en-us/powerapps/developer/model-driven-apps/clientapi/reference/controls/setfocus
Henry
I think the relationship parameter is not what you think it is. I guess it is not the parameter to focus the specified associated tab of the record that you opened. I have raised an issue in GitHub of the Docs and I will get back to you when I get a response.
https://github.com/MicrosoftDocs/powerapps-docs/issues/1589
I do no think it is possible to implement your requirement to focus and display associated view on load of the form by navigateTo() client API. Please just consider adding the subgrid to the form and focus the tab with the subgrid onLoad() of the page by checking the formParameters passed by the navigateTo() client API. (and hide the tab if the custom formParameters is not found when the record is normally opened by the user)
[/quote]Thank you Linn,
Just I thought that "relationship: (Optional) Object. Define a relationship object to display the related records on the form" parameter description from docs describes my wish to display related tab on a form. It seems it's not possible (sad). I investigated system js files of Dynamics 365 but I found nothing that the relationship parameter handled. Of cause, I will wait for comments in GitHub to find out about this parameter more.
I will try to implement your offered solution
I think the relationship parameter is not what you think it is. I guess it is not the parameter to focus the specified associated tab of the record that you opened. I have raised an issue in GitHub of the Docs and I will get back to you when I get a response.
https://github.com/MicrosoftDocs/powerapps-docs/issues/1589
I do no think it is possible to implement your requirement to focus and display associated view on load of the form by navigateTo() client API. Please just consider adding the subgrid to the form and focus the tab with the subgrid onLoad() of the page by checking the formParameters passed by the navigateTo() client API. (and hide the tab if the custom formParameters is not found when the record is normally opened by the user)
André Arnaud de Cal...
291,965
Super User 2025 Season 1
Martin Dráb
230,836
Most Valuable Professional
nmaenpaa
101,156