When I was trying to remove the "status code" value using java script. It is showing the following error.
"Object doesn't support property or method 'removeOption'" . Add/Remove option for the status code option set is not working. Please let me know if there is any other way to remove the values..?
This issue is only with CRM 2015 online Update 1.
Can any one help me please..?
*This post is locked for comments
Status Reason Transitions existed prior to 2015 update 1. I'm having the exact same issue after upgrading our CRM 2015 to CRM 2016 (on premise) on the Account entity.
I'm having the same issue and can replicate exactly what you are seeing. I think that 2015 (or 2015.1) changed the way that status reasons are handled and added in the "Status Reason Transitions" for this. The status reason field looks like an optionset, but it will not allow Optionset Control Methods.
Status reason transitions are really pretty cool, I'd suggest using them anyway.
hello,
I have gone through this, but I didn't get a solution.
I just want to remove one of the option set value of an option set called "Status Reason" it s back end name is "statuscode".
hello,
read this it will help you:
Hi Hamzeh,
I tried with this function which is not working in CRM 2015 Update1. By using this code we can remove the normal option set value, but not able to add or remove "Status Reason" values.
dear Abhiram Thulasi
try this code below:
Remove Optionset Value at Runtime – MS CRM 2011
Create Js webresource with below code:
function removeOptionSetValue(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()
{
removeOptionSetValue(“optionsetname”,value, null);
}
so it will remove the value from optionset.
Hi Guido Preite,
Thanks for you replay.
Please find the following code.
function hideConfirmedStatus() {
var picklistType = "statuscode";
var picklistTypeName = Xrm.Page.getControl(picklistType);
var picklistTypeAttribute = picklistTypeName.getAttribute();
var picklistTypeSelectedOption = picklistTypeAttribute.getSelectedOption();
var statusCode = Xrm.Page.getControl("statuscode").getAttribute().getSelectedOption();
var picklistMode = "md_mode";
var picklistModeName = Xrm.Page.getControl(picklistMode);
var picklistModeAttribute = picklistModeName.getAttribute();
var picklistModeSelectedOption = picklistModeAttribute.getSelectedOption();
var picklistModeSelectedText = "";
if (picklistModeSelectedOption != null) {
picklistModeSelectedText = picklistModeSelectedOption.text;
}
var Amount = Xrm.Page.getAttribute("md_amount").getValue();
if (statusCode != null) {
statusCodeText = statusCode.text;
}
if (statusCodeText != 'Confirmed') {
picklistTypeName.removeOption(899230002);
}
var opt2 = new Option();
opt2.text = "Confirmed";
opt2.value = 899230002;
//alert(Xrm.Page.data.entity.attributes.get("md_unitsaleid").getValue());
if (picklistModeSelectedText != "") {
if ((picklistModeSelectedText != "Payable Adjustment") && (picklistModeSelectedText != "Fund Transfer")) {
if ((Amount == 0) || (Amount == null)) {
}
else if (statusCodeText != "Confirmed") {
if ((Xrm.Page.data.entity.attributes.get("md_fromunitsaleid").getValue() != null) || (Xrm.Page.data.entity.attributes.get("md_unitsaleid").getValue() != null) || (Xrm.Page.data.entity.attributes.get("md_unitleasingid").getValue() != null) || (Xrm.Page.data.entity.attributes.get("md_contact").getValue() != null) || (Xrm.Page.data.entity.attributes.get("md_corporatecustomerid").getValue() != null)) {
picklistTypeName.addOption(opt2);
}
}
}
else {
if ((Xrm.Page.data.entity.attributes.get("md_fromunitsaleid").getValue() != null) || (Xrm.Page.data.entity.attributes.get("md_unitsaleid").getValue() != null)) {
if (statusCodeText != "Confirmed") {
picklistTypeName.addOption(opt2);
}
}
}
}
if (picklistModeSelectedText == "Payable Adjustment") {
var lookupObject = Xrm.Page.getAttribute("md_payableid");
if (lookupObject != null) {
var lookUpObjectValue = lookupObject.getValue();
if ((lookUpObjectValue == null)) {
picklistTypeName.removeOption(899230002);
}
}
}
if (picklistModeSelectedText == "Fund Transfer") {
var formType = Xrm.Page.ui.getFormType();
var serverUrl = Xrm.Page.context.getClientUrl();
//var customServerURL = document.location.protocol + "//" + document.location.host + "/" + Xrm.Page.context.getOrgUniqueName();
//if(serverUrl != customServerURL)
//{
//serverUrl = customServerURL ;
//}
var ODataPath = serverUrl + "/XRMServices/2011/OrganizationData.svc";
if (formType != 1) {
var receiptid = Xrm.Page.data.entity.getId();
var retrieveReq = new XMLHttpRequest();
var filter = "/md_fundacquisitionSet?" +
"$select=md_fundacquisitionId" + "&$filter=md_Receipt/Id eq guid'" + receiptid + "'";
retrieveReq.open("GET", ODataPath + filter, false);
retrieveReq.setRequestHeader("Accept", "application/json");
retrieveReq.setRequestHeader("Content-Type", "application/json;charset=utf-8");
retrieveReq.send(null);
var retrievedRecords = JSON.parse(retrieveReq.responseText).d;
if (retrievedRecords.results.length > 0) {
}
else {
picklistTypeName.removeOption(899230002);
}
}
else {
if ((Xrm.Page.data.entity.attributes.get("md_fromunitsaleid").getValue() == null) || (Xrm.Page.data.entity.attributes.get("md_unitsaleid").getValue() == null)) {
picklistTypeName.removeOption(899230002);
}
}
}
}
André Arnaud de Cal...
291,965
Super User 2025 Season 1
Martin Dráb
230,817
Most Valuable Professional
nmaenpaa
101,156