Hello,
I am trying to find a way when the user clicks on the entity from the Site Map it should navigate him automatically to a specific form record ID.
For example in the field service module, we have the field service settings that take you directly to a specific form with record id as below:
While adding the entity to the Site Map I know that we have the option URL and we can hardcode the App ID, Form ID, and Record ID but that won't work because the App ID and the Form ID might be changing from an environment to another when we deploy the solution.
powerusers.microsoft.com/.../859782
Kindly note that custom pages won't work with us, we want to open the model-driven form UI.
What is the best way to achieve the above? Could you provide an example?
Any help is greatly appreciated.
Thank you!
Hello,
I would recommend to use the following approach:
1. Create an Html/JS webresource that will serve as a "redirector".
2. In the code of your webresource write a JavaScript that will query for an AppId (based on the name or something like that). There is no need to do anything with FormId because it stays the same if you use solutions to move customizations between your environment.
3. Having the AppId and FormId you can use Xrm.Navigation.navigateTo to open the right form.
4. Embed this Html/Js webresource to your SiteMap.
Good luck.
Hello @AhmedSalih ,
Thank you for your reply.
How can add the JS onClick of the entity from the sitemap? OnLoad event will only work inside the form.
The main goal is whenever we click on the table from the sitemap it should automatically navigate us to that page.
Awaiting your response.
Best regards,
Julien
Hello, @Julien2, I would use Environment Variables and use RetrieveEnvironmentVariableValue Function in a Web Resource that will be triggered on the OnLoad event.
Here is an example:
https://mytrial365.com/2021/03/15/get-environment-variables-value-using-javascript/
WarrenBelz
146,731
Most Valuable Professional
RandyHayes
76,287
Super User 2024 Season 1
Pstork1
66,077
Most Valuable Professional