Custom Action Query Function

Hi!

This is a sample custom action query function.

Scenario:
Select multiple products and use the custom action button to add the product to another module.

Create 2 modules, a product and a shopping order.

Module: Product

  1. Create a new module as Product
  2. Add information such as SKU, name, price etc.

Module: Shopping Order

  1. Create a new module as Shopping order
  2. Add table for Product.

Add Custom Action in Product

  1. Under ‘Custom’, click +add.

note: Custom is currently Beta.

image

  1. Type the name. eg: Add to cart
  2. Select ‘is multiple’. This is to allow bulk selection of product
  3. Write Javascript (Beta).
    eg:
window.location.href='/#/list/MvbmXV0aYA?a=create&ti=' + items.map(x => x.documentId).join(',')

/#/list/MvbmXV0aYA?a=create
this is the Shopping order new page URL.

image

&ti=
this is to set the query id which this scenario using document id.

+ items.map(x => x.documentId).join(‘,’)
this is to map the select product’s document id

  1. Click ok & save.

Setting product details in the Shopping Order

  1. In the create form, enable automation.

  1. Drag & drop condition block and write the condition as below

image

  1. Drag & drop For each block and write the condition as below

image

  1. Drag & Drop action block and add create action

image

Create: set value x

  1. Add find action.
  2. Choose the product module
  3. Set filter formula ID equal x.

image

  1. Add condition block as below

image

  1. Add action block and add row and set row value

Complete Automation

Result

  1. Select products.

image

  1. Click ‘Add to cart’

image