Sunday, 3 June 2018

Sitecore experience commerce 9 – No Sitecore Commerce Engine log files?

Leave a Comment
Recently while working with Sitecore experience commerce 9, I’d encountered few issues. To resolve those issue, I need to check logs. While troubleshooting I have found that there were no Sitecore commerce engine log files in log folder. I’d recycle application pool and even restarted IIS but no luck. I’d started troubleshooting with config. json file located at C:\inetpub\wwwroot\CommerceAuthoring_Sc9\wwwroot\ and Bingo! I’d hit the nail right on the head. I’ve compared config.json with default Sitecore.Commerce.Engine config.json file and found out that logging configuration section was missing in config.json. I’ve added below configuration in config.json, given write access on log folder to NetworkService account and application pool identity user (CSFndRuntimeUser), restarted IIS and log files started updating in log folder. I’ve done similar steps for CommerceMinions, CommerceOps and CommerceShops websites.
"Logging": {
    "IncludeScopes": false,
    "LogLevel": {
      "Default": "Information",
      "System": "Warning",
      "Microsoft": "Warning"
    },
    "ApplicationInsightsLoggingEnabled": false
  },
  "Serilog": {
    "Using":  ["Serilog.Sinks.Literate", "Serilog.Sinks.File"],
    "MinimumLevel": {
      "Default": "Information",
      "Override": {
        "Microsoft": "Information",
        "System": "Information"
      }
    },
    "FileSizeLimitBytes": 100000000
  }
Comments and suggestions are most welcome. Happy coding! 
Read More...

Sitecore Experience Commerce 9 installation error: The target principal name is incorrect

Leave a Comment
Recently I have stumbled upon in a situation where Sitecore Experience Commerce 9 update 1 powershell installation script didn’t execute successfully and gave the following error:
Importing DACPAC C:\Sitecore\installscCommerce9u1\deploy\Sitecore.Commerce.Engine.SDK.2.1.10\Sitecore.Commerce.Engine.DB.dacpac
Using SQL Server 140 to import DACPAC
TerminatingError(DeployDacpac): "Exception calling "Deploy" with "3" argument(s): "Could not deploy package.""
Initializing deployment (Start)
The target principal name is incorrect.  Cannot generate SSPI context.
System.Management.Automation.MethodInvocationException: Exception calling "Deploy" with "3" argument(s): "Could not deploy package." ---> Microsoft.SqlServer.Dac.DacServicesException: Could not deploy package. ---> Microsoft.Data.Tools.Schema.Sql.Deployment.DeploymentFailedException: Unable to connect to master or target server 'SitecoreCommerce9_Global'. You must have a user with the same password in master or target server 'SitecoreCommerce9_Global'.
   at Microsoft.Data.Tools.Schema.Sql.Deployment.SqlDeploymentEndpointServer.OnInit(ErrorManager errors, String targetDBName)
   at Microsoft.Data.Tools.Schema.Sql.Deployment.SqlDeployment..ctor(SqlDeploymentConstructor constructor)
   at Microsoft.Data.Tools.Schema.Sql.Deployment.SqlDeploymentConstructor.ConstructServiceImplementation()
   at Microsoft.SqlServer.Dac.DacServices.CreatePackageToDatabaseDeployment(SqlConnectionFactory connectionFactory, IPackageSource packageSource, String targetDatabaseName, DacDeployOptions options, ErrorManager errorManager)
   at Microsoft.SqlServer.Dac.DeployOperation.<>c__DisplayClass3.<>c__DisplayClass5.<CreatePlanInitializationOperation>b__1()
   at Microsoft.Data.Tools.Schema.Sql.Dac.OperationLogger.Capture(Action action)
   at Microsoft.SqlServer.Dac.DeployOperation.<>c__DisplayClass3.<CreatePlanInitializationOperation>b__0(Object operation, CancellationToken token)
   at Microsoft.SqlServer.Dac.Operation.Microsoft.SqlServer.Dac.IOperation.Run(OperationContext context)
   at Microsoft.SqlServer.Dac.ReportMessageOperation.Microsoft.SqlServer.Dac.IOperation.Run(OperationContext context)
   at Microsoft.SqlServer.Dac.OperationExtension.CompositeOperation.Microsoft.SqlServer.Dac.IOperation.Run(OperationContext context)
   at Microsoft.SqlServer.Dac.OperationExtension.CompositeOperation.Microsoft.SqlServer.Dac.IOperation.Run(OperationContext context)
   at Microsoft.SqlServer.Dac.DeployOperation.Microsoft.SqlServer.Dac.IOperation.Run(OperationContext context)
   --- End of inner exception stack trace ---
   at Microsoft.SqlServer.Dac.DeployOperation.Microsoft.SqlServer.Dac.IOperation.Run(OperationContext context)
   at Microsoft.SqlServer.Dac.OperationExtension.Execute(IOperation operation, DacLoggingContext loggingContext, CancellationToken cancellationToken)
   at Microsoft.SqlServer.Dac.DacServices.InternalDeploy(IPackageSource packageSource, Boolean isDacpac, String targetDatabaseName, DacDeployOptions options, CancellationToken cancellationToken, DacLoggingContext loggingContext, Action`3 reportPlanOperation, Boolean executePlan)
   at Microsoft.SqlServer.Dac.DacServices.Deploy(DacPackage package, String targetDatabaseName, Boolean upgradeExisting, DacDeployOptions options, Nullable`1 cancellationToken)
   at CallSite.Target(Closure , CallSite , Object , Object , Object , Boolean )
   --- End of inner exception stack trace ---
   at System.Management.Automation.ExceptionHandlingOps.CheckActionPreference(FunctionContext funcContext, Exception exception)
   at System.Management.Automation.Interpreter.ActionCallInstruction`2.Run(InterpretedFrame frame)
   at System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame frame)
   at System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame frame)
   at System.Management.Automation.Interpreter.Interpreter.Run(InterpretedFrame frame)
   at System.Management.Automation.Interpreter.LightLambda.RunVoid1[T0](T0 arg0)
   at System.Management.Automation.PSScriptCmdlet.RunClause(Action`1 clause, Object dollarUnderbar, Object inputToProcess)
   at System.Management.Automation.PSScriptCmdlet.DoEndProcessing()
   at System.Management.Automation.CommandProcessorBase.Complete()
