Notifications
Announcements
No record found.
Is it possible to loop through all the attributes and make them Readonly except any one attribute after clicking on a ribbon button ?
*This post is locked for comments
Hi,
You could try registering the following Javascript function on click of the ribbon button.
function MakeAttributesReadOnlyExceptOne(){ Xrm.Page.data.entity.attributes.forEach( function (attribute, index) { var attributeName = attribute.getName(); if (attributeName == "FieldLogicalName"){ //The field which you do not need to make read only Xrm.Page.getControl(attributeName).setDisabled(false); } else{ Xrm.Page.getControl(attributeName).setDisabled(true); } }); }
Hope this helps.
I had implemented a scenario where all the fields on the form were made read-only after the record created. Please check the below code.
function disableAllFields() {
var formType = Xrm.Page.ui.getFormType();
if(formType!=1)
{
Xrm.Page.data.entity.attributes.forEach(function (attribute, index) {
var control = Xrm.Page.getControl(attribute.getName());
if (control) {
control.setDisabled(true)
}
});
Thanks,
Amit Kumar Rath.
MS CRM Consultant
Thanks Sir..It helped!!
Sir @Nithya Gopinath , Can you please clear me a doubt?
@CRM Beginner, Definitely I will try to clear your doubt.
Sir, if i want that on change of an attribute value, my ribbon button 'Submit' and +New gets invisible and if i use the same entity with the other login, then i can have one more attribute apart from the previous attributes.How is it achieved?
Can you explain your scenario in more detail?
I have a submit ribbon button on a form which i want to hide after i click on it.As on its click,my status attribute value gets "Closed" for the particular entity. So,i want whenever the status value is "Closed ", for that particular records, the "Submit" as well as "New" buttons should not be visible.
You could use the Value Rule (in Enable rule) in Ribbon Workbench to hide the ribbon buttons based on the field value in Dynamics CRM.
See the links below.
ribbonworkbench.uservoice.com/.../121427-enable-disable-a-ribbon-button-dynamically-based-o
missdynamicscrm.blogspot.in/.../show-hide-ribbon-based-on-specific-form-in-multiple-forms-crm.html
Yes Sir, it worked.Thanks alot!
Want one more favour. Can u suggest me how to hide a '+' symbol displayed with a custom view present in dashboard if we have more than one custom views in a dashboard and want to hide the '+' of only one view?
Under review
Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.
As AI tools become more common, we’re introducing a Responsible AI Use…
We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…
These are the community rock stars!
Stay up to date on forum activity by subscribing.
SA-08121319-0 4
Calum MacFarlane 4
Alex Fun Wei Jie 2