Multiselect people picker using Kendo UI with a large dataset

Requirement- In one of our projects we were working on Kendo UI, Angular and, jQuery where we had WCF service as the middle layer and SQL as database. Here we came across a situation where there were more than 75,000 users in the user table. While implementing kendo multiselect for an additional author on page load, drop down became unresponsive and there was an error message due to the huge size of the dataset. We tried to implement kendo’s default server-side filtering, but we were not able to achieve a remarkable improvement in the performance. Solution- We have customized kendo’s multiselect control as people picker, where the user writes three or more characters in the search box and presses enter. The system will make a service call and lists down the limited n. Function Implementation and Description- We have implemented the below steps in the function- · We are getting below details of the users from service – UserImageUrl UserDisplayName UserEmailAddress UserDepartment UserCountry · Create a kendo multiselect control with the specified id and set its default selected value from the second parameter and data source with the third parameter Function Implementation and Description- We have implemented the below steps in the function- We are getting below details of the users from service UserImageUrl UserDisplayName UserEmailAddress UserDepartment UserCountry Create a kendo multiselect control with the specified id and set its default selected value from the second parameter and data source with the third parameter. · For filtering, we are calling the onFiltering function. This function prevents the default filtering behavior of multiselect and makes the global variable canFilter = true when the length of the text we search exceeds 3. function onFiltering(e) { e.preventDefault(); canFilter = true; } When the user clicks enter, it makes a service request and sets the data source for multiselect. Every time the user selects a value from this multi select we are reading all the previously selected values and passing them in the service call. The service is returning all the matching records + all the records which were previously selected. After getting the data from service, we are updating the data source of multi select. This is the method adopted to create a common generic function in a common js file. So, if you want to implement a multiselect people picker anywhere in the application, you just need to call this function with default values and control id.
Sitecore 9 installation on a local development environment

