← Back to list

Nintex RPA Reusable Global Function

การใช้งาน Nintex RPA เรามักจะเคยเจอปัญหาที่ต้องทำงานโดยใช้คำสั่งเดิมซ้ำๆกันหลายๆครั้ง เช่นการคำนวณ…

Yossapon Pornparisa (Yos) · 2024-02-14 14:39 · 0 claps · 2.1 min read
#rpa-tools #robotics-automation #best-practices #nintex #technology
Open on Medium ↗

Nintex RPA Reusable Global Function

การใช้งาน Nintex RPA เรามักจะเคยเจอปัญหาที่ต้องทำงานโดยใช้คำสั่งเดิมซ้ำๆกันหลายๆครั้ง เช่นการคำนวณ การจัดการไฟล์ต่างๆบนเครื่องโดยที่วิธีการทำงานข้างในเหมือนเดิม ถ้าหากเราใช้วิธีการทำงานแบบถึกๆ เหมือนปกติเราก็จะต้องใช้ Advanced command เดิมๆซ้ำไปเรื่อยๆทำให้ command เยอะจนดูรกไปหมด แต่ละคนก็มี style ในการ config command ไม่เหมือนกัน คนมาดูงานต่อจะรู้สึกอยากสาปแช่งเราในใจ 🤬😡😤

Nintex RPA มีวิธีการทำงานที่จะช่วยเราส่วนนี้ได้ด้วยการสร้าง Reusable global function จะช่วยลดระยะเวลาการทำงานของเราลงได้ และทำให้ Command ใน wizard ของเราดูอ่านง่าย มีการทำงานที่ถูกต้องและเป็นไปตาม Standard ที่กำหนดขึ้นได้

เรามาลองสร้าง Global Function กันในตัวอย่างนี้เราจะสร้าง function ที่คำนวณค่า vat 7% โดยให้ wizard ส่งค่าราคาสินค้ารวม vat เข้ามาใน function แล้วให้คำนวณค่า ราคาไม่รวม vat, vat เอาออกมาใช้ใน wizard

Let’s create Global Function

Let’s create Global Function

ใน function จะทำงานโดย set value priceWithoutVat ด้วย priceWithVat * 0.93 และคิด 7% ที่เหลือเก็บไว้ใน vatValue

ใน wizard เราจะใช้ Global function ได้เลย ในตัวอย่างจะกำหนดให้ priceWithVat = 13000 ก่อนเริ่มทำงานใน function เราก็จะได้ pricewithoutvat, vatvalue ที่คิดมาจากใน function

เอ แล้วช่องตรงกลาง function ที่เรียกว่า Run-time Adjustment zone ล่ะถ้าเรา set variable ลงไปในนั้นมันจะไปทำงานตอนไหนของ function ล่ะ

แก้ function ให้ show message ขึ้นมา

จะเห็นว่าตอน function start จะยังไม่มีค่า

มันจะใช้ได้ใน function end ของ global function

ถ้าจะ pass variable ไปใน Run-time Adjustment Zone ของ global function ให้ไป config command ไว้ที่ function end แต่ถ้าทำงานใน function start ให้ prepare variable ให้เสร็จก่อน function ทำงาน

แต่ตาม article Nintex จะบอกไว้ว่า Global Function ประกอบด้วย 3 components Global Functions (nintex.com)

  1. Function Start ใช้ set default values หรือเตรียม parameter สำหรับ action
  2. Run-time Adjustment Zone ใช้ใส่ command ก่อนที่จะเข้ามาทำงานใน global function
  3. Function End คือ Main action ตาม best practice ควรมา config การทำงานในนี้

งั้นที่ถูกหน้าตาของ global function ควรจะเป็นแบบนี้

Move action to function end

Move action to function end

และ Wizard ที่มาเรียกใช้ควรจะมีหน้าตาแบบนี้

ก็จะทำงานได้ถูกต้อง

ปล. การใช้ global function ทำให้เราลดการทำงานลงได้จริง แต่ๆๆๆระวังเวลาที่จะแก้ด้วยบางทีเราเอาไปใช้หลายที่แล้วแล้วเราไปแก้ทำให้กระทบการทำงานหลายจุดถ้าจะแก้ก็ลองดูก่อนว่ามีใครเอาไปใช้บ้างนะ😅😅


메타데이터
post_id
0dfb2d60eed7
slug
nintex-rpa-reusable-global-function-0dfb2d60eed7
url
https://medium.com/@p.yosysp/nintex-rpa-reusable-global-function-0dfb2d60eed7
canonical_url
https://medium.com/@p.yosysp/nintex-rpa-reusable-global-function-0dfb2d60eed7
author_url
https://medium.com/@p.yosysp
status
ok
fetched_at
2026-07-24 10:18:17