Hello I want TO initialize a New Entity Instance From Another Entity Instance in Microsoft Dynamics CRM 2015 Using Using Jscript InitializeFromRequest
The error here:
if (typeof (SDK) == "undefined")
{SDK = {__namespace: true}; }
It says that SDK is not defined.
I added the librearias of SDK.SOAP.JS And JQUERYV1.12.4
In our scenario we include sdk rest and sdk soap in the same file
if (typeof (SDK) == "undefined")
{SDK = {__namespace: true}; }
Then give us exception sdk not defined
We may solve this by making separate files for sdk rest and sdk soap then include them in our project.
Related
I'm trying to use WebView2 in ASP.Net Web API Web App (VS2019).
The WebView2 package is installed using NuGet Package Manager.
I see the runtimes subfolder with all the needed runtimes in my web app's \bin folder.
But I'm getting a run-time error message:
WebView2 creation failed with exception = System.DllNotFoundException: Unable to load DLL 'WebView2Loader.dll':
The specified module could not be found. (Exception from HRESULT: 0x8007007E)
at Microsoft.Web.WebView2.Core.CoreWebView2Environment.CreateCoreWebView2EnvironmentWithOptions(String browserExecutableFolder, String userDataFolder, ICoreWebView2EnvironmentOptions options, ICoreWebView2CreateCoreWebView2EnvironmentCompletedHandler environment_created_handler)
at Microsoft.Web.WebView2.Core.CoreWebView2Environment.<CreateAsync>d__3.MoveNext()
The run-time error happens at the last line of the following code:
var webView = new Microsoft.Web.WebView2.WinForms.WebView2();
...
var ecwTask = webView.EnsureCoreWebView2Async(null);
AFAICG I should try to create a custom CoreWebView2Environment and pass it as parameter to webView.EnsureCoreWebView2Async(...).
Any ideas how it can be done or how to solve the subject issue differently?
I have solved the subject issue ("Unable to load DLL 'WebView2Loader.dll'") with the following code:
var udf = ... // Temp Folder - should be new for every new instance of WebView2 control
var fixedDriverFolder = null;
var envTask = await Microsoft.Web.WebView2.Core.CoreWebView2Environment
.CreateAsync(browserExecutableFolder: fixedDriverFolder, userDataFolder: udf);
var ecwTask = br.EnsureCoreWebView2Async(envTask);
while (ecwTask.IsCompleted == false)
{
Application.DoEvents();
};
Now I can use WebView2 Control in .NET Framework console applications.
I still can't use the WebView2 control in ASP.NET Web Api Web App - another runtime error appears.
In my code below I am attempting to create a producer client that i can use to send events to a Event Hub. I am getting a System.PlatformNotSupportedException: 'The WebSocket protocol is not supported on this platform. error Any guidance on how i can resolve this would be much appreciated. FYI my platform is Windows 7, although this program is intended to run on a windows 2008 server or later.
var producerOptions = new EventHubProducerClientOptions
{
ConnectionOptions = new EventHubConnectionOptions
{
TransportType = EventHubsTransportType.AmqpWebSockets,
},
RetryOptions = new EventHubsRetryOptions
{
MaximumRetries = 5,
TryTimeout = TimeSpan.FromMinutes(1)
}
};
var producer = new EventHubProducerClient(connectionString, eventHubName, producerOptions);
//here is where the error occurs. which is inside a try - catch block
var eventBatch = await producer.CreateBatchAsync();
......
The Event Hubs client library relies on the underlying framework for its transport communication. In this case, it sounds as if you're using the full .NET Framework on Windows 7, where web sockets is not supported.
So long as your aren't using a UWP application, changing the target framework to .NET Core and using the netstandard2.0 target from the client library may work. (see: this PR)
More detail can be found in the accepted answer for this question, which also contains some advice for third party packages that may work as a polyfill.
I am doing a mobile app using ADAL for authentication. I am using VS 2017 Xamarmin.Forms and trageting .Net standard 2.0 for the project. But got the error for the following code. I did some research than found out that PlatformParameters constructor is not supported by .NetCore since .NetCore does not support UI yet. But .Net Standard should support. Is there any solution or workaround? Thank you in advance.
authResult = await authContext.AcquireTokenAsync(resource, clientID, new Uri(clientReturnUri), new PlatformParameters(PromptBehavior.Auto, this));
I am using crm 2016 and I need to clone a record using plugin, after googling I found out that I need to use Microsoft.Xrm.Client that hold the clone() function - which is not in 2016 SDK because of MS reorganization.This lib is in 2015 SDK.
My questions are :
1. If I'll take that lib from CRM 2015 and use it in 2016 will it be supported?
2. If it's not supported what are my options to clone a record in server side?
The method Clone() in the Microsoft.Xrm.Client only creates a copy of the Entity object in memory. It does not create a copy in the database of CRM. When you need to create a copy in the database just instantiate a new Entity object and pass it to the Create() method of the IOrganizationService interface.
When you really need a deep clone as described on MSDN you could consider writing one yourself. In most scenarios you will only need to copy the objects in the attributes collection. Of those objects only the reference types EntityReference, OptionSetValue and Money wiil need your special attention.
I would not advise to use deprecated libraries.
We use the following helper method to clone an entity - this is an updated version from the original which correctly clones the reference types, and excludes the system attributes
public static Entity CloneEntitySandbox(Entity entityToClone)
{
var newEntity = new Entity(entityToClone.LogicalName);
var systemAttributes = new List<string>();
systemAttributes.Add("createdon");
systemAttributes.Add("createdby");
systemAttributes.Add("modifiedon");
systemAttributes.Add("modifiedby");
systemAttributes.Add("owninguser");
systemAttributes.Add("owningbusinessunit");
foreach (var attribute in entityToClone.Attributes
.Where(x => x.Key != entityToClone.LogicalName + "id")
.Where(x => !systemAttributes.Contains(x.Key)))
{
switch (attribute.Value.GetType().Name)
{
case "Money":
var m = attribute.Value as Money;
newEntity[attribute.Key] = new Money(m.Value);
break;
case "EntityReference":
var er = attribute.Value as EntityReference;
newEntity[attribute.Key] = new EntityReference(er.LogicalName, er.Id);
break;
case "OptionSetValue":
var os = attribute.Value as OptionSetValue;
newEntity[attribute.Key] = new OptionSetValue(os.Value);
break;
default:
newEntity[attribute.Key] = attribute.Value;
break;
}
}
return newEntity;
}
Note that this does not perform the save to create the cloned entity in the CRM database, that's up to you.
Microsoft announcement says:
We also removed Microsoft.Xrm.Client from the CRM 2016 (8.x) SDK client because it was not compliant with the OAuth changes, and replaced it with Microsoft.Xrm.Tooling.Connector. You can use the current Microsoft Dynamics 365 Software Development Kit (SDK) to access Microsoft Dynamics CRM back to version 6.x for both auth and messaging.
Dynamics 365 SDK Backwards Compatibility
You can still use Microsoft.Xrm.Client.dll in your project from older SDK, this maybe supported for a while.
But I would recommend to go with custom Action, taking parent record as EntityReference Input parameter, Retrieve the parent record data + needed related entities & manually create (clone) child record + related entities records in Action.
You can Execute/invoke this Action from client/server side, wherever you want.
I opened an existing ASP.NET MVC3 project that formerly worked just fine in a newly built machine with Visual Studio 2012 installed.
I'm now getting null exceptions in the following code. After a User logs in, the following code is then executed to perform page fragment-level access.
The null exception is thrown on the WebViewPage.User object. However, when in debug mode, I can actually inspect a real instance of the object (see image below)
public static class WebViewPageExtensions
{
public static bool HasAccess(this WebViewPage pg)
{
if (pg == null) throw new ArgumentNullException("WebViewPage is null");
if (pg.User == null) throw new ArgumentNullException("WebViewPage User is null");
return pg.User.IsInRole(User.ACCESS_LEVEL_A) || pg.User.IsInRole(User.ACCESS_LEVEL_B);
}
}
Note: this could be something with the way my environment is configured (web.config maybe?), but not really sure where to start. As it is, the code that this is happening on is the same code running in production and the former developer environment.
All the references are still referring to the ASP.NET MVC3 version of the framework running on the .NET 4.0 platform.
EDIT: Here's the callilng code from a Razer view:
#if (this.HasAccess()) {
<div>
HTML here
</div>
}
Any thoughts?
Please read section "Installing ASP.NET MVC 4 breaks ASP.NET MVC 3 RTM applications" from link http://www.asp.net/whitepapers/mvc4-release-notes#_Toc303253815. Follow setps "Required updates" to update your MVC 3 app. If you havent noticed, MVC4 gets installed with VS2012 and this is documented behavior.