目前我正在使用渠道集成框架1.0。我的应用程序已加载到客户服务中心/销售中心内。 当我的应用程序在我的组织内加载时,它会加载 Microsoft.CIFramework JavaScript api。但是Xrm没有加载。我需要从我的应用程序导航活动任务列表。 Xrm.Navigation.navigate 提供此功能。
任何加载 Xrm javascript 文件的 CDN 或方法。 或者 还有其他方法可以解决我的问题吗
您可以在 Dynamics 365 Channel Integration Framework (CIF) 客户端应用程序中使用 Xrm.Navigation 命名空间,并提供一些有关如何使用它的一般指南,如下所示:
导入 Xrm 命名空间: 确保您已在 TypeScript 或 JavaScript 代码中引用了 Xrm 命名空间。您可以使用以下行来执行此操作:
import * as Xrm from 'Xrm';
确保根据您的环境正确加载“Xrm”模块。
导航至表单:
您可以使用
Xrm.Navigation.openForm
方法导航到 Dynamics 365 中的特定表单。此方法接受 Xrm.Navigation.EntityFormOptions 参数。
例如:
const formOptions = {
entityId: '<entity-guid>', // The GUID of the record you want to open
entityName: '<entity-name>', // The logical name of the entity (e.g., "account")
};
Xrm.Navigation.openForm(formOptions);
导航至 URL:
如果您想在 CIF 客户端应用程序中打开外部 URL,可以使用 Xrm.Navigation.openUrl 方法。这是一个例子:
const url = 'https://www.example.com';
const openUrlOptions = {
url: url,
};
Xrm.Navigation.openUrl(openUrlOptions);
警报和确认: 您还可以使用 Xrm.Navigation.openAlertDialog 和 Xrm.Navigation.openConfirmDialog 方法向用户显示警报和确认对话框。例如:
const alertOptions = {
text: 'This is an alert message.',
};
Xrm.Navigation.openAlertDialog(alertOptions);
const confirmOptions = {
text: 'Are you sure you want to proceed?',
};
Xrm.Navigation.openConfirmDialog(confirmOptions).then(result => {
if (result.confirmed) {
// User confirmed
} else {
// User canceled
}
});
这些只是如何在 Microsoft Dynamics 365 CIF 客户端应用程序中使用 Xrm.Navigation 命名空间的几个示例。