2017-01-12 3 views
0

リソース(ユーザー/施設)をサービス予定に追加することはできますか?アクティビティにリソースを追加する方法は?

は、ここで私は、リソースを追加する私の記録です:

 var serviceAppointment = this.organizationService.Retrieve(
      "serviceappointment", 
      serviceActivityGuid, 
      new ColumnSet(true)); 

私はリソースのリストがあります:私は上記のServiceAppointmentにこれらのリソースを追加する方法

{ 
    "ListOfResourceIds": [ 
    { 
     "partyid": "9CDC2C51-6417-4550-A0FE-D825EE75D333" 
    }, 
    { 
     "partyid": "9CDC2C51-6417-4550-A0FE-D825EE75D044" 
    } 
    ] 
} 

を?

私はそれらを追加した後、私は呼ぶだろうと思われる:

 organizationService.Update(serviceAppointment); 

答えて

1

リソースタイプActivityParty(SystemUser)です。サービスの予定を更新するには、リソースの対応するシステムユーザIDを取得してください:

var serviceAppointment = organizationService.Retrieve(
         "serviceappointment", 
         serviceActivityGuid, 
         new ColumnSet(true)); 

var updateServiceAppointment = new Entity("serviceappointment") 
{ 
    Id = serviceAppointment.Id 
}; 
updateServiceAppointment["resources"] = new[] 
{ 
    new ActivityParty() 
    { 
     PartyId = new CrmEntityReference("systemuser", correspondingSystemUserId) 
    } 
}; 
organizationService.Update(updateServiceAppointment); 
+0

ありがとうございます!これは "リソース"のすべてを消し、その1 ActivityPartyレコードに置き換えますか? –

関連する問題