真实的国产乱ⅩXXX66竹夫人,五月香六月婷婷激情综合,亚洲日本VA一区二区三区,亚洲精品一区二区三区麻豆

成都創(chuàng)新互聯(lián)網(wǎng)站制作重慶分公司

dynamicsxrm的簡(jiǎn)單介紹

如何在Dynamic CRM 2011中使用自定義Workflow

實(shí)現(xiàn)步驟:

創(chuàng)新互聯(lián)建站主營(yíng)渝北網(wǎng)站建設(shè)的網(wǎng)絡(luò)公司,主營(yíng)網(wǎng)站建設(shè)方案,重慶APP開(kāi)發(fā)公司,渝北h5小程序制作搭建,渝北網(wǎng)站營(yíng)銷(xiāo)推廣歡迎渝北等地區(qū)企業(yè)咨詢(xún)

創(chuàng)建自定義workflow activity ,實(shí)現(xiàn)對(duì)CRM數(shù)據(jù)更新。

創(chuàng)建自定義workflow,實(shí)現(xiàn)整個(gè)流程。

集成自定義workflow到CRM.

?

創(chuàng)建自定義workflow activity

啟動(dòng) Microsoft Visual Studio 2010。

在"文件"菜單上,單擊"新建",然后單擊"項(xiàng)目"。

在"新建項(xiàng)目"對(duì)話(huà)框的"已安裝的模板"窗格中,選擇"Visual C#"下的"工作流",然后選擇"活動(dòng)庫(kù)"。

指定解決方案的名稱(chēng)和位置,然后單擊"確定"。

導(dǎo)航到"項(xiàng)目"菜單并選擇"屬性"。在"應(yīng)用程序"選項(xiàng)卡上,指定".NET Framework 4"作為目標(biāo)框架。

添加對(duì) Microsoft.Xrm.Sdk.dll 和 Microsoft.Xrm.Workflow.dll 程序集的引用。

刪除項(xiàng)目中的 Activity1.xaml 文件。

將類(lèi)文件 (.cs) 添加到項(xiàng)目中。在解決方案資源管理器中,右鍵單擊項(xiàng)目,選擇"添加",然后單擊"類(lèi)"。在"添加新項(xiàng)"對(duì)話(huà)框中,鍵入類(lèi)的名稱(chēng),然后單擊"添加"。

打開(kāi)類(lèi)文件,然后添加以下 using 指令:

using System.Activities;

using Microsoft.Xrm.Sdk;

using Microsoft.Xrm.Sdk.Workflow;

使該類(lèi)繼承自 CodeActivity 類(lèi):

public class SampleCustomActivity : CodeActivity

通過(guò)添加Execute方法為類(lèi)添加功能:

protected override void Execute(CodeActivityContext context)

{

//Activity code

Update Data here

}

編譯項(xiàng)目以創(chuàng)建程序集 (.dll)。

?

?

創(chuàng)建自定義workflow

若要使用在 Microsoft Dynamics CRM 之外創(chuàng)建或修改的 XAML 工作流,請(qǐng)確保:

您的用戶(hù)帳戶(hù)在 Microsoft Dynamics CRM 中具有 Deployment Administrator權(quán)限。

在 Microsoft Dynamics CRM 服務(wù)器上啟用了聲明性工作流。 PowerShell($setting.AllowDeclarativeWorkflows="True")

創(chuàng)建工作流項(xiàng)目

在 Microsoft Visual Studio 中的"文件"菜單上,選擇"新建",然后單擊"項(xiàng)目"。

在"已安裝模板"下展開(kāi)"Visual C#",然后單擊"工作流"。

單擊"活動(dòng)庫(kù)",選擇".NET Framework 4",為項(xiàng)目指定名稱(chēng)和位置,然后單擊"確定"。

在"解決方案資源管理器"中,右鍵單擊"活動(dòng)庫(kù)",然后單擊"添加引用"。

單擊"瀏覽",并找到 Microsoft.Xrm.Sdk.dll 和 Microsoft.Xrm.Sdk.Workflow.dll文件。選擇這些文件并將其添加到項(xiàng)目。

進(jìn)行工作流的定制。

集成自定義workflow到CRM.

使用插件注冊(cè)工具來(lái)注冊(cè)自定義工作流活動(dòng)程序集到CRM。

構(gòu)建 Plug-in Registration 工具。您可在SDK\Tools\PluginRegistration 文件夾中找到該工具的源代碼。若要構(gòu)建和使用插件注冊(cè)工具,您必須首先安裝 Windows Identity Foundation。

用戶(hù)帳戶(hù)必須具有系統(tǒng)定制員或系統(tǒng)管理員角色。

導(dǎo)入自定義的workflow

%TrainingKit%\Labs\WorkflowVS2010\Sources\Assets\WorkflowXamlTool.

打開(kāi) WorkflowXamlTool.sln, 修改workflow name and primaryentity ,執(zhí)行solution.

?

var newWF = new Entity("workflow");

newWF.Attributes.Add("name", "On test 10311");

newWF.Attributes.Add("type", new OptionSetValue(1));

newWF.Attributes.Add("scope", new OptionSetValue(4));

newWF.Attributes.Add("category", new OptionSetValue(0));

newWF.Attributes.Add("primaryentity", "abc_dummy");

newWF.Attributes.Add("xaml", content2);

newWF.Attributes.Add("ondemand", true);

?

try

{

_serviceProxy.Create(newWF);

?

MessageBox.Show("Workflow successfully imported.", "Import",MessageBoxButtons.OK, MessageBoxIcon.Information);

}

catch (FaultException ex)

{

}

選擇自定義xaml 文件,導(dǎo)入。

dynamics crm plugin 沙盒和數(shù)據(jù)庫(kù)的區(qū)別

1.給類(lèi)型賦值不同

CRM4 plugin給lookup賦值為空 :

Lookup lookupnull = new Lookup();

lookupnull.IsNull = true;

lookupnull.IsNullSpecified = true;

entity.Properties["new_storeroom_areaid"] = lookupnull;

CRM2011 給 EntityReference 賦值為空:

entity["new_storeroom_areaid"] = null;

2.單表查詢(xún),返回Entity

CRM4.0 :

private DynamicEntity GetNewPrInfo(Guid NewPrID)//根據(jù)GUID查詢(xún)某字段

{

ColumnSet colSet = new ColumnSet(NewPrInfo.EntityName);

colSet.AddColumn(NewPrInfo.AttributeName_Assigner);

colSet.AddColumn(NewPrInfo.AttributeName_AssignNode);

TargetRetrieveDynamic target = new TargetRetrieveDynamic();

target.EntityId = NewPrID;

target.EntityName = NewPrInfo.EntityName;

RetrieveRequest request = new RetrieveRequest();

request.ColumnSet = colSet;

request.ReturnDynamicEntities = true;

request.Target = target;

RetrieveResponse response = (RetrieveResponse)this.crmService.Execute(request);

DynamicEntity PromotionPe = (DynamicEntity)response.BusinessEntity;

return PromotionPe;

}

CRM2011:

Entity accEntity = service.Retrieve(“new_test”, new_testid, new ColumnSet("字段1", "字段2"));//根據(jù)GUID,查詢(xún)實(shí)體new_test的字段1和字段2的值。

Entity accEntity = service.Retrieve(entityName, entityId, new ColumnSet(true));//根據(jù)GUID,查詢(xún)實(shí)體new_test的所有字段。

3.初始化CRM組織服務(wù)

CRM4:

CrmAuthenticationToken token = new CrmAuthenticationToken();

token.AuthenticationType = 0;

token.OrganizationName = "AdventureWorksCycle";

CrmService service = new CrmService();

service.Url = "";servername:port/mscrmservices/2007/crmservice.asmx";

service.CrmAuthenticationTokenValue = token;

service.Credentials = System.Net.CredentialCache.DefaultCredentials;

CRM2011:

IFD 的服務(wù)前面的段必須是https,不分內(nèi)部和外部。

Uri orgServiceUri = new Uri("");

ClientCredentials credentials = new ClientCredentials();

credentials.UserName.UserName = CRMUserName;

credentials.UserName.Password = CRMUserPassword;

OrganizationServiceProxy crmServiceProxy = new OrganizationServiceProxy(orgServiceUri, null, credentials, null);

crmService = (IOrganizationService)crmServiceProxy;

2. on-premise 內(nèi)部部署(AD認(rèn)證),,初始化WebService時(shí)的方式如下:

服務(wù)前面的段可以是https,也是可以http

如果沒(méi)有路由映射 外網(wǎng)是訪(fǎng)問(wèn)不了 只能內(nèi)網(wǎng)訪(fǎng)問(wèn)

Uri organizationUri = new Uri("");

IServiceConfigurationIOrganizationService orgConfigInfo = ServiceConfigurationFactory.CreateConfigurationIOrganizationService(organizationUri);

var Orgcreds = new ClientCredentials();

Orgcreds.Windows.ClientCredential = new System.Net.NetworkCredential("administrator", "admiN123", "DynamicCRM.com");

OrganizationServiceProxy _serviceproxy = new OrganizationServiceProxy(orgConfigInfo, Orgcreds);

return (IOrganizationService)_serviceproxy;

這樣子也可以:

Uri orgServiceUri = new Uri(Config.CrmWebServiceUrl);

var credentials = new ClientCredentials();

credentials.Windows.ClientCredential = new System.Net.NetworkCredential(Config.CrmServerAccount, Config.CrmServerPSW, Config.CrmServerDomain);

OrganizationServiceProxy _serviceproxy = new OrganizationServiceProxy(orgServiceUri, null, credentials, null);

return (IOrganizationService)_serviceproxy;

4.返回多個(gè)實(shí)體

CRM4:

// Create a column set holding the names of the columns to be retrieved.

ColumnSet cols = new ColumnSet();

cols.Attributes = new string [] {"name", "accountid"};

// Create the query object.

QueryByAttribute query = new QueryByAttribute();

query.ColumnSet = cols;

query.EntityName = EntityName.account.ToString();

// The query will retrieve all accounts whose address1_city is Sammamish.

query.Attributes = new string [] {"address1_city"};

query.Values = new string [] {"Sammamish"};

// Execute the retrieval.

BusinessEntityCollection retrieved = service.RetrieveMultiple(query);

CRM2011:

方法一:

string fetchxml = @"fetch version='1.0' output-format='xml-platform' mapping='logical' distinct='false' aggregate='true'

entity name='new_po_exp_detail'

attribute name='new_exp_amount' alias='new_exp_amount_sum' aggregate='sum' /

attribute name='new_submit_amout' alias='new_submit_amout_sum' aggregate='sum' /

attribute name='new_expense_category' alias='new_expense_category' groupby='true' /

filter type='and'

condition attribute='statecode' operator='eq' value='0' /

/filter

link-entity name='new_po' from='new_poid' to='new_po_exp_detail' alias='ab'

filter type='and'

condition attribute='statecode' operator='eq' value='0' /

condition attribute='new_po_status' operator='in'

value5/value

value7/value

/condition

condition attribute='new_promotion_pe' operator='eq' value='" + new_promotion_peId + @"' /

/filter

/link-entity

/entity

/fetch";

EntityCollection entitycols = service.RetrieveMultiple(new FetchExpression(fetchxml));

方法二:

QueryByAttribute query = new QueryByAttribute("new_categorytate");

query.ColumnSet = new ColumnSet("new_categorytateid");

query.AddAttributeValue("statecode", 0);

query.AddAttributeValue("new_sn", new_sn);//產(chǎn)品品類(lèi)編號(hào)

EntityCollection encols = service.RetrieveMultiple(query);

如何在Dynamic CRM 2013中創(chuàng)建WebService接口供其它系統(tǒng)調(diào)用

新建asp.net web項(xiàng)目

編寫(xiě)代碼

驗(yàn)證服務(wù)

