0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

Power AutomateにてCDSソリューションの環境変数を取得する

Last updated at Posted at 2020-07-04

CDSソリューションの環境変数とは

CDSの環境にて、共有できる変数を設定する機能。
ソリューションに追加することができるので、ソリューションでのデプロイができる。
デプロイした先にて、環境変数を上書きして使用する。
また、ツールでのデプロイにも使える。
image.png

ただし、2020年7月4日時点では、プレビュー機能です。
https://docs.microsoft.com/ja-jp/powerapps/maker/common-data-service/environmentvariables

目的

  • Power Automateで環境変数で変数を使い回す
  • Power Automateで環境変数を取得する

ちょっと困ったこと

環境変数の正しい値を取るのが現時点ではめんどい。(GAになったらそれ用のアクションとかつくってくれそうだけど)

環境変数は登録すると、CDSのEnvironment Variable DefinitionとEnvironment Variable Valueというエンティティにデータが格納される。
image.png

Default Value あり
Current Value なし

Environment Variable Definition あり
Environment Variable Value なし
image.png
image.png

Default Value あり
Current Value あり

Environment Variable Definition あり
Environment Variable Value あり
image.png
image.png

環境変数を正しく取得するには、まずEnvironment Variable Valueの値を検索して、
存在しなければ、Environment Variable Definitionを検索する必要がある。

ちなみに、DefinitionとValueは1:Nのリレーションシップなので、複数のValueが持てそうだが、
設定しようとすると、Pluginでエラーになります。
image.png

やったこと

環境変数を取得するロジックを子フローにしました。
image.png

GitHubにソリューションファイルを上げました。
https://github.com/simpliciter11/Power-Platform/tree/master/Power-Automate/GetAnEnvironmentVariable_1_0_0_1

注意事項

  • サンプルのフローの戻り値のデータ型はTextになります。
    • 環境変数のデータ型は、Decimal Number、JSON, Text, Two optionsすべてで動作確認しました
    • ただし、繰り返しになりますが、戻り値はTextです。呼び出し側のフローで変換してください。
  • サンプルのフローは、軽く試してみたけど、ソリューションをインポートしただけだと動かないです
    • 以下の設定が必要です(追加でなにか必要かもしれないですが)
      • CDSにアクセスしているところの接続の認証を通す
      • 親と子のフローをオンにする
      • 子のフローにて、「実行専用アクセス許可を管理」の設定を変更する
    • ナレッジがたまったら、ソリューションでのデプロイについてまとめたい気がする
      image.png
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?