CRM相關操作

2021-08-20 23:55:20 字數 2563 閱讀 4874

1.前端介面獲取當前crm實體記錄的guid:

var currententityid = xrm.page.data.entity.getid();

2.前端介面獲取當前crm實體記錄欄位的值:

xrm.page.getattribute("createdfromcode").getvalue();//createdfromcode為字段的crm名稱

3.向市場營銷活動中新增成員:

addmemberlistrequest addmemberlistrequest =

newaddmemberlistrequest();

addmemberlistrequest.entityid =

newguid(leadds.tables[0].rows[0][

"leadid"].tostring());(會員記錄guid)

addmemberlistrequest.listid =

newguid(

"c567d8f2-4865-e711-80cd-005056bb7917");(市場活動記錄guid)

addmemberlistresponse addmemberlistresponse = service.execute(addmemberlistrequest)

asaddmemberlistresponse;

4.向實體中新增記錄:

iorganizationservice service =

crmorganization.getservice();//連線crm實體記錄

executetransactionrequest requestfortran =

newexecutetransactionrequest() ;

entity createleaditems =

newentity(

"lead");//實體名

//姓----文字字段賦值

createleaditems[

"lastname"] = lastname;

//銷售組織----查詢字段賦值:

new_saleorgid-目標實體中該字段的crm名字;

new_saleorg-目標實體名;new_saleorgid-需要賦的值

createleaditems[

"new_saleorgid"] =

newentityreference(

"new_saleorg",

newguid(new_saleorgid));

//型別----選項集賦值

createimportwork[

"new_object"] =

newoptionsetvalue(1030);

//原始檔記錄數----數字型別賦值

createimportwork[

"new_sourcenum"] =

convert.todecimal(importdata.rows.count);

createrequest createleadrequest =

newcreaterequest ;

requestfortran.requests.add(createleadrequest);

executetransactionresponse responsefortran = (

executetransactionresponse)service.execute(requestfortran);

5.web工程呼叫控制台程式:

processstartinfo start =

newprocessstartinfo();

後面為向控制台傳遞的引數,用空格隔開,控制台以 args 陣列的形式接收

start.arguments = loyaltyproid +

" " + uploadfileurl +

" " + new_importworkid +

" " + targetlist +

" " + listid;

start.filename =

"c:\\consoleprogram\\bulkimportprocess\\bulkimportprocess.exe";

//以下注釋部分為需要回傳引數時候使用

= false;

= true;

= true;

= true;

= true;

process process =

process.start(start);

6.在伺服器新建檔案

//filepath:新建檔案路徑; filedata: datatable型別,新建檔案內容

filestream filestream =

newfilestream(filepath,

filemode.create);

iworkbook workbook =

excelhelper.buildworkbook(filedata);

workbook.write(filestream);

workbook.close();

CRM相關SQl手記

1.查詢某個實體的主要字段 select attributeid as attributeid name as name from attributeasifpublishedview where entityid 39c2a7d3 6689 4cd5 8673 30545d918d6c and d...

crm操作產品實體

using system using microsoft.xrm.sdk using microsoft.crm.sdk.messages 產品 public class producthelper en name 產品測試 productid service.create en 向配套件中加入產品...

CRM操作要點分析

有些企業的客戶下單有明顯的季節性,如空調 電風扇等產品,帶有明顯的季節性,這時最好不要根據未交易時間確認,否則,客戶關係管理系統crm系統容易誤判。失去客戶的原因是什麼?許多企業對這個問題比較感興趣。是由於 方面的原因,還是由於客戶的投訴未及時處理,又或是交貨延遲等原因,crm則能夠自動收期這些資訊...