Hello,
I want to implement a JavaScript, which should hide a section within a tab in the Marketing Lists form.
To try to get this work, I made both sections in the form invisible. Also added it the JavaScript into the Form Properties / Event Handlers.
- the "members section" is the default section by Microsoft
- the "members_contacts" is my customized section
- field "createdfromcode" is "Targeted At" in the form or "Marketing List Member Type" in the entity settings
The JavaScript basically should do:
- If the field Targeted At = Account, then show members section and hide members_contacts
- else Targeted At = Contact, then show members_contact section and hide members
But it doesn't work, when loading a Marketing List record, it only throws a "Script Error" message which is not every helpful.
What's wrong with that? Many thanks for any helpful advice!
function showHide() {
var createdfromcode =Xrm.Page.getAttribute("createdfromcode").getValue();
if (createdfromcode == Account) {
Xrm.Page.ui.tabs.get("Summary").sections.get("members").setVisible(true);
Xrm.Page.ui.tabs.get("Summary").sections.get("members_contacts").setVisible(false);
}
else if (createdfromcode == Contact) {
Xrm.Page.ui.tabs.get("Summary").sections.get("members_contacts").setVisible(true);
Xrm.Page.ui.tabs.get("Summary").sections.get("members").setVisible(false);
}
}
*This post is locked for comments