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?

Microsoft Power Apps からPower Automate へ値を送るテスト

Posted at

今回行いたいこと:

  1. Power Apps の「テキスト入力」コンポーネントに入力した値(今回はテキストと数値の2種)を、「ボタン」コンポーネントを介してPower Automate へ送る手順を把握
  2. Power Automate のメーカーポータルの「実行履歴」で値を受け取れたことを確認

キャンバスアプリ及びフローの作成と確認の流れ

まずは以下のスクリーンショットのように、「テキスト入力」(書式はテキスト)と「ボタン」を作成。

03.png

Power Automate のフローを新規作成します。以下のスクリーンショットのように、画面左側の三点リーダーより「Power Automate」をクリック。

04.png

「フローを新規作成する」ボタンをクリックし、

05.png

表示された画面左上にある「一から作成」ボタンをクリック。

06.png

まっさらなフローが表示されるので、

07.png

「Power Apps (V2)」で「テキスト」を選択し、

08.png

左側の狭いテキストフィールドで変数名(?)、右側でその説明文を入力するのですが、今回はそのままにします。

09.png

「新しいステップ」をクリックし、今回は「終了」のアクションを入れておきます。

10.png

Power Automate メーカーポータルで見つけやすいようにフローに名前を付けておきます。

11.png

フローの作成が完了するとPower Apps 側に反映されます。

13.png

ボタンの「OnSelect」プロパティに、フロー名.Run() を入れ、テキスト入力コンポーネントの値を引数とします。

14.png

ブラウザの別タブでPower Automate のメーカーポータルを開いておきます。

15.png

Power Apps でテスト実行。

16_test.png

Power Automate のメーカーポータルの実行履歴に成功のログが出たのでそれをクリックし、

17.png

出力欄の値をのぞいてみます。Power Apps で入力した文字列がちゃんと送られたようです。

18b.png

さて次はテキストと数値の両方をPower Automate へ送ってみようと思います。
ボタンのOnSelectプロパティのコードに対してカンマ区切りで第2引数を入れられるようだったので、「TextInput2.Value」を加えてみます。2つ目のテキスト入力の書式を数値としたので、プロパティを.Valueにしてみたのですがきっと違う...。

19.png

エラーが出てしまいました。
まずプロパティの.Valueは認識できないので.Textにする必要があることと、Power Apps 側の引数の数とPower Automate 側の受け手?の数にミスマッチが生じているようです。

20.png

Power Automate 側を見るとテキストの入力項目しかないので、「入力の追加」をクリックして、

21.png

「数」を選択します。

22.png

例によって変数名(?)とその説明文はそのままにします。

23.png

Power Automate 側でフローを編集したので、Power Apps で「最新の情報に更新」を行います。

24.png

Power Apps でテストを実行してみます。

27.png

Power Automate の実行履歴から値が正常に取得できたことを確認できました。

28.png

Power Apps 側の引数の順番とPower Automate 側の入力の順番は連動している。

試しに引数の順番を逆にしてみたところ、

30.png

テスト時に型エラーがでてしまいました。

31.png

Power Apps のテキストをPower Automate の数値入力に送ろうとしたために型エラーが出てしまったようです。従って、Power Apps 側の引数の順番とPower Automate 側の入力の順番は連動しているようです。

参考

Power Automate フローをトリガーできるキャンバス アプリを作成する(Microsoft Learn)
Power Automate ペインを使用する(Microsoft Learn)

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?