From the time Sitecore 9 was released, there has been a lot of talk about the method of installation. Installing Sitecore 9 is difficult when compared to installing the previous versions, and in this version, you will be using a lot more Powershell. When I was trying to install Sitecore 9.0 in my system, I had to go through multiple website and videos to learn the method. To simplify this process, I have mentioned the steps to be followed for installation of Sitecore 9.0 on a local development environment. Sitecore Experience Marketing Demystified a. Windows 8.1, 10, Server 2012 R2 b. .NET Framework 4.6.2 c. SQL Server 2016 or greater d. IIS 8.5 or 10 e. Java Runtime Environment (JRE) f. Power Shell 5.1+ g. Web Platform Installer 5.0 h. Web deploy 3.6 i. Solr 6.6.2 j. NSSM Steps 1 1. Gather Files: a. Sitecore License file b. On-Prem XP0 Instance package: Sitecore 9.0.2 rev. 180604(download from here) Step 2 • Create install folder c:/Siteocore/install • Move license file to install folder • Extract ZIP file (Sitecore 9.0.2 rev. 180604) and move below file to install folder 1: Sitecore 9.0.2 rev. 180604 (OnPrem)_single.scwdp.zip 2: Sitecore 9.0.2 rev. 180604 (OnPrem)_xp0xconnect.scwdp.zip 3: Extract XP0 Configuration files 9.0.2 rev. 180604.zip file and move all its json file to install folder • Extract Solr 6.6.2.zip file and move to C:/Sitecore folder • Open PowerShell as administrator and move to C:Sitecoresolr-6.6.2bin directory • Run powershell command: o .Solr start -p 8983 • Open browser with URL http://localhost:8983/Solr and check solr is running properly Step 4 • Set up solr as service o Download from http://nssm.cc o Install to C:/Sitecore folder o Open Command Prompt as admin and navigate to C:Sitecorenssmwin64 o Run PS command: nssm install solr6 Under Application Tab fill values: • Path: C:Sitecoresolr-6.6.2binSolr.cmd • C:Sitecoresolr-6.6.2bin • Argument: start -f -p 8983 Under Details Tab fill values • Name: Solr6 • Description: Start/Stop Solr Service Click Install Service button o Open Service Manager to check Solr6 service is created and then start the service Step 5: Configure SSL for solr: • Download solrssl.ps1 from here • Move solrssl.ps1 file to install folder C:/Sitecore/Install • Edit the solrssl1.ps1 file o Open the file in editor o Navigate to $keytool = (Get-Command ‘keytool.exe’).Source o Set the location of keytool.exe to $keytool = (Get-Command ‘C:Program FilesJavajre1.8.0_191binkeytool.exe’).Source • Open the PowerShelland navigate to C:/Sitecore/Install and run the command .solrssl.ps1 -KeystoreFile C:Sitecoresolr-6.6.2serveretcsolr-ssl.keystore.jks o Open C:Sitecoresolr-6.6.2binsolr.in.cmd in editor and Search for this line and remove REM REM set SOLR_SSL_KEY_STORE=etc/solr-ssl.keystore.jks REM set SOLR_SSL_KEY_STORE_PASSWORD=secret REM set SOLR_SSL_KEY_STORE_TYPE=JKS REM set SOLR_SSL_TRUST_STORE=etc/solr-ssl.keystore.jks o Restart solr service o Now run solr as https https://localhost:8983/solr Step 6 Setup SQL Server User • Create a user with new User and provide Sysadmin server role • Execute below code sp_configure ‘contained database authentication’, 1; GO RECONFIGURE; GO Step 7 Install the SIF Module • Open the Powershell as administrator and run below command Register-PSRepository -Name SitecoreRepo -SourceLocation https://sitecore.myget.org/F/sc-powershell/api/v2 Install-Module SitecoreInstallFramework -RequiredVersion 1.1.0 Install-Module SitecoreFundamentals -RequiredVersion 1.1.0 Import-Module SitecoreFundamentals Import-Module SitecoreInstallFramework Step 8 Run Installation Script • Update the parameter in all the script and then run: o $prefix: name of Sitecore instance o $SqlServer: Sql server name o $SqlAdminUser, $SqlAdminPassword: User created in Step 6 Script 1: #define parameters $prefix = “xp1” $PSScriptRoot = “C:Sitecoreinstall” $XConnectCollectionService = “$prefix.xconnect” $sitecoreSiteName = “$prefix.local” $SolrUrl = “https://localhost:8983/solr” $SolrRoot = “C:Sitecoresolr-6.6.2” $SolrService = “solr6” $SqlServer = “DESKTOP-K34H1RL” $SqlAdminUser = “sc9″ $SqlAdminPassword=”pass@word1” #install client certificate for xconnect $certParams = @{ Path = “$PSScriptRootxconnect-createcert.json” CertificateName = “$prefix.xconnect_client” } Install-SitecoreConfiguration @certParams -Verbose #install solr cores for xdb $solrParams = @{ Path = “$PSScriptRootxconnect-solr.json” SolrUrl = $SolrUrl SolrRoot = $SolrRoot SolrService = $SolrService CorePrefix = $prefix } Install-SitecoreConfiguration @solrParams #install solr cores for sitecore $solrParams = @{ Path = “$PSScriptRootsitecore-solr.json” SolrUrl = $SolrUrl SolrRoot = $SolrRoot SolrService = $SolrService CorePrefix = $prefix } Install-SitecoreConfiguration @solrParams Script 2: #define parameters $prefix = “xp1” $PSScriptRoot = “C:Sitecoreinstall” $XConnectCollectionService = “$prefix.xconnect” $sitecoreSiteName = “$prefix.local” $SolrUrl = “https://localhost:8983/solr” $SolrRoot = “C: Sitecoresolr-6.6.2” $SolrService = “solr6” $SqlServer = “DESKTOP-K34H1RL” $SqlAdminUser = “sc9″ $SqlAdminPassword=”pass@word1” #install client certificate for xconnect $certParams = @{ Path = “$PSScriptRootxconnect-createcert.json” CertificateName = “$prefix.xconnect_client” } Install-SitecoreConfiguration @certParams -Verbose #deploy xconnect instance $xconnectParams = @{ Path = “$PSScriptRootxconnect-xp0.json” Package = “$PSScriptRootSitecore 9.0.2 rev. 180604 (OnPrem)_xp0xconnect.scwdp.zip” LicenseFile = “$PSScriptRootlicense.xml” Sitename = $XConnectCollectionService XConnectCert = $certParams.CertificateName SqlDbPrefix = $prefix SqlServer = $SqlServer SqlAdminUser = $SqlAdminUser SqlAdminPassword = $SqlAdminPassword SolrCorePrefix = $prefix SolrURL = $SolrUrl } Install-SitecoreConfiguration @xconnectParams Script 3: #define parameters $prefix = “xp1” $PSScriptRoot = “C:Sitecoreinstall” $XConnectCollectionService = “$prefix.xconnect” $sitecoreSiteName = “$prefix.local” $SolrUrl = “https://localhost:8983/solr” $SolrRoot = “C: Sitecoresolr-6.6.2” $SolrService = “solr6” $SqlServer = “DESKTOP-K34H1RL” $SqlAdminUser = “sc9″ $SqlAdminPassword=”pass@word1” #install client certificate for xconnect $certParams = @{ Path = “$PSScriptRootxconnect-createcert.json” CertificateName = “$prefix.xconnect_client” } Install-SitecoreConfiguration @certParams -Verbose #install sitecore instance $xconnectHostName = “$prefix.xconnect” $sitecoreParams = @{ Path = “$PSScriptRootsitecore-XP0.json” Package = “$PSScriptRoot Sitecore 9.0.2 rev. 180604 (OnPrem)_single.scwdp.zip” LicenseFile = “$PSScriptRootlicense.xml” SqlDbPrefix = $prefix SqlServer = $SqlServer SqlAdminUser = $SqlAdminUser SqlAdminPassword = $SqlAdminPassword SolrCorePrefix = $prefix SolrUrl = $SolrUrl XConnectCert = $certParams.CertificateName Sitename = $sitecoreSiteName XConnectCollectionService = “https://$XConnectCollectionService” } Install-SitecoreConfiguration @sitecoreParams After Successfully running below scripts, you can access Sitecore site using http://xp1.local URL This method can be followed for installation of Sitecore on a local development environment. You can also view Sitecore Multisite Architecture – Single Installation. In case of query, add your comments below.
Build FAQ Knowledge Base with QnA Maker

