Showing posts with label C#. Show all posts
Showing posts with label C#. Show all posts

Saturday, May 9, 2026

How to Show Notification in Model Driven App using C#

 Introduction:


In this blog, we will see how to show Notification in Model Driven App Using C#


Implementation steps:

For your function apps or console application once after the Organization service gets configured, call the below code to achieve the same


private static void SendInAppNotification(string subject, string description)
{
    Entity entity = new Entity("appnotification");
    entity.Attributes.Add("title", subject);
    entity.Attributes.Add("ownerid", new EntityReference("systemuser", USERGUID));
    entity.Attributes.Add("body", description);
    Service.Create(entity);
}

Conclusion:

Based on the above code we can easily achieve Notifications in Model Driven App

Thursday, August 1, 2024

How to Set Required and Optional attendees using MSCRM or Dataverse Plugins

Introduction:

In this blog we will see how to Set Required and Optional attendees using MSCRM or Dataverse Plugins

Implementation Steps:


1. Create a Project in VS

2. Create a .cs file and name it as appointment.cs

public class Appointment
{  
    public void Execute(IServiceProvider serviceprovider)
    {

        IPluginExecutionContext executionContext = (IPluginExecutionContext)iServiceProvider.GetService(typeof(IPluginExecutionContext));

        IOrganizationServiceFactory serviceFactory = (IOrganizationServiceFactory)iServiceProvider.GetService(typeof(IOrganizationServiceFactory));

        IOrganizationService service = serviceFactory.CreateOrganizationService(executionContext.UserId); 
     }
}


4. if the entity is appointment then do the following code

Entity entity = (Entity)executionContext.InputParameters["Target"];


5. Create a Party list

ActivityParty party = new ActivityParty
{
PartyId = new EntityReference("systemuser", new Guid("GUID"))
};


6. Update the Required and Optional attendees 

Entity appointment = new Appointment
{
Subject = "Sample Appointment",
RequiredAttendees = new ActivityParty[] { party },
OptionalAttendees = new ActivityParty[] { party }
};



7. Now Update the Appointment

service.Update(appointment);


That's it :)

How to hide Navigation and Command Bar's in Model Driven App ?

  Introduction: In this Blog we will see how to hide Navigation and Command Bar in Model Driven App. Implementation Steps: Navigate to  http...