The target principal name is incorrect.  Cannot generate SSPI context.
I was able to resolve this issue by making below changes in powershell script (Deploy-Sitecore-Commerce.ps1)
  • Set value as CommerceServicesDbServer = "." instead of CommerceServicesDbServer = "./"
  • Set value as SitecoreDbServer = "." instead of SitecoreDbServer = "./"
You may have to update above DbServer values as per your SQL Server configuration. Comments and suggestions are most welcome. Happy coding! 

Read More...

Getting started with Sitecore Rocks

Leave a Comment
This year, I had received opportunity to present at Sitecore NCR user group. I’d presented on extension for Visual Studio - Sitecore Rocks. Sitecore Rocks makes Sitecore developers happy. Sitecore Rocks is free, and it is useful for many other Sitecore development tasks. Here is the recording and slides of this session:


Getting started with Sitecore rocks from Dheer Rajpoot

Comments and suggestions are most welcome. Happy coding!
Read More...

Sunday, 17 September 2017

WFFM : Customizing export form data to excel functionality

Leave a Comment
In previous blog posts, I have explained how to create custom SQL provider and custom save to database action to store form data into SQL database. If you’re interested to know the context of the customization, checkout this blog post. In this blog post, I’ll explain how to customize export form data to excel functionality so that form reports include user’s browser information.

Environment Detail

Sitecore 8.2 update 5 (CMS only mode), Web Forms for Marketers 8.2 rev. 170807

Implementation

I’ve decompiled Sitecore.WFFM.Services.dll assembly to find out the code which invokes export form data to excel functionality.

It seems that we cannot override few methods inside of Sitecore.WFFM.Services.Pipelines.ExportToExcel.ExportFormDataToExcel class. So I created a duplicate copy of this class and added my custom logic to include user’s browser information into form reports.

Add a patch config file to configure custom export to excel functionality:
<configuration xmlns:patch="http://www.sitecore.net/xmlconfig/" xmlns:set="http://www.sitecore.net/xmlconfig/set/">
  <sitecore>
    <pipelines>
       <!--EXPORT TO EXCEL--> 
      <exportToExcel>
        <processor patch:instead="processor[@type='Sitecore.WFFM.Services.Pipelines.ExportToExcel.ExportFormDataToExcel, Sitecore.WFFM.Services']" type="Website.WFFM.Pipelines.CustomExportFormDataToExcel, Website" />
      </exportToExcel>
    </pipelines>    
  </sitecore>  
</configuration>
That's it! Comments and suggestions are most welcome. Happy coding!
Read More...

WFFM : Create custom Save to Database Action

Leave a Comment
In last blog post, I have explained how to create custom SQL provider to store form data into SQL database. If you’re interested to know the context of the customization, checkout the last blog post. In this blog post, I’ll explain how to create a custom save to database action.

Environment Detail

Sitecore 8.2 update 5 (CMS only mode), Web Forms for Marketers 8.2 rev. 170807

Implementation

  1. Create a new SaveToDatabaseAction class and inherit WffmSaveAction class.
  2. Write custom logic to add new FieldData to form field list dynamically while saving form data.

  3. Build the code and deploy assembly in bin folder of your Sitecore instance.
  4. Navigate to Sitecore content tree and create a new Save To Database save action under /sitecore/system/Modules/Web Forms for Marketers/Settings/Actions/Save Actions node.
  5. Add a config patch to specify WFFM connection string.
    <configuration xmlns:patch="http://www.sitecore.net/xmlconfig/" xmlns:set="http://www.sitecore.net/xmlconfig/set/">
      <sitecore>
        <settings>
          <setting name="WFM.ConnectionString" value="wfm" set:value="wffm" />
        </settings>
      </sitecore>  
    </configuration>
  6. Select the relevant WFFM form and add Save To Database action in Save Actions.

  7.  Select the relevant WFFM form and in the Submit section, un-check Save Form Data To Storage checkbox so that form data won’t get saved multiple times into the SQL database.
  8. Publish Sitecore related changes.
In next blog post, I’ll explain how to customize export form data to excel functionality so that form reports include user’s browser information. Comments and suggestions are most welcome. Happy coding!
Read More...