9

CRM에서 WebAPI를 통해 실행해야하는 사용자 지정 작업을 작성했습니다. 사용자 지정 작업이 활성화되고 CRM을 만드는 동안 CRM에 오류가 없습니다.CRM16 - WebApi에서 사용자 지정 작업 트리거

Request message has unresolved parameters.

I :

Dim httpch As New HttpClientHandler 
Dim requestUri As String = "contacts(1fcfd54a-15d3-e611-80dc-0050569ea396)/Microsoft.Dynamics.CRM.new_addnotetocontact" 
httpch.Credentials = New NetworkCredential("username", "password", "domain") 
Dim httpClient As New HttpClient(httpch) 
httpClient.BaseAddress = New Uri(CRMWebApiUri) 
httpClient.Timeout = New TimeSpan(0, 2, 0) 
httpClient.DefaultRequestHeaders.Add("OData-MaxVersion", "4.0") 
httpClient.DefaultRequestHeaders.Add("OData-Version", "4.0") 
httpClient.DefaultRequestHeaders.Add("Prefer", "odata.include-annotations='OData.Community.Display.V1.FormattedValue'") 
httpClient.DefaultRequestHeaders.Accept.Add(New MediaTypeWithQualityHeaderValue("application/json")) 
Dim jsonNote As JObject = New JObject(New JProperty("NoteTitle", "'Mails have been deleted'"), New JProperty("NoteText", "This contacts SmarterMail data has been deleted due to inactivity")) 
Dim postData = New StringContent(jsonNote.ToString(), Encoding.UTF8, "application/json") 

Dim retrieveContactResponse As HttpResponseMessage = httpClient.PostAsync(requestUri, postData).Result 

무엇 내가 돌아 가야하는 메시지와 함께 상태 400 :

enter image description here

나는 같은 VB.NET 응용 프로그램에서이 작업을 호출하려고 동일한 사이트에 대해 다른 전화를 걸고 모든 연락처를 한 예로 모을 수 있습니다.

이것이 의미하는 바는 무엇이며 어떻게 수정합니까? Request message has unresolved parameters.

In CRM when you get this error while calling action. then there may be three reasons behind that

  1. some parameters you are passing wrong. (make sure action name is correctly pass)
  2. your action is not activated
  3. your action name is duplicate and one action is in active mode and other is in draft.(as this is done from CRM side that one has to be in draft only two same name action wont be active at same time.)

2 호를 참조하기는

+0

프로세스뿐만 아니라 낮아, @ 파라미터 –

+0

를 본체 내에 작업에 정보를 전달하는 방법 및 CRM 2016에서 그 동작을 생성하는 방법을 도시하는 C# 예제 싶습니다 '' '' '' '' '' '' '[Dynamics CRM 2016에서 직접 활동 만들기] (https://msdn.microsoft.com/en-us/library/) dn481600.aspx) – Nkosi

+0

