简体   繁体   English

来自Silverlight的MSCRM 2016 Turbo形式的Javascript函数调用

[英]Javascript function call from silverlight in MSCRM 2016 turbo forms

I am trying to call a javascript function "myFunction" which is in the namespace "quote.Controller" which is loaded on Quote form. 我正在尝试调用一个JavaScript函数“ myFunction”,该函数在“报价”表单中加载的命名空间“ quote.Controller”中。 I am trying to create an instance as below 我正在尝试如下创建一个实例

ScriptObject result=HtmlPage.Window.CreateInstance("quote.Controller");

Above line works fine when I set "Use legacy form rendering" to Yes in MSCRM 2016. But if i set "Use legacy form rendering" to No, I am getting an exception "Unhandled Error in Silverlight Application Type 'quote.Controller' does not exist.". 当我在MSCRM 2016中将“使用旧版表单呈现”设置为“是”时,上述行工作正常。但是,如果将“使用旧版表单呈现”设置为“否”,我将收到异常“ Silverlight应用程序类型'quote.Controller'中的未处理错误”不存在。”。 It might be because Silverlight control is unable to find the javascript file on the form. 可能是因为Silverlight控件无法在表单上找到javascript文件。 I tried the below code 我尝试了以下代码

var parent = HtmlPage.Window.GetProperty("parent") as HtmlWindow;
if (parent != null)
{
     parent.CreateInstance("quote.Controller");
}

No luck with the above code block. 上面的代码块没有运气。 Any suggestion on what could be the issue? 关于可能的问题有什么建议吗?

You have to load the file that contains your js function. 您必须加载包含js函数的文件。

I mean you have to add the library that contains your function via the form properties. 我的意思是您必须通过表单属性添加包含函数的库。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM