//獲取操作記錄
entity entity =
(entity)context.inputparameters[
"target"];
//獲取當前記錄
entity entity = service.
retrieve
(context.primaryentityname, context.primaryentityid,
newcolumnset
(true))
;//獲取選項集的value
entity.
getattributevalue
<
optionsetvalue
>()
.value
((optionsetvalue)getentityrecord)
.value
//獲取時間
getdeal.
getattributevalue
<
datetime
>
("tec_stagestartdatetime");
//獲取文字
string description = entity.attributes[
"description"].
tostring()
;//獲取發件人+參與方列表
entitycollection collection = entity.
getattributevalue
<
entitycollection
>
("from");
foreach
(var item in collection.entities)
//更改值
entity updeate =
newentity
("tec_deal");
updeate.id =entity.
getattributevalue
<
entityreference
>
("tec_dealid"
).id;
updeate[
"tec_caststate"]=
newoptionsetvalue(30
);updeate[
"tec_onstate"]=
newoptionsetvalue(30
);service.
update
(updeate)
;//關聯記錄的id
guid tec_dealid = entity.
getattributevalue
<
entityreference
>
("tec_dealid"
).id;
//刪除括號 直接取值
entityreference erowner =
((entityreference)entitytask.attributes[
"ownerid"])
;guid touserid = erowner.id;
//建立乙個物件
entity createentity =
newentity()
;createentity.logicalname =
"tec_bondevaluationsheet"
;voteent[
"tec_dealname"]=
newentityreference
("tec_deal"
,new
guid
(dealid));
createentity[
"tec_name"
]= title;
recordid = service.
create
(createentity)
.tostring()
;//給選項集賦值
createrecord[
"ownerid"]=
newentityreference
("systemuser"
,new
guid
(userid)
);
//多對多關係取值
public
voida(
)}}}
#region 根據條件獲取資料
///
/// 根據條件獲取資料
///
public datacollection
getentitydatabycondition
(string entityname,
string
selectcolumns, conditionexpression[
] conexpressions,
orderexpression orderexp)
;filterexpression filterexpression =
newfilterexpression()
;if(conexpressions !=
null)}
queryexpression.criteria = filterexpression;
if(orderexp !=
null
) queryexpression.pageinfo.returntotalrecordcount =
true
;return service.
retrievemultiple
(queryexpression)
.entities;
}public datacollection
getentitydatabycondition
(string entityname,
string
selectcolumns, conditionexpression[
] conexpressions, list lkents)
}queryexpression queryexpression =
newqueryexpression;if
(lkents !=
null)}
queryexpression.criteria = filterexpression;
return service.
retrievemultiple
(queryexpression)
.entities;
}#endregion
//如果呼叫action
iorganizationservice service = svr.
getiorganizationservice()
;var request =
neworganizationrequest
("tec_updateishalf");
service.
execute
(request)
;//多對多關係增加建立
associateentitiesrequest associateentitiesrequest =
newassociateentitiesrequest()
; associateentitiesrequest.moniker1 =
newentityreference
("tec_entity1"
,new
guid
("83fde645-0aba-eb11-b856-005056b6907f"))
; associateentitiesrequest.moniker2 =
newentityreference
("tec_entity2"
,new
guid
("11d2bb52-c4a7-eb11-b856-005056b6907f"))
; service.
execute
(associateentitiesrequest)
;//多對多關係移除
disassociateentitiesrequest disassociateentitiesrequest =
newdisassociateentitiesrequest()
; disassociateentitiesrequest.moniker1 =
newentityreference
("tec_entity1"
,new
guid
("83fde645-0aba-eb11-b856-005056b6907f"))
; disassociateentitiesrequest.moniker2 =
newentityreference
("tec_entity2"
,new
guid
("11d2bb52-c4a7-eb11-b856-005056b6907f"))
; service.
execute
(disassociateentitiesrequest)
;
//簡單的查詢方式
queryexpression query =
newqueryexpression
("new_infotemplate")}
};
Dynamic程式設計
場景 1 dynamic d getsomeobject 2 d.quack dynamic obj dynamic custom binding language binding runtimebinderexception dynamic的執行時描述 這樣,可以在支援dynamic的語言中使用d...
dynamic詳細介紹
objective c 2.0 中增加了 dynamic 指令,表示變數對應的屬性訪問器方法,是動態實現的,你需要在nsobject 中繼承而來的 bool resolveinstancemethod sel sel 方法中指定動態實現的方法或者函式。person.h cpp view plain ...
dynamic 另類用途
目的 繞過編譯器的型別檢查 把乙個無型別的物件,使用dynamic 包裝,object限制不能使用泛型 不能使用介面轉型 dynamic data object 給這個物件的屬性賦值。背後的實現應該是反射 data.workflowinstanceid context.workflowinstanc...