Error while saving a Sitecore Form

On Sitecore 9.0.1 after editing a Sitecore Form in the Form Editor (Canvas) when we are trying to save the form, we are seeing a General Error on the UI – An Error has Occurred, as mentioned in the screen shot below:

While checking the logs we are seeing exceptions below:

System.ArgumentException: Empty strings are not allowed.Parameter name: valueat

Based on our understanding the Empty String Errors were not belong to the fields which are part of the Form and filled in while submitting the form. Rather it seems like a bug/error within Sitecore OOTB DDLs itself.

Here is the way that Sitecore save a form:

  1. A request with the serialized form json data is sent to Sitecore
  2. Sitecore de-serialize the json data and initialize each form model with the data
  3. Save the form based on the model.

Looks like the issue is happening in the 3rd step. Probably one of the de-serialized model doesn’t contain a valid template id (based on the error, it could be empty).

We reached out to Sitecore Support and to troubleshoot the issue they provided us few DLLs and Config to be placed in Bin and ZZZ folder. Also asked us to try to reproduce the issue and provide them the logs with memory dump and Fiddler Sessions.

Based on the logs generated, the serialized page model lack the parent id (The second page you added):

Debug: The current modelWrapper serialized form {"sortOrder":0,"parentId":""

Below is the response we got from Sitecore Support:

The parentId was not there at the beginning. As a result, the problem is on the client side. With further check, we can see that the parentId is determined by client-side form rendering data (or we can say the HTML structure). We can reproduce the issue if we deliberately remove the form field HTML class. As a result, we propose the workaround below:

  1. Please go to your “\sitecore\shell\client\Applications\FormsBuilder\Layouts\Renderings\FormDesignBoard” folder and open the FormDesignBoard.js file.
  2. Find the “getFieldsData: function () {….” section.
  3. Comment out code like below (the fieldData parentId has been set to a valid value before this part):
if (parentContainer.length > 0){
fieldData.parentId ="sc-fielditem-id");}
Else {
//fieldData.parentId = "";}>

We applied the changes and forms are being saved successfully after that. We are still waiting to hear back how it broke all of sudden when there were no changes/customization took place, I will update this blog post based on what I hear back.

If you also face similar issue, please note the problem statement might be same for you but not the root cause. For rate breed issues like this its always recommended to reach out to Sitecore Support for patch or fix like above.

Hope this helps.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

Website Powered by

Up ↑

%d bloggers like this: