Surendra Sharma

Surendra Sharma

Search This Blog

Tuesday, October 29, 2019

Multilist in Sitecore JSS App

For the list data, Sitecore JSS offering "ContentList" as a field datatype. When you deploy it in Sitecore, it converts into "Treelist".

But what to do if you need "Multilist" instead of Treelist at Sitecore side?

Solution:
 

You have to specify "MultiList" as a string type when you define the Sitecore field definition for the component as

name: 'content'type: CommonFieldTypes.RichText },
name: 'articleList'type: 'MultiList'},

As you can notice here I defined "ArticleList" field as a "MultiList" datatype.

You can also set the datasource or query with this Multilist field definition as


name: 'articleList'type: 'MultiList'source: `query:./Articles/*`, },

Here I have set the datasource as a child folder "articles" of current Sitecore context item.

I hope this quick tip help you in Sitecore JSS App development.

Wednesday, October 23, 2019

Problem with Sitecore GraphQL on Azure

We have deployed JSS App on Sitecore instance running on Azure.

For one of the component we are using GraphQL which is perfectly working on local machine.


But when we deploy it on Azure our GraphQL query was not returning anything.

Our query was


var query = `{
search(fieldsEqual: [{name: "_fullpath",
value: "/sitecore/content/myjssproj/Content/BlogsCollection/ContentListField/*"}
])

As you can note, we have used "fieldsEqual" parameter and pass the name and value. You will get this query result on your local machine but this is not going to work on Azure.

I think this is because we are using "Azure Search" and Azure have limitation of 1000 fields index. It may be possible that Azure search not indexed system fields.

So if you want to use Azure Search with GraphQL you should rewrite your query with "rootItem" parameter as


var query = `{
search(rootItem: "/sitecore/content/myjssproj/Content/BlogsCollection/ContentListField/*"
)

Other alternative is to use SOLR as a search on Azure. I find this link is very simple and handy to install SOLR on azure.

Fix : Sitecore error - The type initializer for 'System.Drawing.ToolboxBitmapAttribute' threw an exception.

Our Sitecore website was running fine on Azure. But one day when we tried to open Content Editor, we started to receive error "The type initializer for 'System.Drawing.ToolboxBitmapAttribute' threw an exception."

As we have to update the content urgently and our Content editor was unable to update any content, so for the time being we updated those content from "DB browser" screen by accessing https://mysc.azurewebsites.net/sitecore/admin/dbbrowser.aspx.

However this was temporary solution, we have to resolve this issue anyway.


Solution:- 

Somewhere on web I read that the cause of this type of error is temp files on server.

As our instance was running on Azure, so we updated web.config file by editing some comment in the hope that it will recycle the app pool but this trick did not worked.


Next thing we tried to "Restart" the web app and once app was up, our content editor able to access content editor and updated content successfully.


I think App service restart operation removed those temp files and fixed the issue.

Sunday, October 13, 2019

eBook : Sitecore xDB to xConnect

Sharing my new eBook with Sitecore community - "Sitecore xDB to xConnect".

You can read and download this ebook from here:



I hope you like this eBook.

Please leave your comments or share this eBook if it’s useful for you.