Category Archives: Dynamics 365
Commands to Import .bacpac file to D3FOE SQL Server
Introduction: This blog article will explain how to import a .bacpac file to Microsoft SQL Server which is created from Finance and Operations database that is based on Azure SQL Server. You can refer steps here for creating .bacpac file. Following points are recommended for smooth and secure importing of .bacpac file Take a backup of existing database so you can revert if required. Import the database with a new name and modify it later once the entire process is completed error free. Copy the .bacpac file to local computer where you want to import the database for better performance. Steps: Run command prompt as an administrator. Run the below command to Import the database. cd C:\Program Files (x86)\Microsoft SQL Server\130\DAC\bin SqlPackage.exe /a:import /sf:D:\Exportedbacpac\SSProd.bacpac /tsn:localhost /tdn:SSProd /p:CommandTimeout=1200 where, tsn (target server name) – The name of the SQL Server to import into. tdn (target database name) – The name of the database to import into. The database should not already exist. sf (source file) – The path and name of the file to import from. Update the database: Run the following script against your database to add the users you deleted while creating .bacpac file. Update your database name in Alter Command. CREATE USER axdeployuser FROM LOGIN axdeployuser EXEC sp_addrolemember ‘db_owner’, ‘axdeployuser’ CREATE USER axdbadmin FROM LOGIN axdbadmin EXEC sp_addrolemember ‘db_owner’, ‘axdbadmin’ CREATE USER axmrruntimeuser FROM LOGIN axmrruntimeuser EXEC sp_addrolemember ‘db_datareader’, ‘axmrruntimeuser’ EXEC sp_addrolemember ‘db_datawriter’, ‘axmrruntimeuser’ CREATE USER axretaildatasyncuser FROM LOGIN axretaildatasyncuser EXEC sp_addrolemember ‘DataSyncUsersRole’, ‘axretaildatasyncuser’ CREATE USER axretailruntimeuser FROM LOGIN axretailruntimeuser EXEC sp_addrolemember ‘UsersRole’, ‘axretailruntimeuser’ EXEC sp_addrolemember ‘ReportUsersRole’, ‘axretailruntimeuser’ CREATE USER axdeployextuser WITH PASSWORD = ‘<password from LCS>’ EXEC sp_addrolemember ‘DeployExtensibilityRole’, ‘axdeployextuser’ CREATE USER [NT AUTHORITY\NETWORK SERVICE] FROM LOGIN [NT AUTHORITY\NETWORK SERVICE] EXEC sp_addrolemember ‘db_owner’, ‘NT AUTHORITY\NETWORK SERVICE’ UPDATE T1 SET T1.storageproviderid = 0 , T1.accessinformation = ” , T1.modifiedby = ‘Admin’ , T1.modifieddatetime = getdate() FROM docuvalue T1 WHERE T1.storageproviderid = 1 –Azure storage ALTER DATABASE [<your AX database name>] SET CHANGE_TRACKING = ON (CHANGE_RETENTION = 6 DAYS, AUTO_CLEANUP = ON) GO — Begin Refresh Retail FullText Catalogs DECLARE @RFTXNAME NVARCHAR(MAX); DECLARE @RFTXSQL NVARCHAR(MAX); DECLARE retail_ftx CURSOR FOR SELECT OBJECT_SCHEMA_NAME(object_id) + ‘.’ + OBJECT_NAME(object_id) fullname FROM SYS.FULLTEXT_INDEXES WHERE FULLTEXT_CATALOG_ID = (SELECT TOP 1 FULLTEXT_CATALOG_ID FROM SYS.FULLTEXT_CATALOGS WHERE NAME = ‘COMMERCEFULLTEXTCATALOG’); OPEN retail_ftx; FETCH NEXT FROM retail_ftx INTO @RFTXNAME; BEGIN TRY WHILE @@FETCH_STATUS = 0 BEGIN PRINT ‘Refreshing Full Text Index ‘ + @RFTXNAME; EXEC SP_FULLTEXT_TABLE @RFTXNAME, ‘activate’; SET @RFTXSQL = ‘ALTER FULLTEXT INDEX ON ‘ + @RFTXNAME + ‘ START FULL POPULATION’; EXEC SP_EXECUTESQL @RFTXSQL; FETCH NEXT FROM retail_ftx INTO @RFTXNAME; END END TRY BEGIN CATCH PRINT error_message() END CATCH CLOSE retail_ftx; DEALLOCATE retail_ftx; — End Refresh Retail FullText Catalogs Run the re-provision tool: To ensure Retail components are functional run the re-provision tool. Find steps here on how to run the tool. Start using the new database: Stop the below service to switch the database. World wide web publishing service. Finance and Operations Batch Management Service. Management Reporter 2012 Process Service. Once the services are stopped, rename your original database to ‘AxDB_orig’ and the new database to ‘AxDB’. Restart the service. Conclusion: This is how you can create a new database and import the data from a .bacpac file. If you face any issue then you can switch to original database or restore the copy of original database created prior to import.
Share Story :
[Solved] – Backspace not working in HTML Web Resources
Issue: When we use a HTML web resource in Dynamics 365 CRM forms or even as a separate navigation, we sometimes face issue that Backspace on Text boxes do not work. Why this happens: This happens because in Custom HTML web resources, we add reference to “ClientGlobalContext.js.aspx”. We need this library to gain access to the global context information such as the information specific to the client, organization or user for your Customer Engagement instance* When we use this library, we get issues with backspaces on text boxes where Input type is not “text”. So if the HTML Input type is “number”, “search”, “tel” or anything else Resolution: Resolution 1: This can be solved by changing the Input type as “Text” for all input textboxes. Then backspace will start working. But this may not be applicable in all scenarios, since it will remove some of the functionality that was intended. In that case, you can use Resolution #2 below. Resolution 2: I have been able to resolve this issue by running the following code on DOM ready: if (window.Sys && window.Sys.UI && window.Sys.UI.DomEvent && window.Sys.UI.DomEvent.prototype) { window.Sys.UI.DomEvent.prototype.preventDefault = function() { }; window.Sys.UI.DomEvent.prototype.stopPropagation = function() { }; } This will allow you to still use the functions that ClientGlobalContext provides, while keeping it from interfering with your key and mouse events. Credit: Stefan Boonstra * ClientGlobalContext.js.aspx (Client API reference) Happy CRMing!
Share Story :
Dynamics 365 Tip: Sending Emails using Unified Interface
Introduction: The unified client which was released D365 V9 had a very refreshing UI and lots of features. One of the best features in Unified Interface was Timeline view, but the timeline view did not have ability to send emails. The Unified client has a new Email UI with rich text controls and advanced editor. This was not released till recently. So the new environments after v9.0.1.xx have the ability to send emails using the Unified Client. Now you can send Emails using Unified Client like below: Modern Email Editor: Below are some of the features of new Email Editor: Designer, HTML and Preview tabs will allow users to view and format the content across different form factors. A bunch of controls and features provided like advanced styling, linking, find and replace, and insert images and tables will be made available on the email activity and will allow users to format the email instead of relying on external tools or solutions. Note: The Email Editor is not available on D365 Phone App and App for Outlook. It will show all other activities but not email.
Share Story :
Filtering Records on BPF unlike on Form – D365
Introduction: Working with D365 is best when you’re trying to use as much OOB stuff as possible. Simplest configurations like selecting a view for your Lookup field is easily possible on the D365 Form. However, this is not possible on the fields on the Business Process Flow Use of addPreSearch() and addCustomFilter() on BPF Fields: Now, since you have this field on the BPF and want to add filter to Lookup records, you’ll need to use JS customization to achieve this and add your filter’s criteria in the code to show results as expected. Let’s say you see all the lookup records on the field on the BPF 2. I want to see only Semi Annually type of Plans on the Lead. And I can’t simply do this from the Field’s Properties like on the form. Because, it’s not available. 3. Hence, I’ll write JS code as follows to achieve this: // JavaScript source code var oOFFormCustomization = { preFiltering: function () { “use strict”; if (Xrm.Page.getControl(“header_process_cf_defaultplan”) != null) { Xrm.Page.getControl(“header_process_cf_defaultplan”).addPreSearch(oOFFormCustomization.preSearchProductFamily); } else return; }, preSearchProductFamily: function () { “use strict”; var fetchQuery = ‘<filter type=”and”> <condition attribute=”cf_plantype” operator=”eq” value=”979570001″ /><condition attribute=”statecode” operator=”eq” value=”0″ /></filter>’; Xrm.Page.getControl(“header_process_cf_defaultplan”).addCustomFilter(fetchQuery); } }; 4. And I register the method on Page Load of the Form. 5. And I see these results once it successfully filters!
Share Story :
Filter records in gallery control based on value selected in other gallery control in PowerApps.
Introduction: This blog explains how to Filter records in gallery control based on value selected in other gallery control in PowerApps. Scenario: I am using Dynamics 365 Connection. I have data source named as Time Entry within that data source I have fields named as Projects and Project task and data type of both fields is lookup. Values in Project Task is filtered based on value selected in Project field. Implementation Steps for Filtering Project Task based on Project: We must add Projects and Project Task data source in PowerApps because their data type is Lookup.(If you don’t know how to work with lookup fields Refer: https://www.cloudfronts.com/connect-dynamics-365-use-lookup-field-dynamics-crm-powerapps/ ) Add New screen name it Project Lookup and add gallery control on that screen. Select gallery control and set its item property to:SortByColumns(Search(Filter(Projects,statecode=0 ), TextSearchBox1_1.Text, “cf_name”), “cf_name” ) Add new Screen and name it Project Task Lookup and add gallery control on that screen. Select gallery control and set its item property to:SortByColumns(Search(Filter(‘Project Tasks’, _cf_project_value =Gallery1.Selected.cf_projectid),TextSearchBox1_2.Text,”cf_name”),”cf_name”)here: Gallery1 is the name of gallery control on Project Lookup screen.
Share Story :
Business Process flows process stage name blank in D365 v9 Customer Engagement
Introduction: In this blog, we will demonstrate a way to display the current active stage of a business process flow in views in D365 v9 as the out of box process stage name field does not show any value in the views. Implementation: Step 1: We have created a basic Business Process flow on contacts which has two stages “Basic Information” and “Contact Details”. Step 2: If we want to create a view with the active stage of the business process flow displayed in the column, we first create a new view and in the Record Type we Select Process Stage(Process Stage) and in the columns we select “Process Stage Name” Step 3: Now when we check the view in Contacts we see that the Process Stage Name is blank. Step 4: One workaround for this is to design a Workflow on the Business Process flow entity that was created as shown in the below image . Here “Contact Infor” is the business process flow entity. Step 5: The workflow will be a Real time workflow and will be triggered when process is applied and on change of “processid” field. When the workflow triggers it will copy the name of the field in a new Text field and this can be used in views to display the current Stage as seen below.
Share Story :
Change Tracking for Data Entities in D365 Operations
Introduction: In this blog article, we will see how we can track changes in data made since last export using Data Entities in D365 Operations. It is basically an SQL Change Tracking feature. Steps: Go to Data Management -> Data Entities. Select the Entity for which you want to enable Change Tracking. In the Action Pane, go to Change Tracking. There are 3 options: Enable primary table – It will only track changes made on root table. Enable entire entity – It will enable tracking for all Writable Datasource used in the entities. Enable custom Query – You can create a custom query to track changes on the required tables. You can also disable the change Tracking by clicking on ‘Disable Change Tracking’ option. You should be careful while enabling change tracking as it will require additional processing for maintaining data for changed records.
Share Story :
D365 V9 Alert Dialog
Introduction: This blog explains how to show alerts in D365 V9. Details: We often get requirement to show alerts in D365 V9 Forms and can be achieved using below syntax. Xrm.Navigation.openAlertDialog(alertStrings,alertOptions).then(closeCallback,errorCallback); Example: 1. Alert with no callbacks. var alertStrings = { text: “successfully checkedin.” }; var alertOptions = { height: 120, width: 260 }; Xrm.Navigation.openAlertDialog(alertStrings, alertOptions).then( function () { } ); 2. Alert with callback method. var alertStrings = { confirmButtonLabel: “Yes”, text: “This is an alert.” }; var alertOptions = { height: 120, width: 260 }; Xrm.Navigation.openAlertDialog(alertStrings, alertOptions).then( function success(result) { console.log(“Alert dialog closed”); }, function (error) { concole.log(error.message); } ); Note: Xrm.Utility.alertDialog(message,onCloseCallback) is been deprecated.
Share Story :
Calculated Currency Field doesn’t support Min or Max values
Introduction: This is an observation I made when one of our clients wanted to have a limit on the calculated fields. Let’s say, a lower limit of the currency field that is expected to throw an error (or somehow not allow) the currency going in negative values for a calculated field. Observation: Now, I want to keep the Minimum Value as $0. I’ll keep the Minimum value as 0 so that when I can make it as Calculated Field, the Minimum Value gets locked by $0 I’ve entered. See screenshot below: But, as soon as I make it as Calculated Field and click on Save, this happens- It still appears that I will save it as 0 But, it creates the field, locks the minimum field and then defaults it back to the original minimum value. Bottom line: We cannot have our own Minimum Value on the Calculated Currency fields. But however, I found that this is allowed for other calculated fields. Like the Whole Number.
Share Story :
How to Setup POP3/SMTP email configuration in Dynamics CRM
Introduction: This blog explains how to Setup POP3/SMTP email configuration in Dynamics CRM. Steps to be followed: Step 1: Create new Email Server profile. a. Go to Settings –> Email Configuration –> Email Server Profile. b. Click on +New –> POP3/SMTP server. c. Fill Details in the form. Name: Gmail Incoming Server Location: pop.gmail.com Outgoing Server Location: smtp.gmail.com Now Go in Advanced Tab and Provide this Port values for Incoming and Outgoing Port. Incoming Port: 995 Outgoing Port: 587 d. Save. Step 2: Go to Email Configuration settings and then change Server Profile. Step 3: a. Go to Mailboxes. b. Select the user for whom you want to activate. c. Add following details. Email Address: Enter your Gmail’s Email Address. In Credentials Allow to use Credentials for Email Processing and Provide your Gmail User Name and Password. d. Click on Approve Email e. Click on Test & Enable Mailbox. You may get following error. REASON: Due to hidden settings within Gmail that may be blocking connections from third party apps. SOLUTION: a. Make sure you access these links while logged into the Gmail account, and make sure they’re turned on/enabled. https://www.google.com/settings/security/lesssecureapps https://accounts.google.com/DisplayUnlockCaptcha b. After enabling again go to mailbox and Click on Approve Email and Test & Enable Mailbox. c. Incoming and Outgoing Email Status is Success.