惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

罗磊的独立博客
SecWiki News
SecWiki News
酷 壳 – CoolShell
酷 壳 – CoolShell
爱范儿
爱范儿
量子位
M
MIT News - Artificial intelligence
GbyAI
GbyAI
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
TaoSecurity Blog
TaoSecurity Blog
博客园 - 【当耐特】
H
Heimdal Security Blog
腾讯CDC
The Last Watchdog
The Last Watchdog
Security Archives - TechRepublic
Security Archives - TechRepublic
Hacker News: Ask HN
Hacker News: Ask HN
S
Schneier on Security
Microsoft Security Blog
Microsoft Security Blog
WordPress大学
WordPress大学
博客园 - 司徒正美
Recent Commits to openclaw:main
Recent Commits to openclaw:main
C
Cybersecurity and Infrastructure Security Agency CISA
S
SegmentFault 最新的问题
大猫的无限游戏
大猫的无限游戏
Application and Cybersecurity Blog
Application and Cybersecurity Blog
F
Full Disclosure
有赞技术团队
有赞技术团队
T
Tailwind CSS Blog
Engineering at Meta
Engineering at Meta
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
T
Threatpost
月光博客
月光博客
A
Arctic Wolf
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
雷峰网
雷峰网
T
Troy Hunt's Blog
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
The Cloudflare Blog
D
DataBreaches.Net
O
OpenAI News
L
LINUX DO - 最新话题
宝玉的分享
宝玉的分享
小众软件
小众软件
V
Vulnerabilities – Threatpost
A
About on SuperTechFans
人人都是产品经理
人人都是产品经理
T
The Exploit Database - CXSecurity.com
Martin Fowler
Martin Fowler
美团技术团队
P
Privacy International News Feed

博客园 - Seer Lin

自己开发的ERP系统,有需要的联系 MSCRM2016 取消邮箱强制SSL 不听话的下属辞职记 Windows 7下,巧让家用UPS也支持电脑自动关机 海蜘蛛去广告 [转]SQL2008链接服务器数据同步 asp.net 在IE8 导出excel时的问题 [转]mssql链接服务器 win2008 R2 64位系统下配置DCOM权限 [转]excel 操作类 在excel中,将 长*宽*高 这样的格式列,拆分成3列 将没有产品图片的产品设置为不在前台显示SQL实现 [转]在Reporting Services报表中引用FTP站点上的图片 mscrm4.0 判断当前用户角色_示例 mscrm 4.0 获取当前用户角色 mscrm4.0 获取当前登录的用户名 mscrm4.0 用js调用Webservice vs2010 js 代码折叠插件 MSCRM 删除客户数据 MSCRM offline plugin开发注意事项
mscrm js webservic 常用功能
Seer Lin · 2011-04-02 · via 博客园 - Seer Lin