生成項(xiàng)目,并將相關(guān)文件拷貝到CRM的指定路徑

一.新建項(xiàng)目

右鍵點(diǎn)擊資源管理器項(xiàng)目,并添加一個(gè)web服務(wù),此處名稱(chēng)為:MSCRMWebServiceDemo

引用相關(guān)的DLL文件

二.編寫(xiě)代碼

[csharp] view plaincopy

using Microsoft.Xrm.Sdk;

using Microsoft.Xrm.Sdk.Client;

using Microsoft.Xrm.Sdk.Query;

using System;

using System.Collections.Generic;

using System.Linq;

using System.Net;

using System.ServiceModel.Description;

using System.Web;

using System.Web.Services;

namespace MSCRMWebServiceDemo

{

/// summary

/// MyMSCRMWebService 的摘要說(shuō)明

/// /summary

[WebService(Namespace = "")]

[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]

[System.ComponentModel.ToolboxItem(false)]

// 若要允許使用 ASP.NET AJAX 從腳本中調(diào)用此 Web 服務(wù),請(qǐng)取消注釋以下行。

// [System.Web.Script.Services.ScriptService]

public class MyMSCRMWebService : System.Web.Services.WebService

{

static private IOrganizationService GetOrganisationService()

{

ClientCredentials credentials = new ClientCredentials();

credentials.Windows.ClientCredential = new NetworkCredential("crmadmin", "password01!", "test");

OrganizationServiceProxy proxy = new OrganizationServiceProxy(new Uri(""), null, credentials, null);

return proxy as IOrganizationService;

}

[WebMethod]

public string HelloWorld()

{

IOrganizationService service = GetOrganisationService();

//用FETCHXML的方式獲取會(huì)員數(shù)據(jù)

string fetch2 = @"

fetch mapping='logical'

entity name='account'

attribute name='name' /

attribute name='address1_city' /

attribute name='primarycontactid' /

attribute name='telephone1' /

attribute name='accountid' /

order attribute='name' descending='false' /

link-entity name='contact' from='contactid' to='primarycontactid' visible='false' link-type='outer' alias='accountprimarycontactidcontactcontactid'

attribute name='emailaddress1' /

/link-entity

/entity

/fetch";

EntityCollection result = service.RetrieveMultiple(new FetchExpression(fetch2));

String name = "";

foreach (var c in result.Entities)

{

name += c.Attributes["name"];

}

return name;

}

}

}

三.點(diǎn)擊VS的運(yùn)行按鈕,測(cè)試服務(wù)

四.部署相關(guān)項(xiàng)目至CRM指定路徑

拷貝MSCRMWebServiceDemo.dll至CRM的以下路徑:

X:\Program Files\Microsoft Dynamics CRM\CRMWeb\bin

拷貝MyMSCRMWebService.asmx至CRM的以下路徑:

C:\Program Files\Microsoft Dynamics CRM\CRMWeb\ISV

最后驗(yàn)證一下webservice,打開(kāi)地址,出現(xiàn)以下界面則部署成功

東方世通管理系統(tǒng)怎么連接服務(wù)端

微軟Dynamics CRM無(wú)縫集成Office 365、Power BI等生產(chǎn)力工具強(qiáng)大友好,xRM架構(gòu)開(kāi)放靈活,私有云、公有云和混合云自由選擇。微軟Dynamics CRM解決方案與您一同見(jiàn)證企業(yè)崛起!微軟Dynamics CRM無(wú)縫集成Office 365、Power BI等生產(chǎn)力工具強(qiáng)大友好,xRM架構(gòu)開(kāi)放靈活,私有云、公有云和混合云自由選擇。微軟Dynamics CRM解決方案與您一同見(jiàn)證企業(yè)崛起!


當(dāng)前文章:dynamicsxrm的簡(jiǎn)單介紹
文章分享:http://weahome.cn/article/doiscpe.html

其他資訊

在線(xiàn)咨詢(xún)

微信咨詢(xún)

電話(huà)咨詢(xún)

028-86922220(工作日)

18980820575(7×24)

提交需求

返回頂部