I need the logic below to show certain drop down options when Effective Start Date is > Original Effective Date and then to show different drop down option if Effective Start Date is < Original Effective Date. My Script below isn't working and when I debug it, it doesn't tell me the error.
function YOYonChange()
{
var OriginalEffectiveDate = Xrm.Page.getAttribute("nhs_originaleffectivedate").getText();
var EffectiveStartDate = Xrm.Page.getAttribute("nhs_effectivestartdate").getText();
var YOY = Xrm.Page.getAttribute("nhs_formularytransitionyoymethodology").getValue();
if (EffectiveStartDate == null || EffectiveStartDate =='' || EffectiveStartDate =='undefined')
{
Xrm.Page.getControl("nhs_formularytransitionyoymethodology").clearOptions();
}
else if (EffectiveStartDate > OriginalEffectiveDate)
{
Xrm.Page.getControl("nhs_formularytransitionyoymethodology").clearOptions();
Xrm.Page.getControl("nhs_formularytransitionyoymethodology").addOption({value: 127130000, text: 'Group'});
Xrm.Page.getControl("nhs_formularytransitionyoymethodology").addOption({value: 127130001, text: 'New Client'});
Xrm.Page.getControl("nhs_formularytransitionyoymethodology").addOption({value: 127130004, text: 'Traditional'});
Xrm.Page.getControl("nhs_formularytransitionyoymethodology").addOption({value: 127130002, text: 'Other'});
Xrm.Page.getControl("nhs_formularytransitionyoymethodology").addOption({value: 127130003, text: 'TBD'});
}
else if (EffectiveStartDate < OriginalEffectiveDate)
{
Xrm.Page.getControl("nhs_formularytransitionyoymethodology").clearOptions();
Xrm.Page.getControl("nhs_formularytransitionyoymethodology").addOption({value: 127130000, text: 'Group'});
Xrm.Page.getControl("nhs_formularytransitionyoymethodology").addOption({value: 127130001, text: 'New Client'});
Xrm.Page.getControl("nhs_formularytransitionyoymethodology").addOption({value: 127130002, text: 'Other'});
Xrm.Page.getControl("nhs_formularytransitionyoymethodology").addOption({value: 127130003, text: 'TBD'});
}
}
function YOYOnLoad()
{
YOYonChange()
}
Any help is appreciated.
*This post is locked for comments