
Announcements
Hi,
I want to open a custom page with a record context. The custom page opens but it does not retrieve the record. How can I fix it?
function RunOnSelected(executionContext) {
var formContext = executionContext.getFormContext();
var record = formContext.data.entity.getId();
// Centered Dialog
var pageInput = {
pageType: "custom",
name: "xxx_xxx_xxxx",
entityName: formContext.data.entity.getEntityName(),
recordId: record,
};
var navigationOptions = {
target: 2,
position: 2,
width: { value: 500, unit: "px" },
title: "My Page"
};
Xrm.Navigation.navigateTo(pageInput, navigationOptions)
.then(
function () {
// Called when the dialog closes
}
).catch(
function (error) {
// Handle error
}
);
}I have used the following formula in App "OnStart":
Set(RecordItem,
If(IsBlank(Param("recordId")),
Blank(),
LookUp('My Table', 'Process Id' = GUID(Param("recordId"))))
)
Thanks
The problem you are encountering is because you are trying to pass the record ID to the custom page, but the page is not able to retrieve the record using that ID.
There are a few things you can check to try and resolve this issue:
Verify that the custom page you are trying to open has been properly configured to retrieve the record using the passed ID. You can check that the custom page has a formula similar to the one you provided in the "OnStart" property of your app, which uses the Param("recordId") to retrieve the record.
Make sure that the value you are passing for the "recordId" property in the pageInput variable is the correct format. It should be a string representation of the GUID of the record, not the record object itself.
Verify that the "My Table" Data source, the one you are using to retrieve the record, is correctly configured in your app. Make sure that the data source is correctly referenced and the columns are correctly mapped.
Check if the custom page has the correct permissions to access the data.
Check if the custom page has the correct settings, in case it's set to private.
It might also be helpful to check the browser's console for any error messages that may give more insights on the problem.
If my reply helped you, please give a 👍, & if it solved your issue, please 👍& Accept it as the Solution to help other community members find it more. |