Last active
December 19, 2024 12:23
-
-
Save AshikaSuresh/4c1454aa0c2a21036b68c5b55a607e47 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Zylker is a manufacturing organisation that uses Zoho CRM. The subform in Quotes module should filter products based on the selected Product Category. In Quotes Module, when the quantity in the Quoted Items subform exceeds available stock, the system must display an error and reset the field to null. | |
1. Dynamic row value based filter : onLoad Page Event with setCriteria() | |
2. Error message : onCellChange Event with showError() | |
3. Clearing cell : onCellChange Event with setValue() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Subform - Quoted_Items - onCellChange | |
if (field_name == 'Quantity') { | |
var product = ZDK.Page.getSubform('Quoted_Items').getRow(index).getCell('Product_Name').getValue(); | |
log(product.id); | |
var product = ZDK.Apps.CRM.Products.fetchById(product.id); | |
var quantity = product._Qty_in_Stock; | |
// log(product) | |
log(quantity) | |
if (value >= quantity) { | |
var cell_obj = ZDK.Page.getSubform('Quoted_Items').getRow(index).getCell('Quantity'); | |
cell_obj.showError('Quantity out of stock'); | |
cell_obj.setValue(null); | |
log('done') | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Page - onLoad Event | |
let field_obj = ZDK.Page.getSubform("Quoted_Items").getField('Product_Name'); | |
field_obj.setCriteria("(Product_Category:equals:{{Quoted_Items.Product_Category}})", {filterOnSearch: true}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment