Skip to main content

Posts

Showing posts with the label Dynamic 365

D365 Calculate unitwise product quantity into Opportunity field using javascript

  function CalculateOpportunityProductQuantity(executionContext) { var formContext = executionContext.getFormContext(); var opportunityRecordId = formContext.data.entity.getId().slice(1, -1); var globalContext = Xrm.Utility.getGlobalContext(); // Retrive unitwise product quantity data var fetchXml = "<fetch mapping='logical' >" + "<entity name= 'opportunity' >"+ "<link-entity name='opportunityproduct' from='opportunityid' to='opportunityid' alias='opportunityprod' >"+ "<attribute name='quantity' />"+ "<filter>"+ "<condition attribute='opportunityid' operator= 'eq' value='" + opportunityRecordId + "' uiname='Will be ordering' uitype='opportunity' />"+ "</filter...

Dynamics 365 Set a Lookup Field Using JavaScript from another lookup selection change

 In my case, I will select a contact from lookup and it will fill the account lookup field. function OnContactChange(executionContext) { var formContext = executionContext.getFormContext(); if (formContext.getAttribute("parentcontactid").getValue() != null) { var CustomerId = formContext.getAttribute("parentcontactid").getValue()[0].id.slice(1, -1); var CustomerName = formContext.getAttribute("parentcontactid").getValue()[0].name; var CustomerType = formContext.getAttribute("parentcontactid").getValue()[0].entityType; // Call contact API Xrm.WebApi.retrieveRecord("contact", CustomerId, "?$select=_parentcustomerid_value").then( function success(contactresult) { // Call Account Xrm.WebApi.retrieveRecord("account", contactresult._parentcustomerid_val...

Dynamic 365 Preview note file attachments

 To preview note attachment i use PCF control. In my PCF control based on entity Id it loads is corresponding note file like : pdf, docs and other into a grid. when i will click on preview then it preview the document. To preview document i use https://www.npmjs.com/package/react-file-viewer  this npm package support Images: png, jpeg, gif, bmp, including 360-degree images pdf csv xslx docx Video: mp4, webm Audio: mp3 Into my PCF control i use : Import: const FileViewer = require('react-file-viewer'); react return view: <div> <FileViewer fileType={this.state.filePreviewType} filePath={this.state.filePreviewPath} /> </div> On preview document click event i pass the id private _previewAttachment = (id: string): void => { debugger; // this._refreshData(); this._props.context.webAPI .retrieveRecord( "annotation", id, "?$select=documentbody,filename,filesiz...

Solution failed to import: Import Solution Failed: CustomControl with name failed to import with error: Webresource content size is too big.

 In Powerapps i was getting error during import my PCF control. 1. Open the cdsproj file and set the SolutionPackageType = Both. It will generate manage and unmanage solution.    <PropertyGroup>     <SolutionPackageType>Both</SolutionPackageType>   </PropertyGroup>   2. Run the build command with release parameter msbuild /p:configuration=Release

Dynamic 365 CRUD Operation with non relational entity from Plugin

By default in to plugin a entity we can access entity and its relational entity. If we want to access a non relational entity we need to use  XrmServiceContext . using System; using System.Collections.Generic; using System.Linq; using System.ServiceModel; using Microsoft.Xrm.Sdk; using Microsoft.Xrm.Sdk.Query; namespace TotalBudget.Plugins { /// <summary> /// In order to generate Early Bounded Class, dont need to pass any credential for Active directoy authentication /// CrmSvcUtil.exe /url:http://yourdonain/XRMServices/2011/Organization.svc /domain:yourdomain /out:"EarlyBoundedEntities.cs" /namespace:TotalBudget.Plugins /servicecontextname:XrmServiceContext /// </summary> public class TotalBudgetCalculation : IPlugin { // Global variable Guid _AccountId; int _currencyTypeId; int _year; decimal _gesumBudget; List<TotalBudgetCurrency> _TotalBudgetCurrencyList ...