crm使用soap删除下拉框

//C# 代码:
//DeleteOptionSetRequest request = new DeleteOptionSetRequest();
//request.Name = "new_year";
//DeleteOptionSetResponse response = (DeleteOptionSetResponse)service.Execute(request);

//js例子
function demo() {
    //属性名称
    var attrName = "new_year";

    deleteOption(attrName);
}

function deleteOption(attrName) {
    var request = "";
    request += "";
    request += "";
    request += "";
    request += "";
    request += "";
    request += "Name";
    request += ""+ attrName +"";
    request += "
";
    request += "
";
    request += "";
    request += "DeleteOptionSet";
    request += "
";
    request += "
";
    request += "
";
    request += "
";

    execSoap(request);
}

//获取服务地址
function getWebUrl() {
    var serverUrl = Xrm.Page.context.getServerUrl();
    if (serverUrl.match(/\/$/)) {
        serverUrl = serverUrl.substring(0, serverUrl.length - 1);
    }
    return serverUrl + "/XRMServices/2011/Organization.svc/web";
}
//执行请求
function execSoap(request) {
    var ajaxRequest = new XMLHttpRequest();
    ajaxRequest.open("POST", getWebUrl(), true)
    ajaxRequest.setRequestHeader("Accept", "application/xml, text/xml, */*");
    ajaxRequest.setRequestHeader("Content-Type", "text/xml; charset=utf-8");
    ajaxRequest.setRequestHeader("SOAPAction", "
http://schemas.microsoft.com/xrm/2011/Contracts/Services/IOrganizationService/Execute");
    ajaxRequest.send(request);
}

你可能感兴趣的:(CRM,crm使用soap删除下拉框,crm使用SOAP操作,crm使用soap,crm删除下拉框,crm自定义开发)