Hi All,
I'm running into an issue with a script error that keeps popping up when the FormOnLoad and OnSave.
We do have JS for RemoveOptionSet in the form, but it has been there for awhile and the issues recently started happening.
I copied the lead entity to test removing the JS from the entity, and it was still happening with it completely removed. I even removed associated fields for it.
I'm not sure what the main cause is. Can anyone point me in the right direction?
Code:
function RemoveOptionIndexFromPicklist(attributeName, value, index)
{
var attrName = attributeName;
if (index != undefined && index != null)
{
attrName = attrName + index;
index += 1;
}
else
{
index = 1;
}
var attrControl = Xrm.Page.getControl(attrName);
if (attrControl != null)
{
try
{
attrControl.removeOption(value);
removeOptionSetValue(attributeName, value, index);
}
catch (e)
{}
}
}
function RemoveOptions()
{
RemoveOptionIndexFromPicklist("leadsourcecode", 1);
RemoveOptionIndexFromPicklist("leadsourcecode", 2);
RemoveOptionIndexFromPicklist("leadsourcecode", 3);
RemoveOptionIndexFromPicklist("leadsourcecode", 4);
RemoveOptionIndexFromPicklist("leadsourcecode", 7);
RemoveOptionIndexFromPicklist("leadsourcecode", 8);
RemoveOptionIndexFromPicklist("leadsourcecode", 9);
RemoveOptionIndexFromPicklist("leadsourcecode", 10);
RemoveOptionIndexFromPicklist("leadsourcecode", 100000001);
RemoveOptionIndexFromPicklist("leadsourcecode", 100000002);
RemoveOptionIndexFromPicklist("leadsourcecode", 100000003);
RemoveOptionIndexFromPicklist("leadsourcecode", 100000004);
RemoveOptionIndexFromPicklist("leadsourcecode", 100000005);
RemoveOptionIndexFromPicklist("leadsourcecode", 100000006);
RemoveOptionIndexFromPicklist("leadsourcecode", 100000007);
RemoveOptionIndexFromPicklist("leadsourcecode", 100000008);
RemoveOptionIndexFromPicklist("leadsourcecode", 100000009);
RemoveOptionIndexFromPicklist("leadsourcecode", 100000010);
RemoveOptionIndexFromPicklist("leadsourcecode", 100000011);
RemoveOptionIndexFromPicklist("leadsourcecode", 100000012);
RemoveOptionIndexFromPicklist("leadsourcecode", 100000014);
RemoveOptionIndexFromPicklist("leadsourcecode", 100000018);
RemoveOptionIndexFromPicklist("leadsourcecode", 100000019);
RemoveOptionIndexFromPicklist("new_leadlevel", 100000004);
RemoveOptionIndexFromPicklist("new_leadlevel", 100000005);
RemoveOptionIndexFromPicklist("new_leadlevel", 100000007);
RemoveOptionIndexFromPicklist("new_leadlevel", 100000008);
RemoveOptionIndexFromPicklist("new_leadlevel", 100000009);
}
*This post is locked for comments