Category Archives: D365 General
Convert Email in Queue to Case (Interactive Service Hub in CRM 2016)
Introduction This blog would help to understand how to create a case from an email in the queue in Interactive Service Hub, CRM 2016. Here the User need not need to create a case Manually for the issue reported in the Email coming in Queue. Ever since using the Interactive Service Hub from the beginning there was a question whether an email can be converted to Case or not? If you open the email in the Service queue, there appears to be no option for converting it to case. Finally, we have found a way wherein you can convert an email to case. Let’s have a look how to do so. Description Steps that we need to follow are shown below. Below snapshot shows all items (emails) in Support Queue. Open the email item. Click on Reply or Reply all. Once we click on Reply, Click on More-> Convert TO -> Case. Enter the Customer Name and Subject to create a new case. Finally the case is created. Enter the mandatory details and save it. Conclusion Finally, we can conclude that the conversion of an email to case in the Interactive Service Hub, CRM 2016 is possible.
Share Story :
Mobility Feature in CRM 2016 – Task Based Experience
Introduction This Blog post tells users about one of the Mobile features in CRM 2016. Task Based Experience enables users to focus on tasks and not on records. So data from multiple entities are brought together as a single user experience. Here user do not have to navigate on multiple entities for performing a single task. Pre-Requisites Under System Settings first user will have to enable this feature. Functionality So, by default users can perform three basic tasks: After Meeting Make Contact on Opportunity Update Contact Whereas if user wants some customized Business Process Flow to be enabled as Task on Mobiles, that can be done by using Task Based Experience feature in CRM 2016. On Mobiles this feature can be used by icon which is present on bottom left hand side as shown below. Let’s see how the default tasks can be used on mobile. 1. After Meeting After Meeting enables users to edit the list of existing appointments or to create a new appointment. For an example the below screenshots shows how to update the existing appointment. 2. Make Contact on Opportunity As the name suggests, this task enable users to update the contact details on existing opportunity list or to create a new opportunity and then add contact details on the newly created opportunity. So, in the screenshot given below, user can update the contact details on the opportunity that was selected. 3. Update Contact Update Contact enable users to edit the contact details that are listed or to simply create a new contact record. Example: Here user can select a contact record and simply update the record. Whereas if a user wants to have a separate Task to be enabled for mobile that can be done by creating a Business Process Flow in CRM 2016. So let’s say if we want to create a Task for ‘Service Case’ on Case Entity. Step 1: Under Processes, create Business Process Flow. Step 2: Add Label, Source and Field Values. Once the Process is ready, save and activate the process. Step 3: User when clicks on icon, here they can see one new task ‘Service Case’ apart from the default tasks that were mentioned earlier. Step 4: Now user can create a case from the enabled process on Case Entity. Note: Task based experiences will be available on phones and tablets as a preview feature for Dynamics CRM Online 2016 customers Conclusion So with task based experience feature in CRM 2016, user can perform tasks from one single point instead of navigating to multiple entities.
Share Story :
Document Generation in Dynamics CRM 2016
In this article, we will review the new and improved out-of-the-box capabilities to generate documents that contain data from CRM records. Users can now create Word and Excel templates for letters, agreements, quotes, invoices and other, in just a single click! Out of the box Templates Out of the box, here are the templates Microsoft includes with the CRM 2016 release Figure 1.0 1 To run the Template you’ll first need to select the appropriate record. For the Account Summary Template, select an Account record and select it from the Action menu. As shown in Figure 2.0 1. Figure 2.0 1 Account (Cloudfronts Technologies LLP) Summary template is generated. Figure 3.0 1 Open the Account Summary.docx file. Figure 4.0 1 Create a new Excel Template Go to Settings – Templates – Document Templates. Click on +New to launch the wizard. Here you can select either Excel or Word templates, the entity and the View. The Edit Columns link provides users a quick way to add columns to the template similar to that of an Advance Find. CRM knows where to display the template file based on the entity selection. If you already have a template, choose Upload, otherwise choose Download to see what CRM created as the Template based on your field selections. Figure 5.0 1 To upload a file we need to just drag & drop in the box and click the upload button Figure 6.0 1 Once the upload is complete, the template record is displayed. Figure 7.0 1 Once you have selected the Template, you also have the ability to set the security roles and control. Figure 8.0 1 Create a Word Template Go to Settings – Templates – Document Templates and click +New. Choose the Word Template, select the entity and press Select Entity button. Figure 9.0 1 A wizard form opens to provide options in navigating across various entities depending on the relationship types. Figure 10.0 1 The relationships you select on this screen determine what entities and fields are available later when you define the Word template. Only select relationships you need to add CRM data to the Word template. Click Download Template on the Select Entity page to create a Word file on your local computer with the exported entity included as XML data. Enable the Developer Tab Open the Word template file. At this point, the document appears to be blank. Figure 11.0 1 For To see and add CRM XML data, you need to enable the Word Developer tab. Go to File > Options > Customize Ribbon, and then enable Developer. Figure 12.0 1 Developer now appears in the Word ribbon. Figure 13.0 1 You use the XML Mapping Pane to add CRM entity fields to your Word template. Be sure to only add fields as Plain Text or Picture. Figure 14.0 1 Define the Word template Use the XML Mapping Pane to define the Word template with CRM entity fields. In your Word template, click Developer > XML Mapping Pane Figure 15.0 1 The default XML schema is selected. Select the CRM XML schema. It will begin with “urn:microsoft-crm/document-template/”. Figure 16.0 1 Expand the CRM entity, right-click the entity field, and then clickInsert Content Control > Plain Text. Figure 17.0 1 The CRM entity field is added to the Word template. Add additional entity fields, add descriptive labels and text, and format the document. A completed template might look like this: Figure 18.0 1 Some content control fields you entered likely have multiple lines of data. For example, accounts have more than one contact. To include all the data in your Word template, set the content control field to repeat. Set content control fields to repeat Put fields with repeating data in a table row. Select the entire table row in the template. In the XML Mapping Pane, right-click the relationship containing the content control fields, and then click. Figure 19.0 1 When you use the Word template in CRM to create a document, the table will populate with multiple rows of data. When the template has the fields and formatting you want, save it and upload it into CRM. Upload the Word template back into CRM When you have your Word template built the way you want, save it so you can upload it into CRM. To use the Word template you’ve created, do the following: Open a record with information you want to create a document. For example, open a customer account record in Sales. ClickMore (…) > Word Templates, and then under Word Templates select the template you created. Once generated, documents can be downloaded and then printed, shared, emailed or collaborated on with Microsoft Office 365
Share Story :
Known issue when using Web API with Alternate key feature
Introduction With the release of Web API, Dynamics CRM now allows developers to build robust solutions and integrations using modern REST APIs consumed through OData. While working on a CRM customization by leveraging the Web API, we found an issue that causes the API to stop working when we use the Alternate Key with the same name as the schema name of a field. This only applies to custom entities. In the section below we have defined the issue and a workaround. Description Recently we were working on a requirement using the CRM web API but we were not able to access the web API using the entity endpoint. When calling the endpoint from the browser, instead of displaying the metadata result in the browser, it generates an error. It simply says that the ‘Object reference not set to an instance of an object’ (we love this error!). This typically happens when during coding we forget to initialize the object. So getting this particular error when calling our endpoint, we were confused. Microsoft has now confirmed that this is a known issue and they will resolve it soon. But for now, the only fix is to delete the key and publish the customization. So we removed the alternate key and generated a new one. This got the endpoint working again! We were not able to understand how an alternate key will stop the web API from working. They ask use to delete the alternate key from the system which we had created recently. As soon as we deleted the key and published the customization we found that the WEB API working. Example: The below screen shots confirm the issue. Step 1: Browse to the Web API endpoint. You can see that it works. Step 2: Define Alternate Key – to replicate the issue we created a field and an alternate key with the same name- Step 3: Browse to the same endpoint – Now when trying to browse to the same endpoint we get the below error- Conclusion So there is a known issue when using Web API and Alternate Key for custom entities. Currently there is no resolution to this issue but to delete the alternate key and have a unique name which does not match with name field ‘s schema name. Hope you found this useful!
Share Story :
Custom Auto Number for Cases
Currently in Microsoft Dynamics CRM, customer service representative creates a case to track a customer request, question, or a problem. All actions and communications can be tracked in the case entity. ID field in Case entity is automatically generated and default format is CAS-00034-Z7M9F7. This kind of Case ID will not be meaningful for many users and there might be a need to create an ID which consists of customer name so that service representative can easily identify the case just by looking at the Case ID. In today’s blog, we will show you how to generate customized Case ID with your own format as per the business requirement. Whenever a case is created Case ID field is automatically generated and lock is acquired on that field. User cannot change the ID generated. In order to achieve a custom generated Case ID we create a plug-in and do customizations in CRM. Here we are considering an example where Account entity is been used. The Case ID generated is like “3-003” where ‘3’ is the unique account number and ‘003’ represents the 3rd case for respective account. When 4th case is created on same account, the counter increases and the Case ID generated will be “3-004”. Thus track can be maintained on cases for different accounts just by seeing the Case ID. In order to get Custom Auto Number on Case Entity follow the below steps: 1) Plug-in: Create a synchronous PRE CREATE plugin on Case entity. The code for case number generation public void Execute(IServiceProvider serviceProvider) { if (serviceProvider != null) { this.context = (IPluginExecutionContext)serviceProvider.GetService(typeof(IPluginExecutionContext)); //// Obtain the organization service reference which you will need for web service calls. IOrganizationServiceFactory serviceFactory = (IOrganizationServiceFactory)serviceProvider.GetService(typeof(IOrganizationServiceFactory)); this.service = serviceFactory.CreateOrganizationService(this.context.UserId); } if (this.context.Depth > 2) { return; } if (this.context.InputParameters.Contains(“Target”)) { if (this.context.InputParameters[“Target”] is Entity) { //// Obtain the target entity from input parameters Entity casenumber = (Entity)this.context.InputParameters[“Target”]; this.CaseNumber_Generation(casenumber); } } } // Case Number generation private void CaseNumber_Generation(Entity casenumber) { Entity result = null; string caseNumber = string.Empty; string accountNumber = string.Empty; string counterValue; int caseCounter; if (casenumber.LogicalName == “incident”) { if (casenumber.Attributes.Contains(“customerid”)) { EntityReference customerId = (EntityReference)casenumber.Attributes[“customerid”]; //// Retrieve related account. QueryExpression customerquery = new QueryExpression(“account”); customerquery.ColumnSet = new ColumnSet(“new_casecounter”, “statecode”, “accountnumber”); customerquery.Criteria.AddCondition(new ConditionExpression(“statecode”, ConditionOperator.Equal, 0)); customerquery.Criteria.AddCondition(new ConditionExpression(“new_casecounter”, ConditionOperator.NotNull)); customerquery.Criteria.AddCondition(new ConditionExpression(“accountid”, ConditionOperator.Equal, customerId.Id)); EntityCollection customerresult = this.service.RetrieveMultiple(customerquery); if (customerresult.Entities.Count > 0) { result = customerresult[0]; accountNumber = result.GetAttributeValue<string>(“accountnumber”); counterValue = result.GetAttributeValue<string>(“new_casecounter”); bool counterResult = int.TryParse(counterValue, out caseCounter); if (counterResult) { caseCounter = caseCounter + 1; } if ((caseCounter >= 1) && (caseCounter < 10)) { caseNumber = string.Format("{0} - 00{1}", accountNumber, caseCounter.ToString(CultureInfo.InvariantCulture)); } else if ((caseCounter >= 10) && (caseCounter < 99)) { caseNumber = string.Format("{0} - 0{1}", accountNumber, caseCounter.ToString(CultureInfo.InvariantCulture)); } //// Case Number update Entity caserecord = new Entity("incident"); caserecord.Id = casenumber.Id; casenumber["ticketnumber"] = caseNumber; //// Case counter in account entity updated Entity accountrecord = new Entity("account"); accountrecord.Id = result.Id; result["new_casecounter"] = caseCounter.ToString(CultureInfo.InvariantCulture); this.Update(result); this.recordguid = caserecord.Id; } } } } // Method for updating any entity. private void Update(Entity caseRecord) { this.service.Update(caseRecord); } 2) Customizations in CRM Add Counter field to the entity whose values you will use in Case ID. Initialize the counter field to 0 Hide the counter field. Example We can consider an example where case number is generated through plugin. Requirement is to create Case Number with respect to the account selected. Whenever a new case is created on that particular account, counter increases and case Id is generated. Create an account with name “Anay Industries”. Account number- Unique identifier for account created. Case Counter- By default it is set as 0. This is hidden field and whenever a new case is created the counter increases by 1. Case ‘Auto number generation’ is created with Customer “Anay Industries” Anay Industries has Account Number- 3 and Case counter-2. When this case is created Account Number is selected and counter is increased by 1. When the record is created Case ID “3-003” is generated where ‘3’ is the Account Number and ‘003’ is the case counter. Conclusion Although our example was simple, you can generate complex case numbers as well by applying a different logic. We hope this have given you a useful information on generating automated Custom Case Number.
Share Story :
Date/Time fields in Microsoft Dynamics CRM 2015 Update 1
The Date and Time data type is used in many times such as Project Start Date, Project End Date, Date of Birth, anniversaries etc. Before the Update, CRM stored all date and time values with the user’s local time zone information. This included User Local format. The system converted the users’ local time zone to Coordinated Universal Time (UTC) for backend storage and then converted the date and time back to the local time zone for display on forms. When Date and Time data type is selected you can select different Behaviour in CRM 2015 Update 1. The need for such update is sometimes date only format caused confusion basically for Birthdays, anniversaries. Users would sometimes see a different day displayed depending on their local time zone. The different Behaviours available in CRM 2015 Update 1 are as follows User Local Date Only format always sets time to 12:00 am Time-Zone Independent format saves in UTC on the backend without converting the time-zone This date/time behaviour are not present in On-premises installation. 1. User Local Behaviour The field values are displayed in the current user’s local time. The Format available for User Local Behaviour is Date Only and Date and Time. Here Project Start Date field is set as User Local You can change the custom entity field’s behaviour from the User Local to Date Only or to Time-Zone Independent. Before changing the behaviour of date and time field, review all the dependencies, to ensure thet there are no issues as a result of changing behaviour. 2. Date Only Behaviour The field values are displayed without the time zone conversion. The time portion of the value is always 12:00AM. The date portion of the value is stored and retrieved as specified in the UI and Web services. The Date Only behaviour can’t be changed to other behaviour types, once it’s set. The Format available for Date Only Behaviour is Date Only. “Date of Birth” field is set to Date only field. 3. Time-Zone Independent behaviour The Time-Zone Independent behaviour can’t be changed to other behaviour types, once it’s set. The concept of a time zone isn’t applicable to this behaviour. The field values are displayed without the time zone conversion. The date and time values are stored and retrieved as specified in the UI and Web services The Format available for Time-Zone Independent Behaviour is Date Only and Date and Time. “Project End Date” field is set to Time Zone Independent Behaviour On change of behaviour effect on existing records 1. When Date of Birth field behaviour is changed to Date only: The Date of Birth field shown here is 9/15/2015 as entered by the user. When this field is retrieved the date/time value returned will be 9/14/2015 06:30:00 PM. Thus the date of birth visible and retrieved is different. In the database UTC date/time is set but in UI it appears different. This value is when the behaviour is user Local behaviour. Retrieve the value of the Date of Birth field and you will get 9/14/2015. Here the date/time value set will be 9/14/2015 12:00:00 AM. When the record was originally created the date entered was 9/15/2015 and I would have expected it to show as 9/15/2015. However, since the change has not been made to the existing records for this field in database, they are still stored in the original UTC format along with the time. It appears that the UTC date/time is picked and the time part is being set as 12:00:00 AM. Thus before changing, make sure about the dependent fields. 2. When Date of Birth field behaviour is changed to Time Zone Independent Here the date and time filed visible is 11/16/2015 8:00 AM. When you retrieve this field the value is 11/16/2015 2:30 AM. Thus the date of birth visible and retrieved is different. In the database UTC date/time is set but in UI it appears different. This value is when the behaviour is user Local behaviour. Retrieve the value of the Date of Birth field and you will get 11/16/2015 2:30 AM. When the record was originally created the date entered was 11/16/2015 8:00 AM and I would have expected it to show as 11/16/2015 8:00 AM. When the field behaviour is changed to time zone independent the time is been changed and data stored in database is picked.
Share Story :
Enhanced Business Process Flow
Enhanced Business Process Flow 2015 Business Process Flow was introduced in Microsoft dynamics CRM in 2013. Business Process Flows in CRM guides users through each step in a defined process to clearly see what steps have been completed, and what needs to happen next. Each stage in a Business Process Flow can be configured to include fields that the business would like to have completed for that stage. This list of fields can include any field available on that entity. These fields can also be represented elsewhere on the form. However, in CRM 2013 Business Process Flows were subject to several limitations Strictly Linear Process: Business processes are designed to work only in linear manner, no branching was allowed. Cannot Revisit The Entity More Than Once: Cannot visit the same entity again in single business process flow. No programmability support Enhanced Business Process Flow in CRM 2015 The improvement made to Business Process Flow functionality is the ability to deploy conditional logic within a defined process, (called Branches). Steps and stages can be configured easily where branching rules are defined. Selection of entity relationships – It can be optional. Branching supports – Single entity, cross entity and also supports multiple entity loops. Entity used in Business Process Flow can be revisited multiple times. Programmability through client API: Programmatically updates process state and hooks on to process events. Let’s implement these improvements in an example, consider a scenario were EazyApp Is a facetious Company which sells Software as a product. The request EazyApp receives on daily basis gets classified as leads, some of them get Qualified if they are further interested in evaluating the trial of the software and also the budget amount is greater than or equal to $5000, if not, then the lead gets disqualified. Once a lead Is interested in Trial and the budget amount is greater than or equal to $5000, the lead gets Qualified and an Opportunity gets created. Once the trial is completed, a new question is asked whether a Quote is required. If no, we close the Opportunity but if it is a yes, we create a quote and deliver the quote. After that, we offer maintenance for the product, if the Opportunity is interested in maintenance, we update the quote, and otherwise we close the opportunity. The following diagram shows a business process flow with branches. Before Designing Business process flows with Branches for EazyApp take a note of the following Information: A process can span across a maximum of 5 unique entities. You can use a maximum of 30 stages per process and a maximum of 30 steps per stage. Each branch can be no more that 5 levels deep. Branching rule must be based on the steps in the stage that immediately precedes it. You can combine multiple conditions in a rule by using the AND operator or the OR operator, but not both operators. An entity used in the process can be revisited multiple times (multiple closed entity loops). You can go back to the previous stage regardless of an entity type. For example, if the active stage is Deliver Quote on a quote record, you can move the active stage back to the Propose stage on an opportunity record. Only one active process per a record is possible. The stages can be reordered using the MOVE UPor MOVE DOWN arrows within the branch. The stages can’t be moved from one branch to other branches. Let’s look at the example of the business process flow with branches, for EazyApp selling Software as a product. First, we’ll create a new process named EazyApp Business Process Flow. Go to Settings > Processes. Specify the Category as Business Process Flow and for the primary Entity choose Lead. Add the first stage to the process called Qualify and add steps Purchase Time frame and Is Interested in Trial. After the common Qualify stage, we split the process into to two separate branches, by using the If-Else clause. Notes To add the first branch for a stage, choose Add branch below the stage and specify the If condition. To add the second branch for the same stage, choose Add branch again, below the same stage. The Else clause will be displayed. You can choose Else, to convert it to Else-If, if you have more than two branches from the same stage, or if you want to enter a branch only when certain conditions are satisfied. Choose the green square + (plus) button under the branching rule, to add another condition to the rule. Choose the + Insert stage button to insert a stage at the beginning of the branch. If the Is Interested Trial = Yes & Budget Amount is greater than or equal to $5000 the process branches out to the Trial stage, otherwise, it jumps to the Close stage, in the second branch, as shown below. As you can see above, it will apply ‘if’ criteria to check condition, where we can specify field criteria and save the condition. Once it is saved, it will allow you to insert stage on that basis as shown below. It also allows to add else condition if the criteria to flow the process in another direction is not fulfilled. You can combine multiple conditions using and/or branching techniques as shown above. Here, it will also allow you to set relationship with another entity. If no relationships exist, then you can set it to none. Likewise, you can create complete Business Process Flow and it can be used as shown below: Likewise, you can create a complete Business Process Flow and it can be used as shown below: As you can see below, it currently shows only two stages ‘Qualify’ and ‘Close’ and the step ‘Is Interested in Trial’ shows value as No. If you select ‘Is Interested in Trial’ as yes & Budget amount more than or equal to $5000, it will change the flow with additional stages as shown below: Similarly, after qualifying the lead, it will go to another stage where if you select ‘Quote required’ as yes, it will show some additional stages as ‘Deliver Quote’, ‘Offer Maintenance’ etc. as shown below: This is how you can include business process flow … Continue reading Enhanced Business Process Flow
Share Story :
Filters available in AX 2012
Filters plays a very important role in getting the data in a fast and easy manner. AX is designed in such a way that the filters can be used on all the forms. The user can filter the data by providing syntax in the filter field available on the form or by clicking Ctrl+ G. When the user clicks Ctrl+G, a new row is created below the column header of the grid. The following filtering and query options are available when you use embedded filters or queries. Syntax – Value Character Description – Equal to the value entered Description – Type the value to find. Example – Alex finds “Alex”. Syntax – !Value Character Description – Not Equal to the value entered Description – Type an exclamation mark in front of the value to exclude. Example –!Alex finds all values except “Alex” Syntax – From-value..To-value Character Description – Between the two values entered separated by double periods. Description – Type the From value, then two periods, and then the To value. Example – 10..30 finds all values from 10 to 30. Syntax – ..value Character Description – Less than or equal to the value entered Description – Type the two periods and then the value. Example – ..50 finds any number less than or equal to 50. Syntax – .. Character Description – Greater than or equal to the value entered. Description – Type the value and then the two periods Example – 50.. finds any number greater than or equal to 50. Syntax – >value Character Description – Greater than the value entered. Description – Type a greater than sign (>) and then the value. Example – >20finds any number greater than 20 Syntax – <value Character Description – Less than the value entered. Description – Type a less than sign (<) and then the value. Example – <50 finds any number less than 50 Syntax – value* Character Description – Starting with the value entered. Description – Type the starting value and then an asterisk. Example – S* finds any string that starts with S Syntax – *value Character Description – Ending with the value entered. Description – Type an asterisk and then the ending value. Example – *ltd finds any string that ends with ltd. Syntax – *value* Character Description – Contains the value entered. Description – Type an asterisk, then a value, and then another asterisk. Example – *pvt* finds any string that contains pvt. Syntax – ? Character Description – Having one or more unknown characters. Description – Type a question mark at the position of the unknown character in the value. Example – Sa??abh finds “Saurabh” Syntax – value,value Character Description – Matching the values entered separated by commas. Description – Type all your criteria separated by commas. Example – 30,80 finds exactly “30” and “80”. Syntax – T Character Description – Today’s date Description – Type “T” Example – Enter T and click Tab/Enter, it will bring todays date. The above provided syntax are very useful in day to day activities in AX. User can use the syntax in combination also, by using “&” syntax.
Share Story :
Connect to an external database using X++ code in AX 2012
Below are the steps to be performed, To connect to an external database using ODBC connection, first create a DSN. To create a DSN refer the link https://support.microsoft.com/en-us/kb/300596 Write the below code: Note : The database login credentials are given in the DSN. You can use windows credentials or provide SQL credentials, if required. In the above code, the below lines of code will initialise the connection to the database. sq = new SqlSystem(); loginProperty = new LoginProperty(); loginProperty.setDSN(/*your dsn name here*/); loginProperty.setDatabase(/*your database name here*/); oDBCConnection = new ODBCConnection(loginProperty); The below lines of code will execute the query and store the data in a resulSet. sqlStmnt = strFmt(“select * from ABC”); //write your query here statement1 = odbcConnection.createStatement(); perm1 = new SqlStatementExecutePermission(sqlStmnt); perm1.assert(); myResult1 = statement1.executeQuery(sqlStmt1); We can also execute the stored procedures in the database. Write the below code to do so. odbcConnection = new OdbcConnection(loginProperty); sqlStmt1 = strFmt(“exec [Stored Procedure name]”); perm = new SqlStatementExecutePermission(sqlStmt1); perm.assert(); statement1 = odbcConnection.createStatement(); statement1.executeUpdate(sqlStmt1); CodeAccessPermission::revertAssert(); Suppose you execute more than one stored procedure in the same code, you may get below error. “SQL error description: [Microsoft][ODBC SQL Server Driver]Connection is busy with results for another hstmt” To eliminate this error, write below statement after every stored procedure is executed, statement1.close(); If there are multiple external databases on different servers, then you can create separate DSN to connect to each server. This connection information can be stored in a master table containing the DSN name, the database name. The X++ code can then use the connection details from the master table as shown below. loginProperty = new LoginProperty(); loginProperty.setDSN(masterTable.databseName); loginProperty.setDatabase(masterTable.databseName);
Share Story :
Solutions to Frequent JavaScript Errors in CRM 2015 Update 1
In this Blog we will walk-through how to resolved CRM 2015 update 1 JavaScript Errors. Below is list of common errors. 1. ‘$ is not defined’ or ‘jQuery is not defined’ Description: You will get above error if you have ever used jQuery function in your JavaScript code. In earlier version of the CRM, we can able to access jQuery library directly but with the new form rendering engine it is not possible to access jQuery library. Resolution: Include jQuery library in your Entity Form Libraries. 2. Behaviour changed for Tab (open/close). Description: Please refer below example Ex. Read state of the Tab (onTabChanged) Below function will return different result based on Legacy/Turbo form Xrm.Page.ui.tabs.get(_tabName).getDisplayState() User Action Legacy Form Turbo Form Tab Close collapsed expanded Tab Open expanded collapsed 3. Cannot read property ‘getAttribute’ of null (Specific to Product Form) Steps to reproduced: Add new product Navigate to products Click on ‘View the data that will be sent to Microsoft’ Description: Error is encountered because CRM internally trying to access any fields which is not present of the form. By doing more researched I found that ‘Valid To’ and ‘Valid From’ field is required on the Form (Turbo Form rendering engine). Resolution: Please follow the below steps Add ‘Valid To’ and ‘Valid From’ in the form Hide both the field and lock this field on the form 4. + button is not working for Opportunity Product SubGrid on Opportunity form Description: Same problem with Quote/Order product SubGrid view. It is basically product bug in 2015 update 1. Resolution: Add custom HTML web resource for + sign and hide exiting one. Please find below steps to resolved this issue. Hide exiting SubGrid + sign using Ribbon workbench. Add HTML web resource for + sign. You can refer below code. <html> <head> <meta charset="utf-8" /> <title></title> <style> #plusSign { float: right; margin-top: 18px; cursor: pointer;” } </style> <script type="text/javascript" src="ClientGlobalContext.js.aspx"></script> <script> var GridCustomization = GridCustomization || {}; GridCustomization.data = {}; GridCustomization.parameterObject = {}; GridCustomization.openProductForm = function () { Xrm.Utility.openEntityForm(GridCustomization.data.EntityLogicalName, null, GridCustomization.parameterObject); }; GridCustomization.onLoad = function () { GridCustomization.data = {}; GridCustomization.parameterObject = {}; var id = GridCustomization.getQuerystring("id"); var plusSignAttribute = document.getElementById("plusSign"); if (plusSign && !id) { plusSign.disabled = true; return; } id = id.replace("%7b", "").replace("%7d", ""); id = id.replace("{", "").replace("}", ""); var entityNames = GridCustomization.getQuerystring("data"); var entityLogicalName, entitySchemaName, formToBeOpen; if (entityNames) { var tempArray = entityNames.split("%2c"); if (tempArray && tempArray.length === 2) { entityLogicalName = tempArray[0].toLowerCase(); entitySchemaName = tempArray[0]; formToBeOpen = tempArray[1]; } else { Xrm.Utility.alertDialog("Entity Name is not provided.", null); return; } } GridCustomization.data = { EntityLogicalName: formToBeOpen }; ///current record cab be Opportunity/Quote/Order var currentRecord = GridCustomization.retrieveRecord(id, entitySchemaName); if (currentRecord) { var entityLogicalNameId = entityLogicalName + "id"; GridCustomization.parameterObject[entityLogicalName + "id"] = id; GridCustomization.parameterObject["dynad_currencyid"] = currentRecord["TransactionCurrencyId"] ? currentRecord["TransactionCurrencyId"]["Id"] : null; GridCustomization.parameterObject["dynad_currencyidname"] = currentRecord["TransactionCurrencyId"] ? currentRecord["TransactionCurrencyId"]["Name"] : null GridCustomization.parameterObject["transactioncurrencyid"] = currentRecord["TransactionCurrencyId"] ? currentRecord["TransactionCurrencyId"]["Id"] : null; GridCustomization.parameterObject["transactioncurrencyidname"] = currentRecord["TransactionCurrencyId"] ? currentRecord["TransactionCurrencyId"]["Name"] : null; if (currentRecord["OrderNumber"]) { GridCustomization.parameterObject["dynad_ordernumber"] = currentRecord["OrderNumber"]; } } } GridCustomization.getQuerystring = function (key) { var work = key.replace(/[\[]/, "\\\[").replace(/[\]]/, "\\\]"); var regex = new RegExp("[\\?&]" + work + "=([^&#]*)"); var qs = regex.exec(window.location.href); if (qs == null) return null; return qs[1]; } GridCustomization.retrieveRecord = function (id, entityName) { "use strict"; var req = new XMLHttpRequest(); req.open("GET", encodeURI(Xrm.Page.context.getClientUrl() + "/XRMServices/2011/OrganizationData.svc/" + entityName + "Set(guid’" + id + "’)"), false); req.setRequestHeader("Accept", "application/json"); req.setRequestHeader("Content-Type", "application/json; charset=utf-8"); req.send(null); var data = JSON.parse(req.responseText); if (data && data.d) { return data.d; } else { if (data.error) { alert(data.error.message.value); } } return null; } GridCustomization.getLookupId = function (lookupObject) { if (!lookupObject && !lookupObject.Id) { return null; } return lookupObject.Id; } </script> </head> <body onload="GridCustomization.onLoad()"> <img src="/_imgs/ribbon/NewRecord_16.png" alt="New Line Item" onclick="GridCustomization.openProductForm()" id="plusSign"> </body> </html> Pass parameter to HTML Web Recourse Ex. Schema name of opportunity and logical name of opportunity product. Opportunity,opportunityproduct Make sure checkbox for object-type code and unique identifier as parameter is checked. Register below function onSave event of Opportunity Entity Form to reload HTML web resource for first time when Record is created. function reloadHTMLResource() { if (Xrm.Page.ui.getFormType() === 1) { var iInterval = setInterval(function () { if (Xrm.Page.data.entity.getId()) { clearInterval(iInterval); //reload PlusSign var plusSignControl = Xrm.Page.ui.controls.get(“WebResource_SubGridPlusSign”); if (plusSignControl) { plusSignControl.setSrc(Xrm.Page.context.getClientUrl() + “//WebResources/dynad_SubGridPlusSign?data=Opportunity%2copportunityproduct&id=” + Xrm.Page.data.entity.getId()); } } }, 1000); } }; Note: Kindly replace below text with appropriate value dynad_SubGridPlusSign?data=Opportunity%2copportunityproduct : %2c indicate punctuation mark (,) to split two entity name WebResource_SubGridPlusSign : name of HTML web resource added on the form.