In my last article “EVERYTHING ABOUT MICROSOFT QnA MAKER”, I have explained what is Microsoft QnA Maker service and how it helps to create an effective knowledge base from your existing FAQ pages and documents. In this blog I will explain the steps to create QnA Maker service to build a knowledge base which can be consumed in the chatbot directly. Login to QnA Maker and Sign-in using Microsoft Live Account Click on Create new service. Provide SERVICE NAME, it can be changed later as well. This field is mandatory and it will appear as a Bot response. QnA Maker provides three ways to enter your FAQs. We can use any one method or combinations of all three methods as per the requirement. a. URL: In case your FAQs are listed on a web page, enter URL(s) for the same. Using + Add another option, you can add one or more publicly accessible FAQ style page URLs. Using this URL, QnA service will gather relevant data and extract QnA pairs that you can later use in your bot. b. Files: In case of FAQ are listed in a file locally. You can easily upload single or multiple files (up to five files), each should be under 5MB. Files can be either FAQ pages in .tsv, .pdf, .doc, .docx and .xlsx format or product manuals in .pdf format. To upload files, click on Select file… You can create your own FAQ file using “.tsv” format as shown in the below image (Highlighted in Yellow are Questions and the respective answer is in green separated by tab): c. Manual Entry: If you want to enter questions manually, QnA allows you to enter queries manually as well. Click on Create. Now QnA will crawl your links and documents and create a knowledge base. After few seconds, Knowledgebase is ready and allows you to correct and update the same. 1. Knowledge Base Tab, showing all Questions and Answers extracted from defined sources. 2.Test the Bot request response, with all potential matches. 3.Settings, display all the settings, like Service name, URL entered. 4.Edit Question and Answer. 5.Save and train with all modified changes. 6.Publish, will be available with public HTTP URL. 7.Add new QnA pair, to add the new set of questions and answers. 8. Delete QnA pair, to remove unwanted QnA pair.Testing the serviceNow after confirming knowledge base, now test the bot request response using the following steps: Click on Test option in the left navigation. The Test service allows you to test all the Bot request and response. Even you can add multiple alternative phrasings to the question. On each response, it will show available appropriate answers from the knowledge base and allows you to choose the most appropriate answer from these answers. After correcting all mappings and adding new alternative phrases, to test with updated data, click on Save and retrain option to retrain the service. Now you can again confirm your mappings. Finally, when all the data is confirmed, click on Publish. You will see a confirmation screen. Click Publish again. You will then be presented with the information needed to consume the Bot. To again get deployment details, click on My services, selecting the service, then click on Settings. This is all about how you can leverage QnA Maker service to convert existing FAQs into the knowledge base with minimum efforts. Now the time is to consume this knowledge base into chatbot application. In the next article, I am going to explain how we can use the Azure Bot Service to setup our FAQ chatbot and consume this knowledge base.
How to create Quick Email Campaigns with Microsoft Dynamics CRM?