@Web API 함수 및 동작 예제 (C#) - 동적 CRM 2016] (https://msdn.microsoft.com/en-us/library/mt742426.aspx) – Nkosi

답변

-1

시간이 조금 전에 수정되었지만 답변에 다시 돌아올 시간이 없습니다.

Dim postData = New StringContent(jsonNote.ToString(), Encoding.UTF8, "application/json") 
Dim retrieveContactResponse As HttpResponseMessage = httpClient.PostAsync(requestUri, postData).Result 

대신의 httpClient.PostAsync 방법을 사용하고 제공 : 내 경우에는 문제가 내가 질문에 언급 된 요청이 자기

대신 다음과 같은 방법을 만든 방법은 무엇이었다 StringContent 개체를 직접 사용하고 HttpRequestMessage 개체를 사용하여 StringContent 개체를 제공 한 다음 HttpRequestMessage 개체를 httpClient의 SendAsync 메서드에 제공하면 이제는 문제가 해결 된 것 같습니다. 또한 원래 질문에서 JObject의 첫 번째 JProperty 값에 따옴표가 게시되어 있음을 알 수 있습니다.이 태그는 원본과 다르기 때문에 여기에 게시 할 수 있습니다. 번호 :

Dim jsonNote As JObject = New JObject(New JProperty("NoteTitle", "Mails have been deleted"), New JProperty("NoteText", "This contact's SmarterMail data has been deleted automatically due to inactivity on their CRM account")) 
... 
Dim reqMsg As New HttpRequestMessage(HttpMethod.Post, CRMWebApiUri + requestUri) 
reqMsg.Content = New StringContent(jsonNote.ToString(), Encoding.UTF8, "application/json") 
Dim retrieveContactResponse As HttpResponseMessage = httpClient.SendAsync(reqMsg).Result 
6

What does this mean and how do i fix it ?

이미 이미 지정 동작이 활성화되는 것을 명시 하였다으로 돌보아.

3 번 항목은 링크 된 문서에서 다루어지며, CRM에서 두 번 가져 왔거나 실수로 같은 이름의 두 동작을 만든 경우 그럴듯합니다.

1 번을 해결하기 위해, 나는 데이터를 보유하는 개체 모델을 만드는 제안은

Public Class Note 
    Public Property NoteTitle As String 
    Public Property NoteText As String 
End Class 

CRM 적절한 매개 변수 형식에 대한 매우 까다로운이다 확인할 수 있습니다. 매개 변수 이름은 대소 문자를 구분합니다. NoteTitle에있는 ''은 일련 번호를 지정할 때 문제를 일으킬 수 있습니다. 또한 가능한 경우 NewtonSoft.Json을 사용하여 JSON 페이로드를 직접 제작하지 않고 직접 제작 해보십시오.

'Handler with credentials 
Dim httpClientHandler As New HttpClientHandler With { 
    .Credentials = New NetworkCredential("username", "password", "domain")} 
'Create and configure HTTP Client 
Dim httpClient As New HttpClient(httpClientHandler) With { 
    .BaseAddress = New Uri(CRMWebApiUri), 
    .Timeout = New TimeSpan(0, 2, 0)} 
httpClient.DefaultRequestHeaders.Add("OData-MaxVersion", "4.0") 
httpClient.DefaultRequestHeaders.Add("OData-Version", "4.0") 
httpClient.DefaultRequestHeaders.Add("Prefer", "odata.include-annotations='OData.Community.Display.V1.FormattedValue'") 
httpClient.DefaultRequestHeaders.Accept.Add(New MediaTypeWithQualityHeaderValue("application/json")) 

'Create and populate data to be sent 
Dim model As New Note With { 
    .NoteTitle = "Mails have been deleted", 
    .NoteText = "This contacts SmarterMail data has been deleted due to inactivity"} 
'Serialize mode to well formed JSON 
Dim json As String = JsonConvert.SerializeObject(model) 
Dim postData = New StringContent(json, Encoding.UTF8, "application/json") 
'invoking action using the fully qualified namespace of action message 
Dim requestUri As String = "contacts(1fcfd54a-15d3-e611-80dc-0050569ea396)/Microsoft.Dynamics.CRM.new_addnotetocontact" 
'POST the data 
Dim retrieveContactResponse As HttpResponseMessage = Await httpClient.PostAsync(requestUri, postData) 

추가 참조 Dynamics CRM 2016: Use Web API actions

When invoking a bound function, you must include the full name of the function including the Microsoft.Dynamics.CRM namespace. If you do not include the full name, you will get the following error: Status Code:400 Request message has unresolved parameters.

0

변경 이름 new_AddNoteToContactnew_addnotetocontact, 그것은 작동합니다.

<Action Name="new_AddNoteToContact" IsBound="true"> 
    <Parameter Name="entity" Type="mscrm.contact" Nullable="false" /> 
    <Parameter Name="NoteTitle" Type="Edm.String" Nullable="false" Unicode="false" /> 
    <Parameter Name="NoteText" Type="Edm.String" Nullable="false" Unicode="false" /> 
    <ReturnType Type="mscrm.annotation" Nullable="false" /> 
</Action> 

고유 이름 :

Dim requestUri As String = "contacts(1fcfd54a-15d3-e611-80dc-0050569ea396)/Microsoft.Dynamics.CRM.new_AddNoteToContact" 

프로세스 스키마는 다음과 같다new_AddNoteToContact

참조 : https://msdn.microsoft.com/en-us/library/mt607600.aspx#Anchor_3

업데이트 : 당신은 독특한 편집했을 경우 cr 후에 이름 작업을 먹으면 Processes 엔티티에 중복이 생성됩니다. Pls가 Adv.Find에서 속임수를 삭제합니다.