Category Archives: Blog
CRM App for Outlook Web App (OWA)
Dynamics CRM App for Outlook is a lightweight Office app that you can use together with Outlook 2013 or Outlook Web App (included with Office 365). You can use the app to track incoming email in Microsoft Dynamics CRM. When you track an email message, a copy of that message is stored as an email activity record in Microsoft Dynamics CRM. You or anyone with access to your CRM activities can then access that activity record in CRM, Dynamics CRM App for Outlook, Dynamics CRM for Outlook, or in the CRM mobile apps. Microsoft Preview features: Are not supported by Microsoft Support. Are available on a “preview” basis so customers can get early access and provide feedback. May have limited or restricted functionality. Aren’t meant for production use. May be available only in selected geographic areas. Prerequisites for installing and using CRM App for Outlook Your CRM system administrator must deploy Dynamics CRM App for Outlook to your organization before you can access it. To deploy Dynamics CRM App for Outlook: Your organization must use CRM Online, and Dynamics CRM 2015 Update 1 must be installed. Your organization must use Exchange Online for email processing. Your organization must synchronize email through server-side synchronization. The system administrator must set up specific security roles. The system administrator must enable the Dynamics CRM App for Outlook Preview feature. The system administrator must add Dynamics CRM App for Outlook to your Exchange Online service. Supported browsers You can use Dynamics CRM App for Outlook with Outlook Web App on the following browsers: Internet Explorer 10 or Internet Explorer 11 Google Chrome version 41 or later With Dynamics CRM App for Outlook, you can: Tap the power of CRM while working in the familiar Outlook environment. Track incoming email wherever you are, as long as you have access to a browser. Track an incoming email message and (optionally) link it to an existing record in CRM. For example, you might want to link an email message to a specific account or opportunity. If a record doesn’t exist, you can create it right from within the app! Find out whether an email message is already tracked, and change the regarding record (the CRM record that the message is linked to). Create CRM contact or lead records for people on the From list that aren’t already included in the CRM database. You can also create new CRM records for any entity (record type), as long as the entity has been enabled for mobile and for multi-entity search. Preview information about contacts and leads stored in CRM. For example, you can find a number or company name for a contact or lead, or preview the last and next activities for a contact or lead. Open CRM records directly to find or enter more detailed information. Enable the Dynamics CRM App for Outlook Preview feature To enable the Dynamics CRM App for Outlook Preview feature: Go to Settings > Administration. Choose System Settings. Choose the Previews Select checkbox on the read and agree to license terms. Choose Yes to enable the Microsoft Dynamics CRM App for Outlook Preview. Click Ok. Set the CRM App for Outlook privilege for a security role Go to Settings > Security. Choose Security Roles. Select the security role (for example, Salesperson), and then choose the Business Management Verify that Use CRM for Office Apps is set to Organization. If not, choose Use CRM for Office Apps. Choose Save and Close to save the changes to the security role. Deploy CRM App for Outlook You can use the Exchange admin center to quickly and easily deploy Dynamics CRM App for Outlook to your users. Sign in to the Office 365 admin center. On the left-side menu, under Admin, choose Exchange. On the Exchange admin center page, under organization, choose apps. Choose (+) > Add from the Office Store. Search for and add the Microsoft Dynamics CRM for Outlook app. Once the app is installed, refresh the list, select the app, and then choose Edit. Choose how you want to deploy Dynamics CRM App for Outlook to your users. Choose Save to enable the app for your organization. Accessing Dynamics CRM App for Outlook after it’s been deployed Once the system administrator installs and enables the Dynamics CRM App for Outlook, the app appears as a Dynamics CRM tab in the Outlook reading pane. Just choose the tab to access your CRM data. Track an incoming email message from an unknown sender Select the email message in your Inbox, and then choose the Dynamics CRM When an email message is from an unknown sender (the sender isn’t already a contact or lead in CRM), you’ll see the Create Contact form. The First Name, Last Name, and Email fields are already filled in for you. The Phone Number field will be filled in if it’s available. Click Save post filling the required info or choose Save and edit in CRM to open the contact form in crm. The sections Next Activity, Last Activity, Case Associated View and Opportunity Associated View are empty because the contact doesn’t have any related records in CRM yet.Email getting tracked in CRM for Microsoft Online Service Team contact Similarly one can also create for any entity (record type), as long as the entity has been enabled for mobile and for multi-entity search just like the contact/lead record using the Dynamics CRM tab and link the email message to that record. To create a new record in CRM (for example, to create a lead record instead of a contact record) and link it to the email activity record: Do not save the contact info Click on track. Choose New next to any enabled entity. In the quick create form, fill out the fields. Choose Save to save the record if you’re done adding information. To enter more detailed information, choose Edit to edit the record in CRM. A contact with the email id details is created in CRM by the system by default. We have tested the feature for a custom entity. Please find the screenshots for the same. There are 2 ways to track an incoming email in CRM using Dynamics CRM App. If you don’t want to link … Continue reading CRM App for Outlook Web App (OWA)
Share Story :
Add Office 365 Azure Directory into Windows Azure Part 1
In this blog we walk-through adding office 365 AD in your Windows Azure account. Blog is divided in two different parts. Part 1: Add Office 365 Active Directory into Microsoft account. Part 2: Add Office 365 Active Directory into Organization account. Pre-Requisite: Azure Subscription to the Microsoft account (Service Administrator). Global admin user of Office 365. Next we need to follow the steps given below to add Office 365 Active directory. Login to azure account using Microsoft account. Navigate to Active Directory and click on new button. Select “use existing directory” option because we are adding office 365 Active directory. Now sign-in with your office 365 user (Global admin). Above process is little bit tedious because user need to sign-in and sign-out frequently. Limitation: If Microsoft user email address and office 365 user email address is same then this process will get failed. Now you can see “A1 Tech solution” directory added to our Azure account. Add Azure subscription to Active directory. Select your AD from dropdown. Now you can see URL will be changed according to your Office 365 AD domain. Add co-administrator to your subscription. Note: Each subscription can be associate with only one Active directory. In order to add co-administrator we have to associate azure subscription with Active directory.
Share Story :
Images, Notes & Attachments Migration using SSIS Integration toolkit – Kingswaysoft
Note: This article assumes experience on SSIS Integration Toolkit for Dynamics CRM and understanding of CRM Online Images, Notes and Attachment migration in CRM Online is always a challenging task. One easy way of dealing with them is to use SSIS Integration Toolkit for Dynamics CRM Images Steps: Drag and drop Dynamics CRM Source and Dynamics CRM Destination component. Set up the Source CRM by adding the connection manager, mentioning the source type(Entity /Fetch xml/Entity changes) Set up the Target CRM by setting the connection, choosing the appropriate action (Create/Update/Upsert/Delete etc.), specifying the destination entity Map the Input column and destination CRM field For migrating images, we need to directly map entityimage field of source to entityimage filed of target Notes/Attachments Steps: For notes and attachments, select the annotation entity as the source as target by following the steps mentioned above The fields to be mapped are subject, notetext, documentbody, filename, mimetype, objectid for mentioning to which entity is the note/attachment related to We use Text lookup function for lookups We can lookup on name/ GUID /custom field as per the need. In the example mentioned above we lookup the accountid which is the primary field for account entity
Share Story :
CRM data migration best practices
This blog is an effort to note down the mistakes made and lessons learned after couple of data migrations completed successfully for our clients. If you are moving from CRM on premise or any platform to CRM Online, you will need to migrate your data. First, determine which entities are being used and needs to be migrated. The order of migration is important as field(s) of an entity can be related to other entity and used on the entity(s) form. Some of the points to consider while migration: Unique identifier in CRM To uniquely identify a record in CRM, use the guid of the record Mapping GUID of the source to target helps in identifying records in source & target Created On date Created date of source record can be mapped to overridecreatedon field in target It can only be inserted once, cannot be modified on update of records Calculated fields Avoid mapping calculated fields to avoid data mismatch during migration. CRM will automatically calculate them on data load of other fields used in calculation Users There are chances that users in your system who have been deactivated own records, such as activities. For assigning a record to any user, the user must be active So if you have a former employee and you want to import activities and assign them to that user, you will need to temporarily have his user record active in the new system. This means creating records for users who are no longer in the organization You can create users without sending an invitation to that address Assign records to the user and then disable that user record Opportunities When importing opportunities, the actualclosedate will be set to today’s date even if you try to load another date to that field. The recommendation is after you update the status of the closed opportunities to Closed, run an update for opportunities updating the actualclosedate to the correct date Activities Individual activity entities like email, appointment, phone call or task should be migrated individually Initially, keep the status of all activities ‘Open’. Once you update all fields and parties of the activities, close them at the end of the migration since once closed those activities cannot be updated If the owner of the account/contact/lead associated with the activities is updated, it may change the owner of activities. To avoid this, either disable parental to cascading relationship (CRM setting) or do not map the owner of the parent on update Always try to run activities in batches as there can be lots of data if your system is too old Activity parties Consider partytypecode and activitytypecode in field properties. If ispartydeleted = -1 that means party associated with the activity is deleted. Hence cannot be migrated If one of the recipients is not in CRM as a contact, account, or user, it will create an activity party not linked to any partyid in CRM. These records cannot be imported Set up your activityparty dts source query to inner join activitypointer to filter out any activityparties linked to an activity that was deleted from the system This will cut the list down and save much time Connections Connection roles & Association should be present Select record types ‘All’ (not a specific record type) to avoid mismatch. Connection creates its own connection so there are 2 connection records created while migration. To avoid duplicates, Handle in CRM to delete the duplicates based on connection 1-role 1 & connection 2-role 2 combinationOR Design a package to delete the duplicate records if it is already created once Keeping these best practices in mind, you can quickly migrate your data in CRM Online.
Share Story :
CRM Online Migration using SSIS
In this Blog we will walk-through the migration of Data from Microsoft Dynamics CRM (Source) to Microsoft Dynamics CRM (Target) 2015 using SSIS. We would be using SSIS Integration Toolkit for Microsoft Dynamic CRM by Kingsway Soft. We would be referring SSIS Integration Toolkit for Microsoft Dynamics CRM by Kingsway Soft as Kingsway-SSIS Toolkit. This toolkit provides 4 major components for Integration and migration of Data. Microsoft Dynamics CRM Connection Manager Microsoft Dynamics CRM Source Component Microsoft Dynamics CRM Destination Component Microsoft Dynamics CRM OptionSet Mapping Component Pre-Requites: This Toolkit is supported on below versions of Microsoft Dynamics CRM and Microsoft SQL server. .NET Framework 3.5 SP1 Microsoft Dynamics CRM Microsoft Dynamics CRM Online Microsoft Dynamics CRM Server 2015 Microsoft Dynamics CRM Server 2013 Microsoft Dynamics CRM Server 2011 Microsoft Dynamics CRM Server 4.0 Microsoft Dynamics CRM Server 3.0 SQL Server Microsoft SQL Server 2014 (since v5.0) Microsoft SQL Server 2012 Microsoft SQL Server 2008 R2 Microsoft SQL Server 2008 Microsoft SQL Server 2005 Other Tools that provide the same integration as Kingsway Soft are as below: Cozyroc.com http://cozyroc.com/ssis/dynamics-crm-source http://cozyroc.com/ssis/dynamics-crm-destination PragmaticWorks.com https://pragmaticworks.com/Products/Task%20Factory/Features/DynamicsCRMSource https://pragmaticworks.com/Products/Task%20Factory/Features/DynamicsCRMDestination Work Flow: After Installation of Toolkit, below options are visible in SSIS Toolbox in SSDT (SQL Server Data Tools). A new connection can be added in Connection Manager as below for DynamicsCRM. Information needs to be provided to connect to CRM server as below. (http://www.kingswaysoft.com/products/ssis-integration-toolkit-for-microsoft-dynamics-crm/help-manual) The Authentication Type option allows us to specify the type of CRM server (deployment) and what authentication is used. There are four options available. Active Directory (On-Premise) Federation (IFD, On-Premise or Partner-hosted) Online Federation (Office 365 CRM Online) LiveId (Legacy CRM Online) The CRM discovery server can be found in the CRM system from Settings → Customizations → Developer Resources after logging in to your CRM application. Service endpoint gets auto populated. You can specify the Timeout in seconds. Default is 2 minutes. On providing the User Name and Password, Organization gets populated in drop down list. Select the Organization name and test the connection. Once the connection is successful. Click Ok. If you connectivity is through Proxy server you can specify the connection details for the same in the second tab Advanced Settings. It is recommended to have the box ticked-on for Retry on Intermittent Errors. Follow the same steps as above for creating Destination connection for Target CRM where the data is to be migrated. Launch SSDT (SQL Server Data Tools and select Integration Project and drag and drop the Source and the Target. Here in this example we have not performed any data or file transformations. It’s simply connecting to CRM source and pushing the data to Target CRM based on mappings specified for entities as well as Text Lookups specified if any. In this example we are migrating Entity – Accounts. CRM source Connection name in this example is named as “Source” and CRM Destination connection as “Target”. Using this toolkit, in the columns Tab, Most of the columns gets auto-mapped. Verify the mappings, specifically the ones with Text Lookup. Action gives the options like Create, Update, Delete, Upsert, Merge, Convert and Execute Workflow. We need to select Create if we are simply migrating the data into target CRM (History Load). Select the Destination entity. Upsert Settings are applicable only if Upsert Action is selected. Choose Target Fields. Target Entity gets auto populated. Using the drop down list select Target text/ Integer Field. Advanced Options can be left unselected. Cache strategy needs to be selected with Performance and size of data that needs to be migrated. (This is similar to Cache mode in SSIS look-up transforms). Now the package is ready to be executed. Execute the package and verify by logging into CRM, all the fields are populated. Note: As a general practise during SSIS package creation, sequence containers are used for each entities that are to be migrated. Only one source and destination CRM connection needs to be created. Benefits of Parallelism can be used for performance benefits as well as individual tasks (for single entity) can be selected in the data flow to be executed, with others as disabled.
Share Story :
Folder Based E-mail Tracking in CRM 2015 Spring Update
Problem Statement Sales people work for multiple opportunities simultaneously and they maintain all their e-mail communications folder wise in their mailbox. Sales people uses CRM to track their opportunity/lead/account/contact data and uses their E-mail app to communicate with users through e-mail. Now, sales people wants to track those e-mails in CRM & also they want to assign individual records in CRM to those e-mails. What is Folder Based E-mail Tracking? In Spring Update, now users can track e-mails by folders in CRM and also assign any record to particular e-mail activity. Once sales person moves an E-mail into specific folder, an e-mail activity will be created in CRM with/without regarding based on how user has configured the mail routing. The most important benefit of this feature is that, you don’t need any additional add-in to track mail into CRM. You can directly move e-mail from either Outlook Desktop app, OWA or Mobile Phone etc. Also, if you setup a rule in your mailbox, the mails can be automatically moved into specific folder and can be tracked automatically into CRM. Considerations for using this feature You should have Exchange Online & Server Side Synchronization should be set up in the CRM. The folder from which mails need to be tracked should be present under inbox folder. Steps to configure Check if you have Server Side Synchronization enabled in your CRM. Create folders in Inbox folder in your mailbox. Enable Folder Based Tracking at organization level Go to Settings -> Administration -> System Settings Go to E-mail tab and check the checkbox highlighted in below image. Configure Folder Tracking Rules for e-mails Go to personal Options Go to Email tab -> Configure Folder Tracking Rules Setup the rules Note: If you keep Regarding Record in CRM blank, only e-mail activity will be created in CRM and regarding field will be blank. You can set regarding field later. In Exchange Folder, you will be able to see folders which are present in Inbox folder of your mailbox. If you have a sub folder under another sub folder, you will need to configure separate tracking rule for those individual sub folder.
Share Story :
Define alternate keys for an entity
With the release of Microsoft 2015 Update 1 Microsoft has released lots of exciting features, one of them is alternate key. Traditionally we use CRM primary field to identify the records. All Microsoft dynamics entities has unique identifier known as GUID. This GUID is the Primary key of particular record. When we want to integrate CRM with an external data base, we might be able to add a column to the external database tables to have a reference to the unique identifier in CRM. But in various cases, it is possibility that we are not allowed to change their database to add the reference key to store the GUID. In that case we are not able to track the records in the system. With alternate keys we can now define an attribute in a CRM entity to correspond to a unique identifier (or unique combination of columns) used by the external data store. Features of Alternate Key This is used to identify the duplicate records. If there are records with the specified alternate key exists in system then it will throw an error. This avoid users to write plugin to identify the duplicate records. As duplicate detection rules allows the user to create the records even if it exists in the system. Alternate key can be combination of more than on attributes. With alternate keys, you can assure an efficient and accurate way of integrating data into Microsoft Dynamics CRM from external systems. It’s especially important in cases when an external system doesn’t store the CRM record IDs (GUIDs) that uniquely identify records Faster lookup of the records. More robust bulk data operations, especially in CRM Online Create Alternate Key To define alternate key please follow the steps: Go to Setting → Customization, open the default solution Select the entity for which you want define alternate key, in our case it is account. Select Keys and click new, which will open shown screen. You need to add column/columns which will be used as an alternate key. Save and publish. Alert As you can see in the below screen shot error reported from two different rule. One from duplciate detection rule and another one from alternate key. The main difference between these two are below In case of duplicate detection users are allowed to create new record. But in case of alternate key users are not allowed to create the record. Duplicate detection Rule Alternate Key: Attributes Valid for Alternate Key Decimal Number Whole Number Single line of text Retrieve and delete alternate keys If you need to retrieve or delete alternate keys, you can use the customization UI to do this, without writing any code. Although, the SDK provides the following two messages to programmatically retrieve and delete alternate keys. Message request class Description RetrieveEntityKeyRequest Retrieves the specified alternate key. DeleteEntityKeyRequest Deletes the specified alternate key To retrieve all the keys for an entity, use the new Keys property of EntityMetadata Class. It gets an array of keys for an entity. Using alternate keys to Update A valid Entity used for update operations includes a logical name of the entity and one of the following: A value for ID (primary key GUID value) (or) A KeyAttributeCollection with a valid set of attributes matching a defined key for the entity Programmatically: using (_orgService = new OrganizationService(connectionTarget)) { Entity account = new Entity(“account”, “accountnumber”, “SUB0001”); account[“telephone1”] = “9874563210”; account[“fax”] = “1234579856”; _orgService.Update(account); } Using alternate keys to create an Entity Reference Similarly we can use alternate key to set the entity reference field. We need to define the KeyAttributeCollection of the related entity whose lookup we want to set. We don’t need to set the GUID to relate record instead we need to set the alternate key of the related entity If the specified alternate key record does not present in the system it will through an error “A record with the specified key values does not exist in account entity” using (_orgService = new OrganizationService(connectionTarget)) { KeyAttributeCollection keys = new KeyAttributeCollection(); keys.Add(“accountnumber”, “SUB0001”); Entity contactEntity = new Entity(“contact”); contactEntity[“lastname”] = “Last Name”; contactEntity[“parentcustomerid”] = new EntityReference(“account”, keys); contactEntity[“fax”] = “9874563210”; CreateRequest req = new CreateRequest { Target = contactEntity }; _orgService.Execute(req); } Notes: For Microsoft Dynamics CRM Online organizations, this feature is available only if your organization has updated to Dynamics CRM Online 2015 Update 1. This feature is not available for Dynamics CRM (on-premises). You can define up to five different keys for an entity.
Share Story :
Microsoft Dynamics CRM 2015 Web API
Microsoft has released the Dynamics CRM Web API with the 2015 Spring Update. The purpose of this blog article is to demonstrate the use of the CRM Web API for performing different data operations. Before we begin using the Web API there are a few pre-requisites. Azure Subscription Dynamics CRM 2015 Update 1 Dynamics CRM user with System Administrator role Next we need to follow the steps given below to start using the Web API: Enable Web API Preview in CRM. Web API Preview can be enable in Dynamics CRM 2015 Update 1 from Settings> Administration > System Settings. Associate Azure Subscription to your Dynamics CRM Tenant. You can follow the steps given here to associate your Azure Subscription to your Dynamics CRM tenant. Register an App on Azure Active Directory. Log In to Azure and go to Active Directory -> <your directory> ->Applications -> Add Click on “Add an application my organization is developing”. Select “Native Client Application” and enter the name of the application. Enter the Redirect URI as http://localhost/<yourappname> and then click on Ok. Once completed you will be redirected to the application page. Click on “Configure Access to Web Apis in other applications” and then click on “Configure it now”. Click on Add Application and select Dynamics CRM Online and then click on Complete. Next, Under Delegated Permissions check “Access CRM Online as organization users” and click on Save. Also copy and save the ClientID and Redirect URI as we will require this is our code. Create a .Net App to start consuming the Web API Create a new Console Application project in Visual Studio. Right Click on the Project and click on Manage NuGet Packages. Enter “adal” in the search box and then install Active Directory Authentication Library. This will install the required .dlls to help us authenticate using Azure Active Directory. Add the below code in the Main() method of your program. string resource = “https://<yourdomain>.crm.dynamics.com/”; string clientID = “<your client id>”; string redirectUrl = “<your redirect uri>”; AuthenticationContext authContext = new AuthenticationContext(“https://login.windows.net/common”, false); AuthenticationResult result = authContext.AcquireToken(resource, clientID, new Uri(redirectUrl)); Run the code by pressing f5. You will be prompted to enter your user credentials. After entering the credentials the server returns an Authentication Token. The AccessToken and the AccessTokenType (“Bearer”) is what we need to include into every Authorization header of http request. Next into every requests we make to the CRM Web API we need to pass this authentication token. Below is a Sample Code which demonstrates use of CRM Web API for Create, Retrieve, Update and Delete Operations. using Microsoft.Crm.Sdk.Samples.HelperCode; using Microsoft.IdentityModel.Clients.ActiveDirectory; using Newtonsoft.Json; using Newtonsoft.Json.Linq; using System; using System.Collections.Generic; using System.Linq; using System.Net.Http; using System.Net.Http.Headers; using System.Text; using System.Threading.Tasks; using WebAPITest.Entities; namespace WebAPITest { class Program { static string resource = “https://destroyskynet.crm.dynamics.com/”; static string clientID = “<your client id>”; static string redirectUrl = “http://localhost/webapitest”; static void Main(string[] args) { AuthenticationContext authContext = new AuthenticationContext(“https://login.windows.net/common”, false); Task.WaitAll(Task.Run(async () => await DataOperations(authContext))); } private static async Task DataOperations(AuthenticationContext auth) { using (HttpClient httpClient = new HttpClient()) { httpClient.BaseAddress = new Uri(“https://destroyskynet.crm.dynamics.com”); httpClient.Timeout = new TimeSpan(0, 2, 0); //2 minutes httpClient.DefaultRequestHeaders.Add(“OData-MaxVersion”, “4.0”); httpClient.DefaultRequestHeaders.Add(“OData-Version”, “4.0”); httpClient.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue(“application/json”)); Account account = new Account(); account.name = “Cloudfronts TechnologiesNew”; account.telephone1 = “555-555”; string content = String.Empty; content = JsonConvert.SerializeObject(account, new JsonSerializerSettings() { DefaultValueHandling = DefaultValueHandling.Ignore }); httpClient.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue(“Bearer”, auth.AcquireToken(resource, clientID, new Uri(redirectUrl)).AccessToken); //Create Entity HttpRequestMessage request = new HttpRequestMessage(HttpMethod.Post, “api/data/accounts”); request.Content = new StringContent(content); request.Content.Headers.ContentType = MediaTypeHeaderValue.Parse(“application/json”); HttpResponseMessage response =await httpClient.SendAsync(request); if (response.IsSuccessStatusCode) Console.WriteLine(“Account ‘{0}’ created.”, account.name); else throw new Exception(String.Format(“Failed to create account ‘{0}’, reason is ‘{1}’.”, account.name, response.ReasonPhrase)); //Retreive Entity //The uri of the created entity is received in “OData-EntityId”. Use the account URI to update/delete account. string accountUri = response.Headers.GetValues(“OData-EntityId”).FirstOrDefault(); var retrieveResponse = await httpClient.GetAsync(accountUri + “?$select=name,telephone1”); Account retreivedAccount=null; if(retrieveResponse.IsSuccessStatusCode) { //Deserialize response into Account retreivedAccount = JsonConvert.DeserializeObject<Account>(await retrieveResponse.Content.ReadAsStringAsync()); Console.WriteLine(“Retreived Account Name : {0} Telephone : {1}”,retreivedAccount.name,retreivedAccount.telephone1); } else { throw new Exception(String.Format(“Failed to retreive account ‘{0}’, reason is ‘{1}’.”, account.name, response.ReasonPhrase)); } //Update Entity JObject accountToUpdate = new JObject(); accountToUpdate.Add(“name”, retreivedAccount.name + “Edited”); string updateContent = String.Empty; updateContent = accountToUpdate.ToString(); HttpRequestMessage updateRequest = new HttpRequestMessage(HttpMethod.Put, accountUri); updateRequest.Content = new StringContent(updateContent); updateRequest.Content.Headers.ContentType = MediaTypeHeaderValue.Parse(“application/json”); HttpResponseMessage updateResponse = await httpClient.SendAsync(updateRequest); if (response.IsSuccessStatusCode) Console.WriteLine(“Account ‘{0}’ updated.”, accountToUpdate[“name”]); else throw new Exception( String.Format(“Failed to update account ‘{0}’, reason is ‘{1}’.”, accountToUpdate[“name”], response.ReasonPhrase)); //Delete Account HttpResponseMessage deleteResponse = await httpClient.DeleteAsync(accountUri); if (response.IsSuccessStatusCode) Console.WriteLine(“Account deleted.”); else throw new Exception( String.Format(“Failed to delete account”)); } } } } Microsoft has also provided helper code to authenticate using credentials stored in the .config file. In my next article I will demonstrate how to use this helper code and authenticate users directly using the credentials stored in the .config file.
Share Story :
Integrating Parature Knowledge Base with Dynamics CRM
The purpose of this blog is to help integrate Dynamics CRM online with Parature Knowledge Base(KB). By integrating Parature KB with CRM, Users will be able to access the Articles in created in Parature without changing the applications. Pre-Requisite: CRM Online with Spring release update Parature Enterprise license Parature account under same O365 tenant as CRM online Purpose of Integration: Parature provides well developed platform for handling service desk for customers. One of the many features provided by Parature is Knowledge Base(KB). Steps to integrate Dynamics CRM with Parature: Configurations at Parature end: Add your CRM organization to the list of allowed URLs in CROS setting in Parature: Go to Setup -> Department Management -> CORS Settings. Add your CRM organization URL. Configurations at CRM end: Setup Knowledge Management: Go to Service Management under Settings as below: Select Set Up Knowledge Base Management under “Knowledge Base Management” section. Knowledge Management Settings Window pops up as below: Record Types: The list shows all entities available for N:N relationship. When enabling Parature integration for an entity, a many-to-many relationship is created between the entity and the ‘Knowledge Base Record’ entity. Select the record types for which you want knowledge management to be turned on. By default Case entity has Knowledge management enabled. Parature Instance: Dropdown list will give list of Parature instances that can be connected to. Select the Parature instance to be connected to. Parature URL: This is selected automatically on selecting the Parature Instance. Account ID: This is selected automatically on selecting the Parature Instance. It shows ID of the Account. Parature Department ID: Specify the Department ID for which the Parature instance is setup. We must specify this properly since every Department in Organization can have their own knowledge base. We need to specify the Department ID of the department to whose Knowledge base we need to connect. To find the department ID, log on to Parature using Administrators login credentials, select System Overview from Setup tab. Note: You will be able to see the Setup tab only if you have Administrator permissions. Support Portal URL: Specify the URL of Support Portal. Support portal URL can be checked from Parature by clicking on ‘My Portal’ option on upper right hand side. Select the URL. Click Next. Verify the Details and click Finish. Using Parature Knowledge Base in Dynamics CRM: After integrating Parature Knowledge Base (KB) with Dynamics CRM online, We can access the Knowledge Articles created in Parature in CRM. For Case entity, by default we get KB Articles Section which auto searches the knowledge base:
Share Story :
Auto Start-Stop Azure VM using Azure Automation
Problem Statement We a have requirement, where we want to start Azure VM every morning 8.30am and stop VM at 6.30pm excluding Saturday and Sunday. Pre-Requisite Azure subscription Virtual Machine Azure Automation Installation Activate Azure Automation Activate Azure automation from preview portal. Navigate to following URL to activate Automation. https://account.windowsazure.com/PreviewFeatures Add Automation account Select automation and click on Create Provide proper account name and region Connect to VM using automation Using Certificate Using Organization ID Part 1: Using Certificate Certificate Installation Open Windows run and type following command (inetmgr) Double click on Server certificate Create self-sign certificate (Top-Right corner) Provide useful name on select type personal. Now we required .cer and .pfx file for azure automation. Save .pfx file: Select path and type password. Password is required for uploading certificate on Azure. Save .cer file: Right click on AzureAutomation and click on view. Click on copy to file button. Upload certificate on Azure Upload .cer file Select .cer certificate from local machine. Upload .pfx file Navigate to Automation :- AutomationDemo(Account name) :- Assets Click on Add setting Click on Credential and provide credential name. This name we will used in Automation workflow as certificate name. Define connection for Automation Workflow Parameter: Automation certificate name will be same as Certificate name. Refer below image. For Subscription ID refer below image. Now we have completed with installation. Next part is to create wokflow. Add workflow for automation Create runbook under AutomationDemo account. We are creating runbook for auto start/stop VM. I have created runbook as StartVM under AutomationDemo account. After runbook is created, navigate to StartVM runbook. Kindly find sample code below workflow StartVM { param() #connection $MyConnection = “automationconnection” $MyCert = “automationcredential” # Get the Azure Automation Connection $Con = Get-AutomationConnection -Name $MyConnection if ($Con -eq $null) { Write-Output “Connection entered: $MyConnection does not exist in the automation service. Please create one `n” } else { $SubscriptionID = $Con.SubscriptionID $ManagementCertificate = $Con.AutomationCertificateName } # Get Certificate & print out its properties $Cert = Get-AutomationCertificate -Name $MyCert if ($Cert -eq $null) { Write-Output “Certificate entered: $MyCert does not exist in the automation service. Please create one `n” } else { $Thumbprint = $Cert.Thumbprint } #Set and Select the Azure Subscription Set-AzureSubscription ` -SubscriptionName “My Azure Subscription” ` -Certificate $Cert ` -SubscriptionId $SubscriptionID ` #Select Azure Subscription Select-AzureSubscription ` -SubscriptionName “My Azure Subscription” Write-Output “————————————————————————-” Write-Output “Starting the VM..” # Please type the name of your Domain Controllers inlinescript{ # function to get local time (example Convert UTC tome to Indian Time Zone) Function Get-LocalTime($UTCTime) { $strCurrentTimeZone = ‘India Standard Time’ $TZ = [System.TimeZoneInfo]::FindSystemTimeZoneById($strCurrentTimeZone) $LocalTime = [System.TimeZoneInfo]::ConvertTimeFromUtc($UTCTime, $TZ) Return $LocalTime } #convert date time to UTC time Zone $date = (Get-Date).ToUniversalTime() # call function to get local time $locatTime= Get-LocalTime($date) #get day of week eg. Friday $locatTimeDayOfWeek= ($locatTime).DayOfWeek #get current day of the date eg. if current date is 21 November 2014 09:55:18 then day will be 21 $localTimeDay= ($locatTime).Day #$locatTimeDayOfWeek #$localTimeDay #do not start VM on saturday and Sunday if($locatTimeDayOfWeek -ne “Saturday” -and $locatTimeDayOfWeek -ne “Sunday”) { #$sample = Get-AzureWinRMUri -ServiceName $Using:CloudServiceName -Name $Using:VMName $StartOutPut = Start-AzureVM -ServiceName “democf” -Name “democf” Write-Output $”Virtual Machine democf started.” Write-Output $StartOutPut } elseif($localTimeDay -le 7 -and $locatTimeDayOfWeek -eq “Saturday”) { $StartOutPut = Start-AzureVM -ServiceName “democf” -Name “democf” Write-Output $”Virtual Machine democf started.” Write-Output $StartOutPut } else{ Write-Output “Virtual Machine is not started, because today is not a working day.” } } } Changes in above code Replace VM name with your VM name. Example : Start-AzureVM -ServiceName “democf” -Name “democf” ServiceName : Cloud Service name where vm is located -Name : is actual VM name In our case cloud service name and vm name is same, it can be deferent for other cases. After above changes is completed click on save and test. Check whether code is running perfectly or not. VM will not be start if it is Saturday or Sunday (Requirement). Now we will automate this workflow using schedule Now this workflow will be run every day at 8.30am to auto start VM. Same code auto stop vm using workflow, with small changes. workflow StopVM { param() #connection $MyConnection = “automationconnection” $MyCert = “automationcredential” # Get the Azure Automation Connection $Con = Get-AutomationConnection -Name $MyConnection if ($Con -eq $null) { Write-Output “Connection entered: $MyConnection does not exist in the automation service. Please create one `n” } else { $SubscriptionID = $Con.SubscriptionID $ManagementCertificate = $Con.AutomationCertificateName } # Get Certificate & print out its properties $Cert = Get-AutomationCertificate -Name $MyCert if ($Cert -eq $null) { Write-Output “Certificate entered: $MyCert does not exist in the automation service. Please create one `n” } else { $Thumbprint = $Cert.Thumbprint } #Set and Select the Azure Subscription Set-AzureSubscription ` -SubscriptionName “My Azure Subscription” ` -Certificate $Cert ` -SubscriptionId $SubscriptionID ` #Select Azure Subscription Select-AzureSubscription ` -SubscriptionName “My Azure Subscription” Write-Output “————————————————————————-” Write-Output “Stoping the VM..” # Please type the name of your Domain Controllers inlinescript{ # function to get local time (example Convert UTC tome to Indian Time Zone) Function Get-LocalTime($UTCTime) { $strCurrentTimeZone = ‘India Standard Time’ $TZ = [System.TimeZoneInfo]::FindSystemTimeZoneById($strCurrentTimeZone) $LocalTime = [System.TimeZoneInfo]::ConvertTimeFromUtc($UTCTime, $TZ) Return $LocalTime } #convert date time to UTC time Zone $date = (Get-Date).ToUniversalTime() # call function to get local time $locatTime= Get-LocalTime($date) #get day of week eg. Friday $locatTimeDayOfWeek= ($locatTime).DayOfWeek #get current day of the date eg. if current date is 21 November 2014 09:55:18 then day will be 21 $localTimeDay= ($locatTime).Day #$locatTimeDayOfWeek #$localTimeDay #do not start VM on saturday and Sunday if($locatTimeDayOfWeek -ne “Saturday” -and $locatTimeDayOfWeek -ne “Sunday”) { #$StopOutPut = Start-AzureVM -ServiceName “mkadamvm” -Name $Using:test #$sample = Get-AzureWinRMUri -ServiceName $Using:CloudServiceName -Name $Using:VMName $StopOutPut = Stop-AzureVM -ServiceName “democf” -Name “democf” -Force Write-Output $”Virtual Machine democf Stopped.” Write-Output $StopOutPut } elseif($localTimeDay -le 7 -and $locatTimeDayOfWeek -eq “Saturday”) { $StopOutPut = Stop-AzureVM -ServiceName “democf” -Name “democf” -Force Write-Output $”Virtual Machine democf Stopped.” Write-Output $StartOutPut } else{ Write-Output “Virtual Machine is not started, because today is not a working day.” } } } References 1. http://clemmblog.azurewebsites.net/using-azure-automation-start-und-stop-virtual-machines-schedule/ 2. http://blogs.technet.com/b/keithmayer/archive/2014/04/04/step-by-step-getting-started-with-windows-azure-automation.aspx