A quick campaign is used to send a single activity to a list of contacts or accounts in your system. The activity could be an email, series of phone calls, letters, faxes or appointments. Quick campaigns are created from ‘Marketing Lists’ within the CRM. So, to navigate to your Marketing Lists, we go to the ‘Marketing’ tab (orange tab) and go to Marketing Lists and highlights/select the one we need. We already have a test list created here. Once your choice of marketing list is highlighted, you simply click Create Quick Campaign icon on the top of the screen which will open the Create Quick Campaign wizard. The user simply needs to follow the below steps to create a campaign. So, click on Next. And give your campaign a Name. Click on Next. And you can specify the Type of Activity you want to create. Is it a Phone calls, Appointments, Letters, Faxes or an Emails? Well let’s say it’s Emails. And then I can assign who I want these activities to belong to. So, who will the emails be sent from. So, I can specify it to be me, the person who has created the campaign. I can specify the owners from the record, so it could be the account manager of each of those contacts. We could also assign the activity to any other member of the user or team or we can add the activities to the queue. I want to assign it to me, so I click on that. And I also want the email messaged to be sent and the corresponding email activities to be closed so I will also highlight the last check box and click Next. I can then start to build my email if I wish by entering the subject and the text of the email. Rather than doing that though you can also use one of the templates so highlight Use Templates. We can then specify which template do I want to use. For instance, you want to use the already available templates say Chaos to Insights (that I have built), go ahead Select it. You can also create your own template per your needs. If you want to learn how to create customized email template in Microsoft Dynamics CRM, visit our blog archives or simply click on the link highlighted. If you want a quick preview of the pre-built template, simply click on the template name. It will show you the entire content of the email. You will see mail merge field have been used highlighted in yellow. Once you’re happy with the current template, so simply close that and click Next. This gives me the quick summary of my campaign. If I click Create, that will create my new quick campaign. To view the campaign success or failure, on the Marketing Tab, go to Quick Campaigns, and here is the quick campaign. Now we can see that the email was sent to a total of 4 members which were successful, and the campaign is now complete which means all the emails have gone.
How to create an email template in Microsoft Dynamics CRM?

