日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當(dāng)前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

Dynamics 365 CRM Connected Field Service 自动发送command

發(fā)布時(shí)間:2025/3/14 编程问答 37 豆豆
生活随笔 收集整理的這篇文章主要介紹了 Dynamics 365 CRM Connected Field Service 自动发送command 小編覺得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.

上期降到了怎樣部署connected field service(CFS)

我們假設(shè)現(xiàn)在IoT 設(shè)備是溫度監(jiān)控器, 當(dāng)溫度觸發(fā)我們之前預(yù)設(shè)的溫度值, IoT會(huì)通過IoT Hub 發(fā)送IoT Alert到CFS中。 第一次觸發(fā), 系統(tǒng)會(huì)自動(dòng)發(fā)送reboot的command。

?

為了有更好的用戶體驗(yàn), 我們需要自動(dòng)發(fā)送command。

自動(dòng)發(fā)送非常簡(jiǎn)單。

首先,我們需要?jiǎng)?chuàng)建一個(gè)workflow

?我們的workflow需要在IoT Alert創(chuàng)建的時(shí)候觸發(fā)。

這個(gè)workflow需要有以下兩步:

1. 獲取到當(dāng)前IoT Alert的GUID

2. 創(chuàng)建IoT device command 并且把IoT Alert的GUID 綁定進(jìn)去。

?

首先我們需要?jiǎng)?chuàng)建workflow。

如果不清楚workflow的,可以查看我的workflow 掃盲貼?Step by Step 開發(fā)dynamics CRM

public class RetrieveCFSData : CodeActivity{[Input("Key")]public InArgument<string> Key { get; set; }[ReferenceTarget("msdyn_iotalert")][Output("IoTAlertId")]public OutArgument<EntityReference> IoTAlertId { get; set; }protected override void Execute(CodeActivityContext executionContext){//Create the tracing serviceITracingService tracingService = executionContext.GetExtension<ITracingService>();//Create the contextIWorkflowContext context = executionContext.GetExtension<IWorkflowContext>();IOrganizationServiceFactory serviceFactory = executionContext.GetExtension<IOrganizationServiceFactory>();IOrganizationService service = serviceFactory.CreateOrganizationService(context.UserId);if (context.InputParameters.Contains("Target") && context.InputParameters["Target"] is Entity){// Obtain the target entity from the input parameters. Entity iotAlert = (Entity)context.InputParameters["Target"];var alertId = iotAlert.Attributes["msdyn_iotalertid"].ToString(); //Update Record by using Custom Assembly output parametervar iotAlertRef = new EntityReference("msdyn_iotalert", new Guid(alertId));iotAlertRef.Name = "Hello World From Workflow";IoTAlertId.Set(executionContext, iotAlertRef);}}}

?

我們把這個(gè)workflow添加到之前簡(jiǎn)歷好的step當(dāng)中。不用set properties

?并且,我們要?jiǎng)?chuàng)建一個(gè)IoT Device Command 的step。

在這個(gè)step當(dāng)中, 我們需要在operator找到我們創(chuàng)建好的step 1 custom?workflow。

并且把parent alert 做綁定。

?

轉(zhuǎn)載于:https://www.cnblogs.com/TheMiao/p/11083546.html

總結(jié)

以上是生活随笔為你收集整理的Dynamics 365 CRM Connected Field Service 自动发送command的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網(wǎng)站內(nèi)容還不錯(cuò),歡迎將生活随笔推薦給好友。