使用React构建CRM Web资源 [英] Building CRM Web Resources with React

查看:95
本文介绍了使用React构建CRM Web资源的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是新的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") ); 
});


推荐答案


  1. 获取上下文:


    • 在<$ 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);

  1. Get context:
    • Add ClientGlobalContext.js.aspx in the in the index.html: <script type="text/javascript" src="ClientGlobalContext.js.aspx">. ClientGlobalContext is the offical hook to Dynamics form context.
    • In the React componentDidMount life cycle, Add const 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);

智能:(如果您使用的是 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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