In Microsoft Dynamics 365. An email template serves as a framework for an email message which helps you to maintain a consistent layout and message. You can create an email templates that can be used by all the users in your organization. In this tutorial we will tell you how to do so. We begin by navigating to Settings < Templates and then clicking Email templates. We now see a list of email templates. To create one, click New in the tool bar. The email template type dialogue opens. Here we must choose what type of record to relate this template to. This means if we choose ‘Case’ can only be created from a case record. We can also choose ‘Global’ which will make this template available to every record type. We are selecting Lead. Now click the OK button. The dialogue closes and the email template form opens with a temporary name new. Let’s give this email template a suitable title, description. The recipient of this email does not see this text. In the subject field enter the text that you want to appear in the subject line of your email message sent to the user. Now you can enter the text in the body of the email. Now let’s add a data field that inserts the recipient’s name into the body of the email. To do this, click Insert/Update in the tool bar. The data field values dialogue opens. Click the add button. The Add data value dialogue opens. Since this data field inserts the name into the message select lead in the record type field. Now we want to indicate which field from the lead record we want to pull data from. Select first name in the field called field. Now click OK to close the dialogue. It should now say Lead: First name in the data field values dialogue. Click OK to insert the data field and close the dialogue. Back at email templates form will create a new line of text. Finish the email message and include a valediction to complete the email message. Click Save and Close in the toolbar to create the template and close the form.
Retrieve missing user views from Project Server database

Installing SharePoint updates in Project Server 2016 environment sometimes lead to missing Project Server user views in content database.
WCF Service on Top Of SharePoint 2016

In this post, I’m going to discuss about WCF service and how it can be developed on top of SharePoint. WCF service works as an individual component that can be hosted on any environment and has no platform dependencies. WCF service plays a major role in SharePoint app based development model by enabling access where the SharePoint app has limited access controls. Let’s see how we can develop WCF service on SharePoint through a custom solution on Visual Studio. But before that I would like to introduce WCF and it’s building blocks. What is WCF? Windows Communication Foundation(WCF) is a framework launched by Microsoft with the release of .Net 3.0. The two main building blocks for WCF services are – distributed and interoperable: Distributed In this concept the application components run on different servers through network. It mainly gets used for better scalability of the server. A web application which is running on one machine can leverage the WCF service hosted on some other server. Interoperable Interoperable means the application can communicate with any other application with different platform, so there’s no platform dependency. Previously .Net remoting service was getting used but only with the .Net applications because of which Microsoft came up with WCF services to overcome platform dependencies. WCF On SharePoint 2016 Here I’m sharing the steps to develop WCF service on top of SharePoint 2016: Step1: Open Visual Studio 2015 and create new SharePoint 2016 empty project. Step 2: Name the project as SPWCFService and click OK. Step 3: Provide the SharePoint web application URL and select Deploy as Farm solution radio button. Step 4: Add following references on solution: a. Microsoft.Office.Server.UserProfiles b. Microsoft.SharePoint c. Microsoft.SharePoint.Clieint.ServerRuntime d. System.ServiceModel e. System.ServiceModel.Web f. System.DirectoryServices g. System.Configuration Step 5: To create the service, add our Layouts folder in solution. Write click on Project and select Add > SharePoint ‘Layouts’ Mapped folder option. Step 6: Once Layouts folder gets added Add one txt file in it named as ‘SPService.txt’. Rename the it as .SVC. Step 7: Add the following line of code in the SVC file we have added in the last step: @ServiceHost%20language=%22C#”>%@ServiceHost language=”C#” Factory=”Microsoft.SharePoint.Client.Services.MultipleBaseAddressDataServiceHostFactory, Microsoft.SharePoint.Client.ServerRuntime, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c” Service=”SharePoint. SPWCFService.Sample.Code.SampleService” Step 8: Now let’s add one folder in the solution named as ‘Code’ and add two classes in it named as ‘ISampleService.cs’ and ‘SampleService.cs’. Modify both the classes with the below code in it: ISampleService.cs using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using System.ServiceModel; using System.ServiceModel.Web; namespace SharePoint.SPWCFService.Sample.Code { [ServiceContract] public interface ISampleService { [OperationContract] [WebInvoke(Method = “GET”, ResponseFormat = WebMessageFormat.Xml, BodyStyle = WebMessageBodyStyle.Wrapped, UriTemplate = “SampleServiceCall({SampleValue})”)] string SampleServiceCall(string SampleValue); } } SampleService.cs using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using System.ServiceModel; using System.ServiceModel.Web; using System.ServiceModel.Activation; using Microsoft.Office.Server.Social; using Microsoft.Office.Server.UserProfiles; using Microsoft.Office.Server.Microfeed; using Microsoft.SharePoint; using Microsoft.Office.Server.ReputationModel; using Microsoft.Office.Server.SocialData; using System.Configuration; using System.Security.Principal; using System.Web; using Microsoft.Web.Hosting.Administration; namespace SharePoint.SPWCFService.Sample.Code { [AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed)] public sealed class SampleService : ISampleService { public string SampleServiceCall(string itemId) { string statusResult = “”; try { using (SPSite SpSite = new SPSite(ConfigurationManager.AppSettings[“SiteUrl”].ToString())) { SPWeb cWeb = SpSite.RootWeb; SPList accReqList = cWeb.Lists[“List”]; SPListItem item = accReqList.GetItemById(Convert.ToInt32(itemId)); statusResult = item[“Title”].ToString(); } } catch (Exception ex) { statusResult = ex.Message; } return statusResult; } } } Step 9: As you can see in the above two classes – one is our Interface ‘ISampleService.cs’ and another is declaration class ‘SampleService.cs’ for the interface. Step 10: We also need to modify our Web Application config for an entry of SiteUrl in appSettings as we have used it in our code above ‘SampleService.cs’ class. Step 11: We need to modify the project Assembly Deployment value from GAC to WebApplication. Step 12: Deploy the solution. Step 13: We can make the service call through the below URL and can test the service: http://{SiteUrl}/_layouts/15/SPWCFService/SPService.svc/SampleServiceCall({ItemID}) Step 14: The expected result will be in the below format: And there you are!
Auto-publish projects in MS Project Server via PowerShell

