My Photo

Microsoft Dynamics 365

Official Blog for Microsoft Dynamics Functional and Technical Solutions....
Browsing Category " in ms crm "

Set only contact entity or only Account entity customer field lookup in case / Opportunity for ms crm

Set potential customer look up field to only for contact entity record.

By default out of the box functionality gave a pop up with two entity type -contact & account for customer lookup field ,
if your requirement is to set only contact or only account as entity it can be done using javascript as given below ,

Both Contact and Account are viewed by Default 

Get Form Type And Save Modes using JavaScript in mscrm 2011 , mscrm 2013 , mscrm 2015


getSaveMode() : Its Return a value telling what was the save event of ms crm entity record ( like is it due to deactivation of form , manual save or save and close etc) below is the full list of events .

// Code
execObj.getEventArgs().getSaveMode();


Event ModeValue
Save1
Save and Close2
Deactivate5
Reactivate6
Send (Email)7
Disqualify (Lead)15
Qualify (Lead)16
Assign (user or team owned entities)47
Save as Completed (Activities)58
Save and New59
AutoSave70
getFormType() :  Its Return a value Telling about form type of ms crm entity record ( Update , or create etc) , below is the full list of events.

Set Field Read Only Using JavaScript In MSCRM ( Lock Field in MS CRM )



Hey Below is the Code To Set a Attribute / field on form Read only (Lock) using JavaScript in MS CRM .


// Get Control of entity
Xrm.Page.ui.controls.get("new_companyreference");
// Now set the property to lock the field
ToBeReadOnlyControl.setDisabled(true);


Note : Xrm.Page.ui.controls.get("new_companyreference"); by this we get full UI controls of the attribute / field by which we can set or get any ui property of that field .


SOURCE : JUST2CODE.IN Subscribe to our YouTube channel : https://www.youtube.com/user/TheRussell2012

GET AND SET VALUES FROM ONE ENTITY TO ANOTHER ENTITY USING PLUGIN IN MSCRM 2011 , 2013

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Runtime.Serialization;
using Microsoft.Xrm.Sdk;
using Microsoft.Xrm.Sdk.Query;

namespace elite_employee
{
    public class Class1 : IPlugin
    {
        public void Execute(IServiceProvider serviceProvider)
        {
            IPluginExecutionContext context = (IPluginExecutionContext)
             serviceProvider.GetService(typeof(IPluginExecutionContext));
            IOrganizationServiceFactory serviceFactory =