Posts

Showing posts from July, 2018

How to get the Impersonation User Id(systemUserId ) in D365

public Guid getUserId(IOrganizationService service, string userName)         {             Guid systemUserId = Guid.Empty;             try             {                 QueryByAttribute queryByAttribute = new QueryByAttribute("systemuser");                 ColumnSet columns = new ColumnSet("systemuserid");                 queryByAttribute.AddAttributeValue("fullname", userName);                 EntityCollection retrieveUser = service.RetrieveMultiple(queryByAttribute);                 systemUserId = ((Entity)retrieveUser.Entities[0]).Id;             }             catch (FaultException<OrganizationServiceFaul...

Get OptionSet Text from Value and Get Optionset Value from Text in MS CRM using C#

using Microsoft.Xrm.Sdk; using Microsoft.Xrm.Sdk.Messages; using Microsoft.Xrm.Sdk.Metadata; using Microsoft.Xrm.Sdk.Query; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace AkithaCaseQuoteOptionset {     public class CreateQuoteFromCase:IPlugin     {         public void Execute(IServiceProvider serviceProvider)         {             ITracingService trace = (ITracingService)serviceProvider.GetService(typeof(ITracingService));             IPluginExecutionContext context = (IPluginExecutionContext)serviceProvider.GetService(typeof(IPluginExecutionContext));             IOrganizationServiceFactory serviceFactory = (IOrganizationServiceFactory)serviceProvider.GetService(typeof(IOrganizationServiceFactory));             ...