At the time of Activate account I want to disable all check-boxes. We have tried to put below code and though its not working.
Would you please let me know is there any other way we can do this?
if (saveMode == "6") {
if (Xrm.Page.ui.getFormType() == 4) {
Xrm.Page.ui.controls.get("new_xyz").setDisabled(true);
Xrm.Page.getAttribute("new_xyz").setSubmitMode("always");
}
}
Thanks,
Vaibhavi P.
*This post is locked for comments
Glad to hear it worked for you, Please make sure to close this thread.
Thanks a lot for all help. I have used Xrm.Page.ui.refreshRibbon(); to refresh ribbon. Finally I am closing this one.
It worked. But somehow my page is refreshing but command bar and footer is not refreshing so is there any way to do this?
Thanks .. I will try this and Let you know on this tomorrow.
Hi,
Your code is missing field check, Below is code to make new_chk disable if account is reactivated, Just tested this code working fine for me
function OnSave(econtext) { var eventArgs = econtext.getEventArgs(); if (eventArgs.getSaveMode()== "5") { Xrm.Page.getAttribute("new_chk").setValue(1); //here you need to use your flag field } if (eventArgs.getSaveMode()== "6") {// to refresh form Xrm.Utility.openEntityForm(Xrm.Page.data.entity.getEntityName(), Xrm.Page.data.entity.getId()); } } function Onload() { var chk=Xrm.Page.getAttribute("new_chk").getValue();// change this with your flag field if(chk==1) //disable checkbox Xrm.Page.ui.controls.get("new_chk").setDisabled(true);//change this with your checkbox that you want to disable }
Let me know if you are facing any issue.
Thanks
This is the code I have implemented on Page Load.
function Form_onload() {
if (HasAdministratorRole()) {
Xrm.Page.getControl("new_xyz").setDisabled(false);
} else {
Xrm.Page.getControl("new_xyz").setDisabled(true);
}
}
This below code I have written on Save.
function Form_onsave(econtext) {
if (econtext != null && econtext.getEventArgs() != null) {
var saveMode = econtext.getEventArgs().getSaveMode();
if (saveMode == "5") { //If Deactivate the Account
//No Code
}
else if (saveMode == "6") {
if (Xrm.Page.ui.getFormType() == 4) { //If Activate the Account
Xrm.Page.ui.controls.get("new_xyz").setDisabled(true);
Xrm.Page.getAttribute("new_xyz").setSubmitMode("always");
}
}
}
}
Please let us know in case you need more Information.
Thanks,
Vaibhavi P
Have you already created this field, I don't see any field checking in your code, share your complete code here and description.
Thanks
Yes that's the issue, Thanks for your suggestion. We are having Disable functionality implemented on Page Load for Check-boxes, So I might be wrong but the solution you gave its the same what I am doing currently.
Do you have any other way? or Do you really think to implement the same way you suggested.
please let me know your thoughts.
Thanks,
Vaibhavi p
Ok,
Thank you for providing more information Vaibhavi, As I understand you want when you reactivate any deactivated account it's checkbox should be disabled only ?? Is this what you want to implement ??
For that you need to keep some flag in account entity (a custom field, you can keep two optionset, let's call it reactivated, which will have two option yes and no) . At the time of reactivate you need to set this flag, you can use workflow to set this flag, once this is set your js code can check if this field is true (onload event) which means this account is reactivated and then your disable checkbox with js code.
Thanks
Thanks for your reply.
On Account Entity in CRM 2013, There is a functionality of Activate / Deactivate Account. So basically when I Deactivate the account and again I activate the same account at that time I want that my all check-boxes should be disable. We have a code where we are enabling / disabling check-boxes. But the same code isn't working for Activate / deactivate scenario. So what I tried that, I have put above mentioned code at the time of Activate the Account but its not working. So i need to know is there any other way I can perform this?
Please let me know in case you need more information or clarification.
Thanks,
vaibhavi P
Stay up to date on forum activity by subscribing. You can also customize your in-app and email Notification settings across all subscriptions.
André Arnaud de Cal... 291,240 Super User 2024 Season 2
Martin Dráb 230,149 Most Valuable Professional
nmaenpaa 101,156