var ORG_NAME="test";
var SERVICE_PATH="/mscrmservices/2007/CrmService.asmx"
var authenticationHeader = GenerateAuthenticationHeader();function getCurrentUserName(){
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\">" + 
    authenticationHeader 
+ 
"  <soap:Body>" + 
"    <Execute xmlns=\"http://schemas.microsoft.com/crm/2007/WebServices\">" + 
"      <Request xsi:type=\"RetrieveMultipleRequest\" ReturnDynamicEntities=\"true\">" + 
"        <Query xmlns:q1=\"http://schemas.microsoft.com/crm/2006/Query\" xsi:type=\"q1:QueryExpression\">" + 
"          <q1:EntityName>systemuser</q1:EntityName>" + 
"          <q1:ColumnSet xsi:type=\"q1:ColumnSet\">" + 
"            <q1:Attributes>" + 
"              <q1:Attribute>fullname</q1:Attribute>" + 
"            </q1:Attributes>" + 
"          </q1:ColumnSet>" + 
"          <q1:Distinct>false</q1:Distinct>" + 
"          <q1:Criteria>" + 
"            <q1:FilterOperator>And</q1:FilterOperator>" + 
"            <q1:Conditions>" + 
"              <q1:Condition>" + 
"                <q1:AttributeName>systemuserid</q1:AttributeName>" + 
"                <q1:Operator>EqualUserId</q1:Operator>" + 
"              </q1:Condition>" +              
"            </q1:Conditions>" + 
"          </q1:Criteria>" + 
"        </Query>" + 
"      </Request>" + 
"    </Execute>" + 
"  </soap:Body>" + 
"</soap:Envelope>" + 
"";var xmlHttpRequest = new ActiveXObject("Msxml2.XMLHTTP");

xmlHttpRequest.Open(

"POST", SERVICE_PATH, 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;var doc = xmlHttpRequest.responseXML;return resultXml.selectSingleNode("//Property[@Name='fullname']/Value").nodeTypedValue;

}

function retrieve(entityName,entityId,attributeName){
    
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\">" + 
        authenticationHeader
+
    
"  <soap:Body>" + 
    
"    <Retrieve xmlns=\"http://schemas.microsoft.com/crm/2007/WebServices\">" + 
    
"      <entityName>"+entityName+"</entityName>" + 
    
"      <id>"+entityId+"</id>" + 
    
"      <columnSet xmlns:q1=\"http://schemas.microsoft.com/crm/2006/Query\" xsi:type=\"q1:ColumnSet\">" + 
    
"        <q1:Attributes>" + 
    
"          <q1:Attribute>"+attributeName+"</q1:Attribute>" + 
    
"        </q1:Attributes>" + 
    
"      </columnSet>" + 
    
"    </Retrieve>" + 
    
"  </soap:Body>" + 
    
"</soap:Envelope>" + 
    
"";
    
    
var xmlHttpRequest = new ActiveXObject("Msxml2.XMLHTTP");
    
    xmlHttpRequest.Open(
"POST", SERVICE_PATH, false);
    xmlHttpRequest.setRequestHeader(
"SOAPAction","http://schemas.microsoft.com/crm/2007/WebServices/Retrieve");
    xmlHttpRequest.setRequestHeader(
"Content-Type""text/xml; charset=utf-8");
    xmlHttpRequest.setRequestHeader(
"Content-Length", xml.length);
    xmlHttpRequest.send(xml);
    
var resultXml = xmlHttpRequest.responseXML;
    
return resultXml;
}
function getAttribute(entityName,entityId,attribute){
    
var resultXml= retrieve(entityName,entityId,attribute);
    
    
//Check for errors.
    var errorCount = resultXml.selectNodes('//error').length;
    
if (errorCount != 0)
    {
     
var msg = resultXml.selectSingleNode('//description').nodeTypedValue;
     alert(msg);
    }
    
//Display the retrieved value.
    else
    {
    
return resultXml.selectSingleNode("//q1:"+attribute).nodeTypedValue;
    }
}
function retrieveByCondition(entityName,attribute_get,attributeName_con1,attributeValue_con1,attributeName_con2,attributeValue_con2){
    
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\">" + 
    authenticationHeader 
+ 
"  <soap:Body>" + 
"    <Execute xmlns=\"http://schemas.microsoft.com/crm/2007/WebServices\">" + 
"      <Request xsi:type=\"RetrieveMultipleRequest\" ReturnDynamicEntities=\"true\">" + 
"        <Query xmlns:q1=\"http://schemas.microsoft.com/crm/2006/Query\" xsi:type=\"q1:QueryExpression\">" + 
"          <q1:EntityName>"+entityName+"</q1:EntityName>" + 
"          <q1:ColumnSet xsi:type=\"q1:ColumnSet\">" + 
"            <q1:Attributes>" + 
"              <q1:Attribute>"+attribute_get+"</q1:Attribute>" + 
"            </q1:Attributes>" + 
"          </q1:ColumnSet>" + 
"          <q1:Distinct>false</q1:Distinct>" + 
"          <q1:Criteria>" + 
"            <q1:FilterOperator>And</q1:FilterOperator>" + 
"            <q1:Conditions>" + 
"              <q1:Condition>" + 
"                <q1:AttributeName>"+attributeName_con1+"</q1:AttributeName>" + 
"                <q1:Operator>Equal</q1:Operator>" + 
"                <q1:Values>" + 
"                  <q1:Value xsi:type=\"xsd:string\">"+attributeValue_con1+"</q1:Value>" + 
"                </q1:Values>" + 
"              </q1:Condition>" + 
"              <q1:Condition>" + 
"                <q1:AttributeName>"+attributeName_con2+"</q1:AttributeName>" + 
"                <q1:Operator>Equal</q1:Operator>" + 
"                <q1:Values>" + 
"                  <q1:Value xsi:type=\"xsd:string\">"+attributeValue_con2+"</q1:Value>" + 
"                </q1:Values>" + 
"              </q1:Condition>" + 
"            </q1:Conditions>" + 
"          </q1:Criteria>" + 
"        </Query>" + 
"      </Request>" + 
"    </Execute>" + 
"  </soap:Body>" + 
"</soap:Envelope>" + 
"";var xmlHttpRequest = new ActiveXObject("Msxml2.XMLHTTP");

xmlHttpRequest.Open(

"POST", SERVICE_PATH, 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;
return resultXml;
}
function getAttributeByCondition(entityName,attribute_get,attributeName_con1,attributeValue_con1,attributeName_con2,attributeValue_con2){
    
var resultXml= retrieveByCondition(entityName,attribute_get,attributeName_con1,attributeValue_con1,attributeName_con2,attributeValue_con2);
    
    
//Check for errors.
    var errorCount = resultXml.selectNodes('//error').length;
    
if (errorCount != 0)
    {
     
var msg = resultXml.selectSingleNode('//description').nodeTypedValue;
     alert(msg);
    }
    
//Display the retrieved value.
    else
    {
    
//return resultXml;
    return resultXml.selectSingleNode("//Property[@Name='"+attribute_get+"']/Value").nodeTypedValue;
    }
}
//工作周报
var lookupItem= crmForm.all.new_projectweekreportid.DataValue;
 
if (lookupItem[0!= null)
{
  
//alert(lookupItem[0].name);
  var currentUserName=getCurrentUserName();
   
var weekReportId=lookupItem[0].id;
   
var projectId= getAttribute("new_projectweekreport",weekReportId,"new_project2id");
   
var memberId=getAttributeByCondition("new_prejectmember","new_prejectmemberid","new_project2id",projectId,"new_name",currentUserName);
   
if(memberId != null){
         
//Create an array to set as the DataValue for the lookup control.
            var lookupData = new Array();
        
//Create an Object add to the array.
           var lookupItem= new Object();
        
//Set the id, typename, and name properties to the object.
           lookupItem.id = memberId;
           lookupItem.name
=currentUserName;
           lookupItem.typename 
= 'new_prejectmember';
           
        
// Add the object to the array.
           lookupData[0= lookupItem;
        
// Set the value of the lookup field to the value of the array.
           crmForm.all.new_prejectmemberid.DataValue= lookupData;
          
       }
   }
}