In MS Project Server/ Project Online, whenever team members submit their timesheet or assignment status, it routes to the project manager for approval process. Even when he approves, it automatically does not update project plan and the reporting database. He need to publish the project after approval in order to update the reporting database. There might be scenarios where timesheets are approved but the project is not published, like when project managers are leading many projects simultaneously or they just forget to publish the project. To keep the plan updated and reporting database always ready, we at Advaiya have developed a PowerShell script to auto-publish all projects together. Here’s how it works: The script can also be scheduled as required. An important thing to note about this script is that it is customized to publish only checked-in projects. So, if a project is checked-out, it won’t be passed to the next step in the workflow, and instead the script will look for another project in the queue. You can download the script for your use. Click here to download. Have any questions? Share it in the comment, and we can discuss.
Project Service Automation(PSA) Programming in Dynamics 365

Dynamics 365 is a cloud-based ERP and CRM enterprise system that was built by Microsoft for maximum flexibility and extensibility. With programming, we can access Dynamics 365 data and create SSRS reports or Power BI reports. Also, we can integrate this fetched data with any other tool like Project Online. For doing any kind of custom development in Dynamics 365, you need to follow these steps: Step 1: Download the Microsoft Dynamics 365 Software Development Kit (SDK) from the below link: https://www.microsoft.com/en-us/download/details.aspx?id=50032 Step 2: Follow the steps from the below URL for initial setup of Console Application that connects to Microsoft Dynamics CRM 2016 using Developer Extensions and creates a contact record. You can skip creating contact record if you do not want to create new contact records programmatically. https://msdn.microsoft.com/library/gg695803.aspx If you face any issue in the connection string, you can add the below connection string in app.config file: Step 3: Once the console application is created, in the program.cs file, edit the using statements as below: using System.Text; using System.Threading.Tasks; using System.Configuration; using Xrm; using Microsoft.Xrm.Tooling.Connector; using Microsoft.Xrm.Sdk; using Microsoft.ProjectServer.Client; using Microsoft.SharePoint.Client; using System.Security; using System.Net; namespace Dynamic365SDK { class Program { static void Main(string[] args) { CrmServiceClient crmConn = new CrmServiceClient(ConfigurationManager.ConnectionStrings[“Xrm”].ConnectionString); IOrganizationService crmService = crmConn.OrganizationServiceProxy; var xrm = new XrmServiceContext(“Xrm”); } } } Step 4: Now, follow these below steps to automate the creation of project, task, assigning task to a resource, and time entries. Step 4.1 Get the list of projects in Dynamics 365: private static void GetListOfProjects(XrmServiceContext xrm) { var projectslist = xrm.msdyn_projectSet; foreach (var project in projectslist) { Console.WriteLine(“n” + project.Id); Console.WriteLine(“n” + project.msdyn_subject); } Console.ReadLine(); } Step 4.2 Create a new project in Dynamics 365: Run the code below and project will be automatically created in Dynamics 365 private static void CreateNewProject(XrmServiceContext xrm) { var Projects = new msdyn_project { msdyn_projectId = new Guid(), msdyn_subject = “Dynamics 365”, //Project name that you want to create }; xrm.AddObject(Projects); xrm.SaveChanges(); } Step 4.3 Get the list of tasks: private static void GetListOfTasks(XrmServiceContext xrm) { Guid ProjectId = new Guid(“666609d2-9510-e711-ae87-002713bd9b28”); var Tasks = xrm.msdyn_projecttaskSet.Where(T => T.msdyn_project.Id == ProjectId); foreach (var TaskList in Tasks) { Console.WriteLine(“n” + TaskList.msdyn_projecttaskId); Console.WriteLine(“n” + TaskList.msdyn_subject); Console.WriteLine(“n” + TaskList.msdyn_project.Id); } Console.ReadLine(); } Step 4.4 Create a new task: private static void CreateNewTask(XrmServiceContext xrm) { Guid ProjectId = new Guid(“666609d2-9510-e711-ae87-002713bd9b28”); //Project ID var Tasks = xrm.msdyn_projecttaskSet.Where(T => T.msdyn_project.Id == ProjectId); int count = Tasks.ToList().Count; Guid taskID = Guid.NewGuid(); var Task = new msdyn_projecttask { msdyn_projecttaskId = taskID, msdyn_subject = “Testing”, //Task name that you want to create msdyn_scheduledstart = (DateTime.Now), msdyn_scheduledend = (DateTime.Now.AddDays(3)), msdyn_autoscheduling = true, msdyn_WBSID = (count + 1).ToString(), msdyn_project = new Microsoft.Xrm.Client.CrmEntityReference(“msdyn_project”, ProjectId), msdyn_numberofresources = 1, msdyn_Effort = 1, }; xrm.AddObject(Task); xrm.SaveChanges(); } Step 4.5 Get the list of resources of a project: private static void GetListOfResources(XrmServiceContext xrm) { Guid ProjectId = new Guid(“7982feea-a0f2-e611-8130-e0071b6a92f1”); //Project ID var Resource = from t in xrm.msdyn_projecttaskSet join a in xrm.msdyn_resourceassignmentSet on t.msdyn_projecttaskId equals a.msdyn_taskid.Id join r in xrm.BookableResourceSet on a.msdyn_bookableresourceid.Id equals r.BookableResourceId where t.msdyn_project.Id == ProjectId select new { Task_id = t.msdyn_projecttaskId, Task_name = t.msdyn_subject, resource_id = a.msdyn_bookableresourceid.Id, resource_name = r.Name, resource_logical = r.LogicalName }; foreach (var ResourceList in Resource) { Console.WriteLine(“n” + ResourceList.Task_id); Console.WriteLine(“n” + ResourceList.Task_name); Console.WriteLine(“n” + ResourceList.resource_id); Console.WriteLine(“n” + ResourceList.resource_name); Console.WriteLine(“n” + ResourceList.resource_logical); } Console.ReadLine(); } Step 4.6 Assign task to a resource: private static void AssignResourceToTask(XrmServiceContext xrm) { Guid ProjectTeamId = new Guid(); Guid TaskId = new Guid(“104264d4-6a14-e711-8114-e0071b6ac161”); //Task ID you want to assign Guid ResourceId = new Guid(“cd01ae07-b9cd-e611-80e7-c4346bac0910”); //Resource ID Guid ProjectId = new Guid(“7982feea-a0f2-e611-8130-e0071b6a92f1”); //Project ID Guid BookingStatusId = new Guid(“d0e57e11-c0cd-e611-80e8-c4346bad367c”); //Hardbook var ProjectTeam = xrm.msdyn_projectteamSet.Where(PT => PT.msdyn_project.Id == ProjectId && PT.msdyn_bookableresourceid.Id == ResourceId); foreach (var ProjectTeamList in ProjectTeam) { ProjectTeamId = ProjectTeamList.Id; } var AssignResource = new msdyn_resourceassignment { msdyn_resourceassignmentId = Guid.NewGuid(), msdyn_bookableresourceid = new Microsoft.Xrm.Client.CrmEntityReference(“bookableresource”, ResourceId), msdyn_taskid = new Microsoft.Xrm.Client.CrmEntityReference(“msdyn_projecttask”, TaskId), msdyn_projectid = new Microsoft.Xrm.Client.CrmEntityReference(“msdyn_project”, ProjectId), msdyn_bookingstatusid = new Microsoft.Xrm.Client.CrmEntityReference(“bookingstatus”, BookingStatusId), msdyn_projectteamid = new Microsoft.Xrm.Client.CrmEntityReference(“msdyn_projectteam”, ProjectTeamId) }; xrm.AddObject(AssignResource); xrm.SaveChanges(); Step 4.7 Get time entries: private static void GetTimeEntries(XrmServiceContext xrm) { Guid ResourceId = new Guid(“cd01ae07-b9cd-e611-80e7-c4346bac0910”); //Resource ID var TimeEntries = xrm.msdyn_timeentrySet.Where(t => t.msdyn_bookableresource.Id == ResourceId); foreach (var TimeEntryList in TimeEntries) { Console.WriteLine(“n” + TimeEntryList.CreatedOn); Console.WriteLine(“n” + TimeEntryList.msdyn_date); Console.WriteLine(“n” + TimeEntryList.msdyn_description); Console.WriteLine(“n” + TimeEntryList.msdyn_duration); Console.WriteLine(“n” + TimeEntryList.msdyn_project.Name); Console.WriteLine(“n” + TimeEntryList.msdyn_projectTask.Name); Console.WriteLine(“========xxxxxx========xxxxxx========xxxxxx========”); } Console.ReadLine(); } Step 4.8 Enter time entries: private static void EnterTimeEntries(XrmServiceContext xrm) { Guid TaskId = new Guid(“104264d4-6a14-e711-8114-e0071b6ac161”); //Task ID Guid ResourceId = new Guid(“cd01ae07-b9cd-e611-80e7-c4346bac0910”); //Resource ID Guid ProjectId = new Guid(“7982feea-a0f2-e611-8130-e0071b6a92f1”); //Project ID var TimeEntry = new msdyn_timeentry { Id = Guid.NewGuid(), msdyn_date = Convert.ToDateTime(“4/4/2017”), msdyn_duration = 60 }; xrm.AddObject(TimeEntry); xrm.SaveChanges(); } This above code can help you fetch data from PSA and use it in reporting as per your need. Hope you find this information helpful, and feel free to comment if you would like to discuss more on this.