Bỏ qua, đến nội dung

Ví dụ sử dụng - JSON Variable Mapping ​

Ví dụ 1: Chuẩn bị payload cho API CRM bên ngoài ​

Chuyển đổi dữ liệu khách hàng từ format nội bộ (camelCase) sang format API CRM (snake_case).

Cấu hình mapping rules:

SourceTargetType
record.firstNamefirst_namedirect
record.lastNamelast_namedirect
record.emailcontact_emaildirect
record.phonephone_numberdirect
—sourceconstant ("digiforce")
—created_byconstant ("api-sync")

Mapping node chuyển camelCase sang snake_case và thêm metadata cố định (source, created_by) cho API CRM.

Ví dụ 2: Gộp dữ liệu từ nhiều nguồn thành audit log ​

Kết hợp thông tin từ trigger data, user context, và kết quả node trước thành một object audit log.

Cấu hình mapping rules:

SourceTargetType
user.iduserIddirect
user.nicknameuserNamedirect
request.actionactiondirect
request.bodynewDatadirect
—timestamptemplate ("[now]")
request.params.collectioncollectiondirect

Multi-source mapping: dữ liệu từ biến user, request được kết hợp vào một object duy nhất để insert vào bảng audit logs.

Ví dụ 3: Tạo payload email từ dữ liệu đơn hàng ​

Chuẩn bị dữ liệu cho email template: gộp thông tin đơn hàng, khách hàng, và tổng tiền.

Cấu hình mapping rules:

SourceTargetType
record.customer.emailtodirect
record.orderCodeorderCodedirect
record.totalAmounttotaldirect
aggregateNode.resultitemCountdirect
record.customer.namecustomerNamedirect
—subjecttemplate ("Xác nhận đơn hàng #[record.orderCode]")

Mapping node tổng hợp dữ liệu cần thiết cho email template. Field subject dùng type template để ghép mã đơn hàng vào tiêu đề email.