Building CRM Web Resources with React

旧街凉风 提交于 2019-12-22 18:57:08

问题


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.

What will be the best practice in CRM on Building CRM Web Resources Can anyone guide me?

https://github.com/sonomapartners/web-resources-with-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:


  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);
  2. Intellisense: if you are using TypeScript use the d.ts (definition) file: ///<reference path=Xrm.V9.d.ts/>. you can get it here.

  3. Uplaod: WebRersource can't be jsx or tsx type. After you compile your project you should only upload the bundled file (bundle.js).

  4. Debug: If you want to debug your jsx/tsx file, you will need to use fiddler's AutoResponder to use the source map file. Here is an explanation.


来源:https://stackoverflow.com/questions/56622495/building-crm-web-resources-with-react

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!