Updating a record from JavaScript using the Xrm.WebAPi in Dynamics 365 V9

Summary : Updating a record from JavaScript using the Xrm.WebAPi in Dynamics 365 V9


Now let’s update a record
Syntax: Xrm.WebApi.updateRecord(entityLogicalName, id, data).then(successCallback, errorCallback);

***Code starts here***

var entityData =
                {
                    "subject": “leadFromWebApi_Updated”,
                    "lastname": “RamLaxman”
                }

Xrm.WebApi.createRecord("lead", id, entityData).then(
                    function success(result)
                    {
                        alert("Record updated successfully ");                      
                    },
                    function (error)
                    {
                        console.log(error.message);       
                    });
***Code ends here***

Creating a record from JavaScript using the Xrm.WebAPi in Dynamics 365 V9

Create Record:

Let’s see how we can create a “Lead” record using newly introduced
 Web API calls in Dynamics 365 V9
Xrm.WebApi.createRecord(“entityLogicalName”,data).then(successCallback,errorCallback);
// This line of code is required if you are creating from HTML webresource.

<script src="ClientGlobalContext.js.aspx" type="text/javascript"></script>

var entityData =


                {
                    "subject": “leadFromWebApi”,
                    "lastname": “Ram”
                }


Xrm.WebApi.createRecord("lead", entityData).then(
                    function success(result)
                    {
                        alert("Record Created successfully and Id is: " + result.id);
                        console.log("Account created with ID: " + result.id);
                    },
                    function (error)
                    {
                        console.log(error.message);       
                    });



How to Download Plugin Registration Tool from nuget Using Power Shell Script in Dynamics 365 Version 9.x

Summary :  How to Download Plugin Registration Tool Using Power Shell Script in Dynamics 365 Version 9.x 

1. Start menu, Search for Windows Powershell and open.
2. Navigate to the folder you want to install the tools to. For example (d:/Tools)
3. Execute the following Script

$sourceNugetExe = "https://dist.nuget.org/win-x86-commandline/latest/nuget.exe"
$targetNugetExe = ".\nuget.exe"
Remove-Item .\Tools -Force -Recurse -ErrorAction Ignore
Invoke-WebRequest $sourceNugetExe -OutFile $targetNugetExe
Set-Alias nuget $targetNugetExe -Scope Global -Verbose

##
##Download Plugin Registration Tool
##
./nuget install Microsoft.CrmSdk.XrmTooling.PluginRegistrationTool -O .\Tools
md .\Tools\PluginRegistration
$prtFolder = Get-ChildItem ./Tools | Where-Object {$_.Name -match 'Microsoft.CrmSdk.XrmTooling.PluginRegistrationTool.'}
move .\Tools\$prtFolder\tools\*.* .\Tools\PluginRegistration
Remove-Item .\Tools\$prtFolder -Force -Recurse




Virtual Entity feature in Dynamics 365 V9.x Part 2




Create a Virtual Entity Data Source
Login to Dynamics 365 click Settings -> Administration and then Virtual Entity Data Source to open the Data Sources grid.



In the Data Sources grid click on New, to open the Select Data Provider window



In Select Data Provider window select OData v4 Data Provider and then click OK to open the New OData v4 Data Source dialog





Create a Virtual Entity

Now, let’s create a virtual entity to bring data from the OData Source. Click Settings -> Administration -> Customize the System


Create a virtual entity like custom entity and select the Virtual Entity checkbox.



RPA: Blue Prism Training Course Content




                                              RPA: Blue Prism Training Content

Introduction to Blue Prism
  • Blue Prism’s Robotic Automation
Process Studio
  • Running a Process
  • Basic Skills
  • Process Validation
  • Decision Stage
  • Calculation Stage
  • Data Items
  • Review
Process Flow
  • Circular Path
  • Controlling Play
  • Set Next Stage
  • Break Points
  • Collections and Loops
  • Layers Of Logic
  • Pages For Organization
  • Review 
Inputs and Outputs
  • Input Parameters
  • Stepping and Pages
  • Data Item Visibility
  • Data Types
  • Output Parameters
  • Startup Parameters
  • Control room
  • Process Outputs
  • Review
Business Objects
  • Object Studio
  • Business Objects
  • Action Stage
  • Inputs and Outputs
  • The Process Layer
  • Review 
Object Studio
  • Creating a Business Object
  • Application Modeller
  • Spying Elements
  • Attributes
  • Attribute Selection
  • Launch
  • Wait
  • Timeouts
  • Terminate
  • Write
  • Press
  • Attach and Detach
  • Read
  • Actions
  • Action Inputs and Outputs
  • Data items as inputs
  • Review
Overview of Error and Case Management
Error Management
  • Exception Handling
  • Recover and Resume
  • Throwing Exceptions
  • Preserving the current exception
  • Exception Bubbling, Blocks and Exception handling in practice
  • Review
Case Management
  • Work Queues
  • Queue items
  • Work queue configuration’
  • Defer
  • Attempts
  • Pause and Resume
  • Filters
  • Reports
  • Review 
Additional Features
  • Collection Actions
  • Choice stage
  • Logging
  • Log viewer
  • System Manager
  • Process Groping
  • Export and import
  • Release Manager –Packages and Releases
Consolidation Exercise
  • Order system process
  • Consolidation exercise checklist
  • Submitting your completed solution
