Hi All,
2 fields is present in case owner lookup & pending with lookup to contact.In form owner field visibility marked as unchecked & pending with field visibility marked as checked.I have bpf on case & in bpf option set field Action there based on Action am show hiding these 2 fields.but sometimes its working when using BR & in js its giving undefined where i am showing d field.In BR also making these 2 fields locking if it contains data.
what could be d prblm hide show not working properly.
Below code using on load & on change of action but ShowHideField(formContext, "ownerid", true); show hide not working instaed showing undefined if using BR its working then again it fails for other options.
function lockBLStageFields(executionContext) {
try {
var formContext = executionContext.getFormContext();
var formLabel = formContext.ui.formSelector.getCurrentItem().getLabel();
if (GetFormType(formContext) == '2' && formLabel == "Case Overview - G&E") {
if (formContext.getAttribute("mdc_action") != null)
var action = formContext.getAttribute("mdc_action").getValue();
if (action == null) {
EnableDisableField(formContext, "header_process_mdc_businessleader", true);
EnableDisableField(formContext, "header_process_mdc_approvedby", true);
EnableDisableField(formContext, "header_process_mdc_approvaldate", true);
EnableDisableField(formContext, "header_process_mdc_businessleadercomments", true);
EnableDisableField(formContext, "header_process_mdc_additionalinformation", true);
//SetRequirementLevel(formContext, "mdc_businessleadercomments", "none");
this.reset(executionContext);
} else if (action == 755040000) //Approve
{
//EnableDisableField(formContext, "header_process_mdc_action", true);
EnableDisableField(formContext, "header_process_mdc_businessleader", true);
EnableDisableField(formContext, "header_process_mdc_approvedby", true);
EnableDisableField(formContext, "header_process_mdc_approvaldate", true);
EnableDisableField(formContext, "header_process_mdc_businessleadercomments", false);
EnableDisableField(formContext, "header_process_mdc_additionalinformation", false);
//SetRequirementLevel(formContext, "mdc_businessleadercomments", "required");
setTimeout(function(){
formContext.ui.controls.get("ownerid").setVisible(true);
formContext.ui.controls.get("mdc_pendingwith").setVisible(false);
}, 3000);
//ShowHideField(formContext, "ownerid", true); //Show Owner
//ShowHideField(formContext, "mdc_pendingwith", false);
} else if (action == 755040001) //Decline
{
//EnableDisableField(formContext, "header_process_mdc_action", true);
EnableDisableField(formContext, "header_process_mdc_businessleader", true);
EnableDisableField(formContext, "header_process_mdc_approvedby", true);
EnableDisableField(formContext, "header_process_mdc_approvaldate", true);
EnableDisableField(formContext, "header_process_mdc_businessleadercomments", false);
EnableDisableField(formContext, "header_process_mdc_additionalinformation", false);
ShowHideField(formContext, "mdc_pendingwith", true);
ShowHideField(formContext, "ownerid", false);
} else if (action == 755040002) //Request Clarification
{
//EnableDisableField(formContext, "header_process_mdc_action", true);
EnableDisableField(formContext, "header_process_mdc_businessleader", true);
EnableDisableField(formContext, "header_process_mdc_businessleadercomments", false);
EnableDisableField(formContext, "header_process_mdc_approvedby", false);
EnableDisableField(formContext, "header_process_mdc_approvaldate", false);
EnableDisableField(formContext, "header_process_mdc_additionalinformation", false);
}
}
} catch (error) {
var errorOptions = {
details: "Error in CaseOverviewGE js, Method Name:lockBLStageFields().Download Error log file",
errorCode: 13,
message: error.message
};
Xrm.Navigation.openErrorDialog(errorOptions);
}
}
Thanks,
Jharana