使用React构建CRM Web资源 [英] Building CRM Web Resources with React
问题描述
我是新的Dynamics CRM。我的项目包括表单提交和验证。我打算使用带有Redux前端的React和CRM的服务来构建产品。
I am new Dynamics CRM. My project includes form submissions and validations. I am planning to build a product using a React with Redux frontend and a service from CRM.
在CRM上构建CRM Web资源$ b $的最佳实践是什么? b谁能指导我?
What will be the best practice in CRM on Building CRM Web Resources Can anyone guide me?
https:// github .com / sonomapartners / web-resources-react
import 'babel-polyfill';
import React from 'react';
import ReactDOM from 'react-dom';
import CaseSummary from './components/CaseSummary.jsx';
window.addEventListener('load', function onLoad() {
ReactDOM.render( <CaseSummary />,
document.getElementById("container") );
});
推荐答案
- 获取上下文:
- 在<$ c中的
ClientGlobalContext.js.aspx
中添加$ c> index.html :
< script type = text / javascript src = ClientGlobalContext.js.aspx>
。 ClientGlobalContext 是到Dynamics表单上下文的正式钩子。 - 在React
componentDidMount
生命周期中,添加const上下文= GetGlobalContext();
获取上下文对象。
,如果您使用 OpenWebResource (webResourceName,windowOptions,data),您可以通过以下方式获取数据:JSON.parse(context.getQueryStringParameters()。Data);
- 在<$ c中的
- Get context:
- Add
ClientGlobalContext.js.aspx
in the in theindex.html
:<script type="text/javascript" src="ClientGlobalContext.js.aspx">
. ClientGlobalContext is the offical hook to Dynamics form context. - In the React
componentDidMount
life cycle, Addconst context = GetGlobalContext();
to get the context object. if you send data to the WebResource with the OpenWebResource(webResourceName, windowOptions, data), you can get the data in this way:JSON.parse(context.getQueryStringParameters().Data);
- Add
智能:(如果您使用的是 TypeScript
使用d.ts(定义)文件: /// <参考路径= Xrm.V9.d.ts />
。您可以在此处获得它。
Intellisense: if you are using TypeScript
use the d.ts (definition) file: ///<reference path=Xrm.V9.d.ts/>
. you can get it here.
Uplaod :WebRersource不能为 jsx
或 tsx
类型。编译项目后,您应该只上传捆绑的文件(bundle.js)。
Uplaod: WebRersource can't be jsx
or tsx
type. After you compile your project you should only upload the bundled file (bundle.js).
这篇关于使用React构建CRM Web资源的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!