zoukankan      html  css  js  c++  java
  • 主要料号只能显示某价目表的内容 Version1

    一个客户的需求. 主要实现的功能有:

    1.execute TargetRetriveDynamic 

    2.自定义lookupsingle.aspx

    function getpricelevelid(quoteidvalue)
    {
        
    var xml = "" + 
    "<?xml version=\"1.0\" encoding=\"utf-8\"?>" + 
    "<soap:Envelope xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\">" + GenerateAuthenticationHeader()+"  <soap:Body>" + 
    "    <Execute xmlns=\"http://schemas.microsoft.com/crm/2007/WebServices\">" + 
    "      <Request xsi:type=\"RetrieveRequest\" ReturnDynamicEntities=\"true\">" + 
    "        <Target xsi:type=\"TargetRetrieveDynamic\">" + 
    "          <EntityName>quote</EntityName>" + 
    "          <EntityId>"+quoteidvalue+"</EntityId>" + 
    "        </Target>" + 
    "        <ColumnSet xmlns:q1=\"http://schemas.microsoft.com/crm/2006/Query\" xsi:type=\"q1:ColumnSet\">" + 
    "          <q1:Attributes>" + 
    "            <q1:Attribute>quoteid</q1:Attribute>" + 
    "            <q1:Attribute>pricelevelid</q1:Attribute>" + 
    "          </q1:Attributes>" + 
    "        </ColumnSet>" + 

    "      </Request>" + 
    "    </Execute>" + 
    "  </soap:Body>" + 
    "</soap:Envelope>" + 
    "";

    var xmlHttpRequest = new ActiveXObject("Msxml2.XMLHTTP");

    xmlHttpRequest.Open(
    "POST""/mscrmservices/2007/CrmService.asmx"false);
    xmlHttpRequest.setRequestHeader(
    "SOAPAction","http://schemas.microsoft.com/crm/2007/WebServices/Execute");
    xmlHttpRequest.setRequestHeader(
    "Content-Type""text/xml; charset=utf-8");
    xmlHttpRequest.setRequestHeader(
    "Content-Length", xml.length);
    xmlHttpRequest.send(xml);

    var resultXml = xmlHttpRequest.responseXML;

    // Create an XML object to parse the results.
    var xmlDoc=new ActiveXObject("Microsoft.XMLDOM");
    xmlDoc.async
    =false;
    xmlDoc.loadXML(resultXml.xml);

    var ret=xmlDoc.selectSingleNode("//Property[@Name='pricelevelid']");

    //ret.text enough for return xml;
    //
    in other case this may not enough be careful for this.
    return ret.text;

        

    //return  xmlDoc.getElementsByTagName("pricelevelid")[0].childNodes[0].nodeValue;


    }
    function OnCrmPageLoad()
    {
      
    var quoteidvalue =crmForm.all.quoteid.DataValue;

    if (crmForm.all.isproductoverridden.DataValue == 1)
     {
       crmForm.all.esp_productnumber.Disabled
    =false;
     }
    else
     {
       crmForm.all.esp_productnumber.Disabled
    =true;
       crmForm.all.esp_productnumber.ForceSubmit
    =true;

     }
        
    var productidLookup=crmForm.all.productid;

       
    var filterfetchxml="<fetch mapping='logical'><entity name='product'>"
        
    + "<filter type='or'><condition attribute='pricelevelid' operator='eq' value='"
        
    + getpricelevelid(quoteidvalue)    + "' /><condition attribute='pricelevelid' operator='eq' value='9439FF4D-8613-DE11-B063-001EC9B6EAFD' /> </filter></entity></fetch>";
       productidLookup.AddParam(
    "search",filterfetchxml);

        
    }

    OnCrmPageLoad();
  • 相关阅读:
    @@IDENTITY 存储过程
    ASP.NET的Cookie和Session
    数据格式设置表达式
    DataTable类(MSDN)
    用静态变量代替appliction
    C cgi url 编码解码问题
    C#视频头操作
    c#网页抓取
    c语言字符串分隔
    CGI c 上传文件
  • 原文地址:https://www.cnblogs.com/janmson/p/1433674.html
Copyright © 2011-2022 走看看