역학 365 CRM은 자동으로 명령을 전송하는 현장 서비스를 연결

기간은 (CFS) 연결 현장 서비스를 배포하는 방법에 하락

우리는 온도가 이전 설정 온도 값을 트리거 할 때, 만약 IoT 디바이스는 온도 모니터입니다 지금은 가정의 IoT의 IoT 경고 만약 IoT 허브로 CFS로 전송됩니다. 첫 번째 트리거 시스템이 자동으로 명령을 다시 부팅을 보냅니다.

 

더 나은 사용자 경험을하기 위해, 우리는 자동으로 명령을 전송해야합니다.

자동으로 매우 간단 보냅니다.

우선, 우리는 워크 플로우를 작성해야

 우리는 만약 IoT 경고를 만들 때 워크 플로우를 실행해야합니다.

이 워크 플로는 다음과 같은 두 가지 단계가 필요합니다 :

1. 현재의 IoT 경고의 GUID를 가져옵니다

2. 만약 IoT 디바이스 명령과로의 IoT 경고 바인딩의 GUID를 생성합니다.

 

처음에 우리는 워크 플로를 작성해야합니다.

확실 워크 플로우가 있다면, 당신은 내 워크 플로우 활용 능력 스티커가 볼 수있는  단계 개발 다이내믹 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 service
            ITracingService tracingService = executionContext.GetExtension<ITracingService>();

            //Create the context
            IWorkflowContext 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 parameter
                var iotAlertRef = new EntityReference("msdyn_iotalert", new Guid(alertId));
                iotAlertRef.Name = "Hello World From Workflow";
                IoTAlertId.Set(executionContext, iotAlertRef);
            }
            
        }
    }

 

我们把这个workflow添加到之前简历好的step当中。不用set properties

 并且,我们要创建一个IoT Device Command 的step。

在这个step当中, 我们需要在operator找到我们创建好的step 1 custom workflow。

并且把parent alert 做绑定。

 

추천

출처www.cnblogs.com/TheMiao/p/11083546.html