msdyn_ForecastApi アクション
開発者は、この参照ドキュメントを使用し、msdyn_ForecastApi
カスタム アクションを使用して予測データを取得および更新します。
ライセンスとロールの要件
要件タイプ | 以下が必要です |
---|---|
ライセンス | Dynamics 365 Sales Premium または Dynamics 365 Sales Enterprise 詳細情報: Dynamics 365 Sales の価格 |
セキュリティ ロール | システム カスタマイザー 詳細: 営業向けに事前定義されたセキュリティ ロール |
Parameters
パラメーター名 | Required | 説明設定 |
---|---|---|
WebApiName |
イエス | 実行する API の名前が含まれます。 |
RequestJson |
イエス | API 呼び出しのパラメーターと引数が含まれています。 |
API の一覧
msdyn_ForecastApi
カスタム アクションを使用して呼び出すことができる API のセットを以下に示します。
GET_ForecastConfigurations
構成されたすべての予測構成のリストを返します。
例
POST [Organization URI]/api/data/v9.1/msdyn_ForecastApi/ HTTP/1.1
Content-Type: application/json
{
"WebApiName": "GET_ForecastConfigurations",
"RequestJson": "{}"
}
パラメーター | タイプ | 説明設定 |
---|---|---|
WebApiName |
String | API の名前 |
RequestJson |
String | シリアル化された JSON オブジェクト |
回答
{
"@odata.context": "[Organization URI]/api/data/v9.1/$metadata#Microsoft.Dynamics.CRM.msdyn_ForecastApiResponse",
"response": [
{
"Columns": [
{
"ForecastConfigurationColumnId": "0ad51075-912b-4e00-a7a1-91170e437d27",
...
"ForecastConfigurationId": "27bd2c40-f868-ea11-a811-000d3a37bb2c",
...
},
{
"ForecastConfigurationColumnId": "c3ef8024-6517-4168-adc7-bb5b520554a0",
...
"ForecastConfigurationId": "27bd2c40-f868-ea11-a812-125d3a37bb2d",
...
}],
"PermissionRoles": null,
"AdditionalFilters": "<fetch version=\"1.0\" mapping=\"logical\"><entity name=\"opportunity\"><\/entity><\/fetch>",
"IsSnapshotScheduled": false,
"SnapshotSchedule": null,
"SnapshotTimeZone": null,
"PublishedDateTime": "0001-01-01T00:00:00",
"DefaultViewIdForUnderlyingRecords": "bf649add-6c30-ea11-a813-000d3a5475f7"
}
]
}
値を返す
予測構成の一覧。
GET_ForecastConfigurationsByName
要求ペイロードの一部として指定された名前を持つすべての予測構成を返します。
例
POST [Organization URI]/api/data/v9.1/msdyn_ForecastApi HTTP/1.1
Content-Type: application/json
{
"WebApiName": "GET_ForecastConfigurationsByName",
"RequestJson": "{\"Name\":\"api_test1\"}"
}
パラメーター | タイプ | 説明設定 |
---|---|---|
WebApiName |
String | API の名前 |
RequestJson |
JSON オブジェクト | Name の構成: 予測構成の名前 |
回答
{
"@odata.context": "[Organization URI]/api/data/v9.1/$metadata#Microsoft.Dynamics.CRM.msdyn_ForecastApiResponse",
"response": [
{
"Columns": [
{
"Name": "api_test1",
...
"ForecastConfigurationId": "bcf37937-487e-ea11-a811-000d3a37bb2c",
...
}
],
"PermissionRoles": null,
"AdditionalFilters": "<fetch version=\"1.0\" mapping=\"logical\"><entity name=\"opportunity\"><\/entity><\/fetch>",
"IsSnapshotScheduled": false,
"SnapshotSchedule": null,
"SnapshotTimeZone": null,
"PublishedDateTime": "0001-01-01T00:00:00",
"DefaultViewIdForUnderlyingRecords": "bf649add-6c30-ea11-a813-000d3a5475f7"
}
]
}
値を返す
予測構成の一覧。
GET_ForecastPeriodsByForecastConfigurationId
要求ペイロードの一部として提供される、アクティブな予測構成 ID のすべての予測期間を返します。
例
POST [Organization URI]/api/data/v9.1/msdyn_ForecastApi HTTP/1.1
Content-Type: application/json
{
"WebApiName": "GET_ForecastPeriodsByForecastConfigurationId",
"RequestJson": "{
\"ForecastConfigurationId\":\"04323a04-da7f-ea11-a811-000d3a37bb2c\"
}"
}
パラメーター | タイプ | 説明設定 |
---|---|---|
WebApiName |
String | API の名前 |
RequestJson |
JSON オブジェクト | ForecastConfigurationId を含む: 予測構成 ID |
回答
{
"@odata.context": "[Organization URI]/api/data/v9.1/$metadata#Microsoft.Dynamics.CRM.msdyn_ForecastApiResponse",
"response": [
{
"Id": "8b8cadd8-ede3-4b21-97cf-93efc0337089",
"ForecastConfigurationId": "04323a04-da7f-ea11-a811-000d3a37bb2c",
"RecurrenceIndex": 0,
"ValidFrom": "2020-04-01T00:00:00Z",
"ValidTo": "2020-06-30T23:59:59Z",
"Name": "FY2020 Q2",
"RecomputeStatus": 10,
"LastRecomputedOn": "2020-05-25T08:04:24.817Z",
"RecomputationStartTime": "2020-06-05T05:04:30.904Z",
"RecomputeStatusChangedOn": "2020-06-05T06:04:00.363Z",
"FailureInfo": "Microsoft.Azure.WebJobs.FunctionFailedException: The activity function 'CreateUpdateForecastHierarchy' failed: \"An item with the same key has already been added. Key: b1d30f13-ce56-ea11-a812-000d3a382f93\". See the function execution logs for additional details. ---> System.ArgumentException: An item with the same key has already been added. Key: b1d30f13-ce56-ea11-a812-000d3a382f93\r\n at System.Collections.Generic.Dictionary`2.TryInsert(TKey key, TValue value, InsertionBehavior behavior)\r\n at Microsoft.Dynamics.Forecasting.RecomputeEngine.HierarchyManager.<>c__DisplayClass23_0.<GetForecastInstancesByHierarchyEntityId>b__0(ForecastInstance forecastInstance) in C:\\src\\cloud_IDEs\\ide5\\Azure\\RecomputeEngine\\HierarchyManager\\HierarchyManager.cs:line 727\r\n at System.Collections.Generic.List`1.ForEach(Action`1 action)\r\n at Microsoft.Dynamics.Forecasting.RecomputeEngine.HierarchyManager.GetForecastInstancesByHierarchyEntityId(ForecastConfiguration forecastConfiguration, Guid forecastRecurrenceId) in C:\\src\\cloud_IDEs\\ide5\\Azure\\RecomputeEngine\\HierarchyManager\\HierarchyManager.cs:line 727\r\n at Microsoft.Dynamics.Forecasting.RecomputeEngine.HierarchyManager.CreateOrUpdateForecastDataWithLatestHierarchy(ForecastConfiguration forecastConfiguration, Guid forecastRecurrenceId, Dictionary`2 latestHierarchyEntityList) in C:\\src\\cloud_IDEs\\ide5\\Azure\\RecomputeEngine\\HierarchyManager\\HierarchyManager.cs:line 602\r\n at Microsoft.Dynamics.Forecasting.RecomputeEngine.HierarchyManager.<>c__DisplayClass16_0.<CreateOrUpdateForecastHierarchy>b__0() in C:\\src\\cloud_IDEs\\ide5\\Azure\\RecomputeEngine\\HierarchyManager\\HierarchyManager.cs:line 283\r\n at System.Threading.Tasks.Task.InnerInvoke()\r\n at System.Threading.Tasks.Task.<>c.<.cctor>b__275_1(Object obj)\r\n at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)\r\n--- End of stack trace from previous location where exception was thrown ---\r\n at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)\r\n at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot)\r\n--- End of stack trace from previous location where exception was thrown ---\r\n at Microsoft.Dynamics.Forecasting.RecomputeEngine.HierarchyManager.CreateOrUpdateForecastHierarchy(ForecastConfiguration forecastConfiguration, Guid forecastRecurrenceId, Dictionary`2 latestHierarchyEntityList) in C:\\src\\cloud_IDEs\\ide5\\Azure\\RecomputeEngine\\HierarchyManager\\HierarchyManager.cs:line 255\r\n at Microsoft.Dynamics.Forecasting.RecomputeEngine.HierarchyManager.CreateOrUpdateForecastHierarchy(Guid orgId, Guid forecastConfigurationId, Guid forecastRecurrenceId, Dictionary`2 latestHierarchyEntityList) in C:\\src\\cloud_IDEs\\ide5\\Azure\\RecomputeEngine\\HierarchyManager\\HierarchyManager.cs:line 167\r\n at Microsoft.Dynamics.Forecasting.AzureFunctions.CreateUpdateForecastHierarchy.Run(CreateUpdateForecastHierarchyInput input) in C:\\src\\cloud_IDEs\\ide5\\Azure\\AzureFunctions\\Recompute\\ActivityFunctions\\CreateUpdateForecastHierarchy.cs:line 43\r\n at Microsoft.Azure.WebJobs.Host.Executors.VoidTaskMethodInvoker`2.InvokeAsync(TReflected instance, Object[] arguments) in C:\\projects\\azure-webjobs-sdk-rqm4t\\src\\Microsoft.Azure.WebJobs.Host\\Executors\\VoidTaskMethodInvoker.cs:line 20\r\n at Microsoft.Azure.WebJobs.Host.Executors.FunctionInvoker`2.InvokeAsync(Object instance, Object[] arguments) in C:\\projects\\azure-webjobs-sdk-rqm4t\\src\\Microsoft.Azure.WebJobs.Host\\Executors\\FunctionInvoker.cs:line 52\r\n at Microsoft.Azure.WebJobs.Host.Executors.FunctionExecutor.InvokeAsync(IFunctionInvoker invoker, ParameterHelper parameterHelper, CancellationTokenSource timeoutTokenSource, CancellationTokenSource functionCancellationTokenSource, Boolean throwOnTimeout, TimeSpan timerInterval, IFunctionInstance instance) in C:\\projects\\azure-webjobs-sdk-rqm4t\\src\\Microsoft.Azure.WebJobs.Host\\Executors\\FunctionExecutor.cs:line 585\r\n at Microsoft.Azure.WebJobs.Host.Executors.FunctionExecutor.ExecuteWithWatchersAsync(IFunctionInstanceEx instance, ParameterHelper parameterHelper, ILogger logger, CancellationTokenSource functionCancellationTokenSource) in C:\\projects\\azure-webjobs-sdk-rqm4t\\src\\Microsoft.Azure.WebJobs.Host\\Executors\\FunctionExecutor.cs:line 532\r\n at Microsoft.Azure.WebJobs.Host.Executors.FunctionExecutor.ExecuteWithLoggingAsync(IFunctionInstanceEx instance, ParameterHelper parameterHelper, IFunctionOutputDefinition outputDefinition, ILogger logger, CancellationTokenSource functionCancellationTokenSource) in C:\\projects\\azure-webjobs-sdk-rqm4t\\src\\Microsoft.Azure.WebJobs.Host\\Executors\\FunctionExecutor.cs:line 468\r\n at Microsoft.Azure.WebJobs.Host.Executors.FunctionExecutor.ExecuteWithLoggingAsync(IFunctionInstanceEx instance, FunctionStartedMessage message, FunctionInstanceLogEntry instanceLogEntry, ParameterHelper parameterHelper, ILogger logger, CancellationToken cancellationToken) in C:\\projects\\azure-webjobs-sdk-rqm4t\\src\\Microsoft.Azure.WebJobs.Host\\Executors\\FunctionExecutor.cs:line 278\r\n --- End of inner exception stack trace ---\r\n at Microsoft.Azure.WebJobs.DurableOrchestrationContext.CallDurableTaskFunctionAsync[TResult](String functionName, FunctionType functionType, String instanceId, RetryOptions retryOptions, Object input) in E:\\functions\\azure-functions-durable-extension\\src\\WebJobs.Extensions.DurableTask\\DurableOrchestrationContext.cs:line 498\r\n at Microsoft.Dynamics.Forecasting.AzureFunctions.OrchestratorFunctionBase.ExecuteActivityAsync(DurableOrchestrationContext context, String functionName, Object input, Dictionary`2 telemetryProps) in C:\\src\\cloud_IDEs\\ide5\\Azure\\AzureFunctions\\OrchestratorFunctionBase.cs:line 252\r\n at Microsoft.Dynamics.Forecasting.AzureFunctions.RecomputeOrchestrator.ExecuteRecomputeOrchestration(DurableOrchestrationContext context, RecomputeOrchestratorInput recomputeInput, String correlationId, Dictionary`2 telemetryProps) in C:\\src\\cloud_IDEs\\ide5\\Azure\\AzureFunctions\\Recompute\\RecomputeOrchestrator.cs:line 169",
"RecurrenceState": 0,
"UpdatedAttribteList": null
}
]
}
値を返す
予測期間の一覧です。
GET_ForecastInstances
単一行のエンティティ レコードである予測インスタンスの一覧を返します。
Note
予測期間には、多くの予測インスタンスを含めることができます。 単一の要求でプルダウンするよりもはるかに多くのことを行います。 API エンドポイントは規定で、要求ごとに制限された数の項目を提供します。
注: 大規模なクエリはパフォーマンスを低下させる可能性があるため、ページあたりの結果数は 4000 レコードに制限されています。 4000 を超えるレコードを取得する場合 (たとえば、利用可能なすべての予測インスタンスのクライアント側リストを作成する場合)、複数の API 要求を作成し、アプリケーション内で結果を組み合わせることができます。
例
POST [Organization URI]/api/data/v9.1/msdyn_ForecastApi HTTP/1.1
Content-Type: application/json
{
"WebApiName": "GET_ForecastInstances",
"RequestJson": "{
\"ForecastPeriodId\":\"8b8cadd8-ede3-4b21-97cf-93efc0337089\",
\"ForecastConfigurationId\":\"04323a04-da7f-ea11-a811-000d3a37bb2c\",
\"SortingAttribute\":\"HierarchyEntityRecord.RecordId\",
\"SortingOrder\":\"DSC\",
\"PageSize\":1,
\"PageNo\":1
}"
}
パラメーター | タイプ | 説明設定 |
---|---|---|
WebApiName |
String | API の名前 |
RequestJson |
JSON オブジェクト | は、次の要素で構成されていますForecastPeriodId : 予測期間の一意識別子ForecastConfigurationId : 予測構成の一意識別子SortingAttribute : ページングで並べ替えを行う基準となる属性SortingOrder : 昇順の ASC、降順の DSCPageSize : 単一ページで取得するレコードの数PageNo : 取得するページ レコード。 |
RequestJson
オブジェクトのサンプルの JSON ペイロードを以下に示します。
{
"WebApiName": "GET_ForecastInstances",
"RequestJson": "{
\"ForecastPeriodId\":\"{{frid}}\",
\"ForecastConfigurationId\":\"{{fcid}}\",
\"SortingAttribute\":\"HierarchyEntityRecord.RecordId\",
\"SortingOrder\":\"DSC\",
\"PageSize\":1,
\"PageNo\":1
}"
}
回答
{
"@odata.context": "[Organization URI]/api/data/v9.1/$metadata#Microsoft.Dynamics.CRM.msdyn_ForecastApiResponse",
"response": {
"ForecastInstances": [
"ForecastInstanceId": "95d2305a-a0be-4b34-84ac-b10e67b0771a",
"ForecastConfigurationId": "04323a04-da7f-ea11-a811-000d3a37bb2c",
...],
"HasMorePages": false,
"Code": 200,
"Message": "OK"
}
}
値を返す
予測期間の一覧です。
Update_SimpleColumnByEntityId
渡されたパラメーターの値を使用して、特定の列の値を更新します。
Note
単一の API 呼び出しで多数の更新要求を行うと、パフォーマンスが低下する可能性があるため、要求ごとの更新は 50 に制限されています。
例
POST [Organization URI]/api/data/v9.1/msdyn_ForecastApi HTTP/1.1
content-type: application/json
{
"WebApiName": "Update_ SimpleColumnByEntityId",
"RequestJson": "
{
\"ForecastConfigurationId\":\"0461fb6b-8d85-ea11-a811-000d3a37bb2c\",
\"ForecastRecurranceId\":\"f8b1122c-b913-4e88-9727-368b6134be3e\",
\"SimpleColumnUpdateRequests\":[{
\" HierarchyEntityRecordId\":\"d8680b00-fd31-46c2-8136-7c4df19cf2a8\",
\"ForecastConfigurationColumnId\":\"65ec7bd1-2de6-49fa-b259-ba74bc721c78\",
\"ForecastConfigurationColumnValue\":0.0,
\"IsRolledUpColumnUpdate\":false},{
\" HierarchyEntityRecordId\":\"11141300-131b-493a-9857-22bd8689b775\",
\"ForecastConfigurationColumnId\":\"65ec7bd1-2de6-49fa-b259-ba74bc721c78\",
\"ForecastConfigurationColumnValue\":0.0,
\"IsRolledUpColumnUpdate\":false}]}"
}
パラメーター | 件名 | 説明設定 |
---|---|---|
WebApiName | String | API の名前 |
ForecastConfigurationId | GUID | 予測構成 ID |
ForecastRecurranceId | GUID | 予測パターン ID または予測期間 ID の SimpleColumnUpdateRequests のリストは配列です |
HierarchyEntityRecordId | GUID | EntityRecordId |
ForecastConfigurationColumnId | GUID | 予測構成列 ID |
ForecastConfigurationColumnValue | ForecastConfigurationColumn のデータ型 | 更新する必要がある値 |
IsRolledUpColumnUpdate (オプション) | ブール型 | True はロールアップ列の値が更新された場合、False は集計列の値が更新された場合です |
回答
{
"@odata.context": "[Organization URI]/api/data/v9.1/$metadata#Microsoft.Dynamics.CRM.msdyn_ForecastApiResponse",
"response": [
{
"Message": "Update Successful",
"StatusCode": 0,
"HierarchyEntityRecordId": "d8680b00-fd31-46c2-8136-7c4df19cf2a8",
"ForecastConfigurationColumnId": "65ec7bd1-2de6-49fa-b259-ba74bc721c78"
},
{
"Message": "Update Successful",
"StatusCode": 0,
"HierarchyEntityRecordId": "11141300-131b-493a-9857-22bd8689b775",
"ForecastConfigurationColumnId": "65ec7bd1-2de6-49fa-b259-ba74bc721c78"
}
]
}
値を返す
HierarchyEntityRecordId
、ForecastConfigurationColumnId
、Message
、StatusCode
で構成される UpdateSimpleColumnByEntityResponse
レコードの一覧。
Update_SimpleColumnByFIId
渡されたパラメーターの値を設定することによって、特定の列の値を更新します。
Note
単一の API 呼び出しで多数の更新要求を行うと、パフォーマンスが低下する可能性があるため、要求ごとの更新は 50 に制限されています。
例
POST [Organization URI]/api/data/v9.1/msdyn_ForecastApi HTTP/1.1
content-type: application/json
{
"WebApiName": "Update_SimpleColumnByFIId",
"RequestJson": "
{
\"ForecastConfigurationId\":\"0461fb6b-8d85-ea11-a811-000d3a37bb2c\",
\"ForecastRecurranceId\":\"f8b1122c-b913-4e88-9727-368b6134be3e\",
\"SimpleColumnUpdateRequests\":[
{
\"ForecastInstanceId\":\"d8680b00-fd31-46c2-8136-7c4df19cf2a8\",
\"ForecastConfigurationColumnId\":\"65ec7bd1-2de6-49fa-b259-ba74bc721c78\",
\"ForecastConfigurationColumnValue\":0.0,
\"IsRolledUpColumnUpdate\":false},
{
\"ForecastInstanceId\":\"11141300-131b-493a-9857-22bd8689b775\",
\"ForecastConfigurationColumnId\":\"65ec7bd1-2de6-49fa-b259-ba74bc721c78\",
\"ForecastConfigurationColumnValue\":0.0,
\"IsRolledUpColumnUpdate\":false}]}"
}
パラメーター | タイプ | 説明設定 |
---|---|---|
WebApiName | String | API の名前 |
ForecastConfigurationId | GUID | 予測構成 ID |
ForecastRecurranceId | GUID | 予測パターン ID または予測期間 ID |
SimpleColumnUpdateRequests | Array | 次のタスクを実行します |
ForecastInstanceId | GUID | 予測インスタンス ID |
ForecastConfigurationColumnId | GUID | 予測構成列 ID |
ForecastConfigurationColumnValue | ForecastConfigurationColumn のデータ型 | 更新する必要がある値 |
IsRolledUpColumnUpdate (オプション) | ブール型 | True はロールアップ列の値が更新された場合、false は集計列の値が更新された場合です |
回答
{
"@odata.context": "[Organization URI]/api/data/v9.1/$metadata#Microsoft.Dynamics.CRM.msdyn_ForecastApiResponse",
"response": [
{
"Message": "Update Successful",
"StatusCode": 0,
"ForecastInstanceId": "d8680b00-fd31-46c2-8136-7c4df19cf2a8",
"ForecastConfigurationColumnId": "65ec7bd1-2de6-49fa-b259-ba74bc721c78"
},
{
"Message": "Update Successful",
"StatusCode": 0,
"ForecastInstanceId": "11141300-131b-493a-9857-22bd8689b775",
"ForecastConfigurationColumnId": "65ec7bd1-2de6-49fa-b259-ba74bc721c78"
}
]
}
値を返す
ForecastInstanceId
、ForecastConfigurationColumnId
、Message
、StatusCode
で構成される UpdateSimpleColumnByEntityResponse
レコードの一覧。
参照
フィードバック
https://aka.ms/ContentUserFeedback」を参照してください。
以下は間もなく提供いたします。2024 年を通じて、コンテンツのフィードバック メカニズムとして GitHub の issue を段階的に廃止し、新しいフィードバック システムに置き換えます。 詳細については、「フィードバックの送信と表示