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
- Create a new module as Product
- Add information such as SKU, name, price etc.
Module: Shopping Order
- Create a new module as Shopping order
- Add table for Product.
Add Custom Action in Product
- Under ‘Custom’, click +add.
note: Custom is currently Beta.
- Type the name. eg: Add to cart
- Select ‘is multiple’. This is to allow bulk selection of product
- 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.
&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
- Click ok & save.
Setting product details in the Shopping Order
- In the create form, enable automation.
- Drag & drop condition block and write the condition as below
- Drag & drop For each block and write the condition as below
- Drag & Drop action block and add create action
Create: set value x
- Add find action.
- Choose the product module
- Set filter formula ID equal x.
- Add condition block as below
- Add action block and add row and set row value
Complete Automation
Result
- Select products.
- Click ‘Add to cart’