Thursday, September 12, 2019

How to Hide/show specific Buttons to the specific users in sitecore

Did you ever get situation like you have to hide some buttons to specific content authors.
There are chances of misusing the functionality of buttons,In our case Detach button on the file need to hide from content authors.The issue are detaching the media file,but they forgot to attach again. because of this issue our media file URL's are throwing 404 errors.So finally we decided to hide the detach button from content authors.they can only see the attach and download on the file.With attach button they can achieve the detach functionality in a efficient way, like if they want to detach they need to attach

if you want to update the media file and to avoid the broken links simply use the Attach/detach functionality.so it's better instead of deleting the Whole file and remove the links,upload new file.

To Hide the Attach/detach buttons Switch to Core database and

ClickàAccess VieweràSecurity EditoràAccountàselect User X/Role X then 
 navigate to the path: /sitecore/system/Field types/System Types/Attachment/Menu/detach
àassignàDeny the Read access.It will look like below.


so once the User X login to the sitecore navigate to the files(medialibrary,files) he will not see the Deatach button.his view looks like below.


Like above you can Hide the EditHtml button also on the path:/sitecore/system/Field types/Simple Types/Rich Text/Menu/Edit Html.

Some users publish the site by clicking the Publish--Publishsite button.if yoiu want to hide publish site button for specific users goto access Viewer for user "X" and navigate to below path on the security editor
/sitecore/content/Applications/Content Editor/Menues/Publish/Publish Site deny the read access.


final his view:


Monday, September 9, 2019

How to add the Field validation rules in sitecore and make it fatal Error


In Sitecore Validation will avoid man made mistakes.
you can control output entering into the field and make particular field is required.
We have Various validation types like Item,Field,Field Types,Global.you can find the validation rules on the path :/sitecore/system/Settings/Validation Rules

so we are talking about the field validation over here:
on the field validation there are 4 types of validations based on the message you are displaying.

Quick action bar-- Runs in the bar to the left of the content tree
Validation Button: whenever you click on the Validation Button, you will see the message on the validation Rules.Navigation path:Select the ItemàReviewàValidationàValidation Rules
Validator Bar: There is a red solid line will display at the field
Workflow: this is for the workflow

Whatever the field on a template you want to make required go to that field in sitecore and expand the validation Rules àQuick Action Bar à add Required,do for all if you want to see error messages on all 4 places.
If you wanna make error level more critical without satisfying the field they can’t save the item.the highest level is FatalError Result=FatalError.

these are the error levels in sitecore, you can find more on sitecore documentation

  • Valid (green) – no action is needed.
  • Suggestion (yellow) – look into the issue and decide if an action is needed.
  • Warning (orange) – act on the issue.
  • Error (red) – this is an error.
  • CriticalError (red) – the warning appears before you save the changes.
  • FatalError (red) – you cannot save the item before the error is corrected.

after you implemented the above steps the fatal error looks like below.whenever you are trying to save the item


How to make Admins can only edit a field in sitecore 9.1

Did you ever get a situation where admins can only edit the field on a item in sitecore. there is a simple solution for that.if you are aware of the roles in sitecore then you should know about Everyone role.


How to make a field Admin Can only edit on the item:

 If you are admin then you will edit the field on the item by Deny the Field Write and Allow the Administrator on the Everyone role. This means you are making a field write by admin. for non-admin users that field is grayed out they cannot edit, but they can only see.