Advanced Features
  • Undefined collections
  • Data item initialization
  • Data item Exposure
  • Casting
  • Code stage
  • Run mode
  • Initialize and cleanup
  • Attribute Match Types
  • Dynamic Attributes
  • Active Accessibility
  • Application manager mode
  • Global clicks and keys
  • Credentials
  • Environment Locking
  • Command Line
  • Resource PC
Further Application Types
  • Mainframe Applications
  • Java Applications
  • Match index and Match Reverse
  • Surface Automation



Virtual Entity feature Pros and Cons in Dynamics 365 V9.x.


Summary : Virtual Entity feature in Dynamics 365 V9.x.


Virtual Entity helps us to get data from External network without any client-side and server-side approaches. It helps admins and system customizers in administration and configuration.
Virtual Entity looks in D365 to user as a regular entity but contains data that is sourced from external data system

What is Virtual Entity?
Virtual Entity is an Entity in D365 platform metadata without the associated physical tables for entity instances created in D365 database.
How it works?
During runtime, when an entity instance is required, its state dynamically retrieved from the associated external data source. Each virtual entity is associated with a “virtual entity data provider” from an associated virtual entity data system.
Advantages:
  1. End users can be able to view the records created by Virtual Entities in fields, grids and search results.
  2. System Customizers can create these virtual entities without writing any code.

Limitations:
a           1.  Data retrieved by Virtual Entity is “Read-Only”.
b           2.  It must be possible to model the External data as a Dynamics 365 entity.
*      All the entities in external data source must have an associated GUID primary key.
*      All entity properties must be represented as Dynamics 365 attributes.
*      An attribute on a virtual entity cannot be calculated or rollup. If any, it must be done on the external side, possibly within or directed by the data provider.
c           3. Only Organization-owned entities are supported.
d           4. Field level security is not supported.
e           5. Auditing of data is not supported.
f.        Once created, we cannot change a virtual entity to non-virtual entity (standard entity) and in the same way we cannot convert non-virtual entities to virtual entities once created.
following data PROVIDERS SHIP with Dynamics 365 (online), V9.0
1         An OData v4 provider is included with the service and installed by default.
  1. An Azure Cosmos DB (formerly Microsoft Document DB) provider is available from AppSource.

Xrm.Utility JavaScript methods in Dynamics 365 Version 9.x

Xrm.Utility: 

Method
Description
closeProgressIndicator
Closes a progress dialog box.
Xrm.Utility.closeProgressIndicator()
getAllowedStatusTransitions
Returns the valid state transitions for the specified entity type and state code.
Xrm.Utility.getAllowedStatusTransitions(entityName,stateCode).then(successCallback, errorCallback)
getEntityMetadata
Returns the entity metadata for the specified entity.
Xrm.Utility.getEntityMetadata(entityName,attributes).then(successCallback, errorCallback)
getGlobalContext
Gets the global context.
getLearningPathAttributeName
Returns the name of the DOM attribute expected by the Learning Path (guided help) Content Designer for identifying UI controls in the Dynamics 365 Customer Engagement forms.
Xrm.Utility.getLearningPathAttributeName()
getResourceString
Returns the localized string for a given key associated with the specified web resource.
Xrm.Utility.getResourceString(webResourceName,key)
invokeProcessAction
Invokes an action based on the specified parameters.
Xrm.Utility.invokeProcessAction(name,parameters).then(successCallback, errorCallback)
lookupObjects
Opens a lookup control to select one or more items.
Xrm.Utility.lookupObjects(lookupOptions).then(successCallback, cancelCallback)
lookupOptions: Object. Defines the options for opening the lookup dialog. Has the following properties:
Property Name
Type
Required
Description
allowMultiSelect
Boolean
No
Indicates whether the lookup allows more than one item to be selected.
defaultEntityType
String
No
The default entity type to use.
defaultViewId
String
No
The default view to use.
entityTypes
Array
No
The entity types to display.
showBarcodeScanner
Boolean
No
Indicates whether the lookup control should show the barcode scanner in mobile clients.
viewIds
Array
No
The views to be available in the view picker. Only system views are supported.
successCallback
Function
Yes
A function to call when the lookup control is invoked. An object with the following properties is passed:
entityType: String. Entity type of the record selected in the lookup control.
id: String. ID of the record selected in the lookup control.
name: String. Name of the record selected in the lookup control.
errorCallback
Function
Yes
A function to call when you cancel the lookup control or the operation fails.
refreshParentGrid
Refreshes the parent grid containing the specified record.
Xrm.Utility.refreshParentGrid(lookupOptions)
lookupOptions: An object with the following properties to specify the record:+
Property Name
Type
Required
Description
entityType
String
Yes
Entity type of the record.
id
String
Yes
ID of the record.
name
String
No
Name of the record.
showProgressIndicator
Displays a progress dialog with the specified message.
Xrm.Utility.showProgressIndicator(message)

Deprecated methods

The following table lists the new methods you should use instead of the deprecated methods in the Xrm.Utility namespace.
These methods were deprecated in Dynamics 365 (online), version 9.0.

Deprecated Method
New method to be used
alertDialog
Xrm.Navigation.openAlertDialog
confirmDialog
Xrm.Navigation.openConfirmDialog
getBarcodeValue
Xrm.Device.getBarcodeValue
getCurrentPosition
Xrm.Device.getCurrentPosition
openEntityForm
Xrm.Navigation.openForm
openQuickCreate
Xrm.Navigation.openForm
openWebResource
Xrm.Navigation.openWebResource

Popular Posts