Microsoft Power Apps เป็นเครื่องมือที่ใช้ในการสร้าง Business Apps โดยที่ไม่จำเป็นต้องเขียนโค้ด ซึ่งสามารถทำงานได้บน Web และอุปกรณ์ Mobile เช่น iOS หรือ Android, เราสามารถนำ PowerApps มาพัฒนา Application สำหรับงานทั่ว ๆ ไป และนำไปใช้แทนการพัฒนาด้วย PHP , Java , C# , VB ได้ ซึ่งเป็นแนวทางการพัฒนาที่เร็วกว่าแบบเดิม ๆ ( ในกรณีที่ App ไม่ซับซ้อน มีการบันทึกแบบหน้าเดียวจบ)
ซึ่งใน blog นี้จะมานำเสนอวิธีการทำงานอย่างง่าย ร่วมกับ Microsoft Dynamics 365 for Finance and Operations กัน
Quick Suggest
หากสนใจเรียนรู้เพิ่มเติม ขอแนะนำบทความ
Connect to MS D365FO from Power Apps
ซึ่งใน blog นี้จะมานำเสนอวิธีการทำงานอย่าง Power Apps ได้เตรียม connector สำหรับเชื่อมต่อกับตัว Dynamics ERP ไว้เรียบร้อยแล้ว โดยเราจะสามารถ access กับ data entities ได้เลย (คล้าย Odata ใน EP ก่อนหน้า)
![Connect to MS D365FO from PowerApps](https://quickerpthailand.com/wp-content/uploads/2023/07/Connect-to-MS-D365FO-from-PowerApps.webp)
(หน้า Home ของ Power Apps)
![Connect to MS D365FO from PowerApps1](https://quickerpthailand.com/wp-content/uploads/2023/07/Connect-to-MS-D365FO-from-PowerApps1.webp)
(ทำการ New connection)
![Connect to MS D365FO from PowerApps2](https://quickerpthailand.com/wp-content/uploads/2023/07/Connect-to-MS-D365FO-from-PowerApps2.webp)
(Search ‘Dynamics’ และเลือก Dynamics 365 for Fin & Ops)
![Connect to MS D365FO from PowerApps3](https://quickerpthailand.com/wp-content/uploads/2023/07/Connect-to-MS-D365FO-from-PowerApps3.webp)
(ไปที่ Apps เลือก New app Canvas)
![Connect to MS D365FO from PowerApps4](https://quickerpthailand.com/wp-content/uploads/2023/07/Connect-to-MS-D365FO-from-PowerApps4.webp)
(เลือก DataSource จาก Entities)
![Connect to MS D365FO from PowerApps5](https://quickerpthailand.com/wp-content/uploads/2023/07/Connect-to-MS-D365FO-from-PowerApps5.webp)
(เข้าสู่หน้า PowerApps Studio)
สามารถปรับแต่งแอป ฯ ด้วย concept low-code, เลือก field ตามการใช้งาน และ preview app ได้เลย
Quick Suggest
หากสนใจเรียนรู้เพิ่มเติม ขอแนะนำบทความ
![Connect to MS D365FO from PowerApps6](https://quickerpthailand.com/wp-content/uploads/2023/07/Connect-to-MS-D365FO-from-PowerApps6.webp)
นอกจากนี้เรายังสามารถ Publish Apps เพื่อใช้ในอุปกรณ์ mobile ได้ และ Share ให้คนอื่นในองค์กรใช้งาน Apps ของเราได้ด้วยเช่นกัน
Embed a PowerApp in MS D365FO
อีกหนึ่งวิธีการ เราสามารถฝังตัว Power Apps เข้ากับ Microsoft Dynamics 365 for Finance and Operations ได้เลย พร้อมทั้ง Passing parameter from D365FO to Power Apps ได้อีกด้วย
![Embed a PowerApp in MS D365FO 1](https://quickerpthailand.com/wp-content/uploads/2023/07/Embed-a-PowerApp-in-MS-D365FO-1.webp)
(Insert a PowerApp)
Scenario showcase ในวันนี้ เราจะมาสร้าง Power Apps ที่ใช้ตรวจสอบสถานะข้อมูลนิติบุคคลของ Vendor ในระบบด้วยเลขประจำตัวผู้เสียภาษีกัน
![Embed a PowerApp in MS D365FO 2](https://quickerpthailand.com/wp-content/uploads/2023/07/Embed-a-PowerApp-in-MS-D365FO-2.webp)
(Showcase)
เริ่มต้นจากการทำ Power Apps กันก่อน
![Embed a PowerApp in MS D365FO 3](https://quickerpthailand.com/wp-content/uploads/2023/07/Embed-a-PowerApp-in-MS-D365FO-3.webp)
เมื่อสร้าง user inteface เรียบร้อย ต่อไปก็เชื่อมต่อ API ซึ่งในที่นี้เราจะใช้ API ของกระทรวงพาณิชย์ (https://data.moc.go.th/OpenData/Juristic)
![Embed a PowerApp in MS D365FO 4](https://quickerpthailand.com/wp-content/uploads/2023/07/Embed-a-PowerApp-in-MS-D365FO-4.webp)
คลิ๊กที่ button เลือก tab Action, function Power Automate และ Create a new flow
Quick Suggest
หากสนใจเรียนรู้เพิ่มเติม ขอแนะนำบทความ
![Embed a PowerApp in MS D365FO 5](https://quickerpthailand.com/wp-content/uploads/2023/07/Embed-a-PowerApp-in-MS-D365FO-5.webp)
สร้าง Flows จากการ Click ว่าให้ทำการ request api และรับค่า response กลับมา
![Embed a PowerApp in MS D365FO 6](https://quickerpthailand.com/wp-content/uploads/2023/07/Embed-a-PowerApp-in-MS-D365FO-6.webp)
ส่งค่าไปยัง flow และประกาศตัวแปรมารับ response
![Embed a PowerApp in MS D365FO 7](https://quickerpthailand.com/wp-content/uploads/2023/07/Embed-a-PowerApp-in-MS-D365FO-7.webp)
นำ response มาใส่ใน datasource ของ Gallery
![Embed a PowerApp in MS D365FO 8](https://quickerpthailand.com/wp-content/uploads/2023/07/Embed-a-PowerApp-in-MS-D365FO-8.webp)
Display response field
![Embed a PowerApp in MS D365FO 9](https://quickerpthailand.com/wp-content/uploads/2023/07/Embed-a-PowerApp-in-MS-D365FO-9.webp)
ต่อมาเป็นส่วนสำคัญในการรับค่าจาก Microsoft Dynamics 365 for Finance and Operations
If(!IsBlank(Param("EntityId")), Set(FinOpsInput, Param("EntityId")), Set(FinOpsInput, ""));
![Embed a PowerApp in MS D365FO 10](https://quickerpthailand.com/wp-content/uploads/2023/07/Embed-a-PowerApp-in-MS-D365FO-10.webp)
![Embed a PowerApp in MS D365FO 11](https://quickerpthailand.com/wp-content/uploads/2023/07/Embed-a-PowerApp-in-MS-D365FO-11.webp)
เป็นอันเสร็จเรียบร้อย.. แต่ก่อนที่เราจะไปฝัง Power Apps ในตัว ERP จด App ID ตรงนี้ก่อนซักนิด
![Embed a PowerApp in MS D365FO 12](https://quickerpthailand.com/wp-content/uploads/2023/07/Embed-a-PowerApp-in-MS-D365FO-12.webp)
ไปยังโปรแกรม Microsoft Dynamics 365 for Finance and Operations เข้าหน้าจอที่เราต้องการใช้งาน, ขวามุมบนเลือก Insert a PowerApp
![Embed a PowerApp in MS D365FO 13](https://quickerpthailand.com/wp-content/uploads/2023/07/Embed-a-PowerApp-in-MS-D365FO-13.webp)
Name : ชื่อแอปพลิเคชัน
App ID : รหัสที่จดไว้ด้านบน Input data for the PowerApp : เลือก control name ของหน้าจอที่ต้องการให้ส่งข้อมูลไปที่ PowerApps
Application size : ขนาดของแอปพลิเคชัน
![Embed a PowerApp in MS D365FO 14](https://quickerpthailand.com/wp-content/uploads/2023/07/Embed-a-PowerApp-in-MS-D365FO-14.webp)
เพิ่มเสร็จแล้ว refresh page และลองใช้งาน
![Embed a PowerApp in MS D365FO 15](https://quickerpthailand.com/wp-content/uploads/2023/07/Embed-a-PowerApp-in-MS-D365FO-15.webp)
![Embed a PowerApp in MS D365FO 16](https://quickerpthailand.com/wp-content/uploads/2023/07/Embed-a-PowerApp-in-MS-D365FO-16.webp)
สามารถ clear Power Apps ได้ โดยใช้ Personalize this form -> Clear
![Embed a PowerApp in MS D365FO 17](https://quickerpthailand.com/wp-content/uploads/2023/07/Embed-a-PowerApp-in-MS-D365FO-17.webp)
สุดท้ายนี้ การนำไปประยุกต์ใช้งาน สามารถทำได้หลายเคสที่มีประโยชน์และน่าสนใจ ยกตัวอย่างเช่น EMS Tracking จากหน้าจอ Sales Order เป็นต้น
ก้าวเข้าสู่ Digital Business
ดูผลิตภัณฑ์ที่เกี่ยวข้องได้ที่นี่