locked
Campaign Response based on Campaign RRS feed

  • Question

  • Hi everyone,

    Within a campaign I have a dropdown box - type A, type B, type C.

    In campaign responses related to that campaign I want to ideally display tabs based on what type of campaign is selected in the campaign. 

    So:
    If the campaign is set as type A, tab A is displayed in the campaign responses; tab B and tab C are hidden. 
    If the campaign is set as type B, tab B is displayed in the campaign responses; tab A and tab C are hidden.
    If the campaign is set as type C, tab C is displayed in the campaign responses; tab A and tab B are hidden.

    How would I go about this?

    Thanks.

    Monday, October 15, 2012 10:51 AM

Answers

  • sorry, please try to use following -

     if ( window.parent.opener.Xrm.Page.getAttribute("campaign_type").getSelectedOption() != null) {
            var _Value = window.parent.opener.Xrm.Page.getAttribute("campaign_type").getValue();

    • Marked as answer by RoarCRM Wednesday, October 31, 2012 1:16 PM
    Monday, October 15, 2012 12:09 PM

All replies

  • Hi,

    use following code :- 

    function HideTabs() {
        if (Xrm.Page.getAttribute("campaign_type").getSelectedOption() != null) {
            var _Value = Xrm.Page.getAttribute("campaign_type").getValue();
            //check corresponding optionset value in field customization
            //assuming Type A's value equal 1
            if (_Value == '1') {
                Xrm.Page.ui.tabs.get("tabnameA").setVisible(true);
                Xrm.Page.ui.tabs.get("tabnameB").setVisible(false);
                Xrm.Page.ui.tabs.get("tabnameC").setVisible(false);
            }
            //assuming Type B's value equal 2
            else if (_Value == '2') {
                Xrm.Page.ui.tabs.get("tabnameA").setVisible(false);
                Xrm.Page.ui.tabs.get("tabnameB").setVisible(true);
                Xrm.Page.ui.tabs.get("tabnameC").setVisible(false);
            }
            //assuming Type C's value equal 3
            else if (_Value == '3') {
                Xrm.Page.ui.tabs.get("tabnameA").setVisible(false);
                Xrm.Page.ui.tabs.get("tabnameB").setVisible(false);
                Xrm.Page.ui.tabs.get("tabnameC").setVisible(true);
            } 


        } 
    }

    Note:- please change the field name and tab names accordingly.


    • Edited by _Vikram Monday, October 15, 2012 12:04 PM
    Monday, October 15, 2012 12:02 PM
  • But the field it is dependent on is in the Campaign entity not the Campaign Response entity?
    Monday, October 15, 2012 12:07 PM
  • sorry, please try to use following -

     if ( window.parent.opener.Xrm.Page.getAttribute("campaign_type").getSelectedOption() != null) {
            var _Value = window.parent.opener.Xrm.Page.getAttribute("campaign_type").getValue();

    • Marked as answer by RoarCRM Wednesday, October 31, 2012 1:16 PM
    Monday, October 15, 2012 12:09 PM