ZDK function | Description |
getField | To fetch the field information by api name |
getFields | To fetch the list of fields in the Page as an array |
getApiName | To fetch the API name of field |
mask | To mask the field value |
showError | To show inline error message for an input field |
setValue | To set the value for a field |
getValue | To get the value of a field |
setMandatory | To set the mandatory attribute for the input field |
setMaxLength | To set the max length of field input |
setReadOnly | To set the read-only attribute of field input |
Category | Products |
Ignition system | Sparking cable, Ignition box, Ignition coil, Spark plug |
Gauges and meters | Speedometer,Odometer, Voltmeter, Temperature gauge |
switch (field_name) { case 'Product': var product_name = ZDK.Page.getField('Product').getValue(); var category_field = ZDK.Page.getField('Category'); // requirement - 1 if (['Sparking cable', 'Ignition box', 'Ignition coil', 'Spark plug'].includes(product_name)) { // Populate value for picklist field 'Category' based on the condition category_field.setValue("Ignition system"); ZDK.Page.getField('Number_of_Boxes').setMandatory(true); // requirement - 2 } else if (['Speedometer', 'Odometer', 'Voltmeter', 'Temperature gauge'].includes(product_name)) { // Populate value for picklist field 'Category' based on the condition category_field.setValue('Gauges and meters'); } break; case 'Phone_Number': var phone_field = ZDK.Page.getField('Phone_Number'); if (phone_field.getValue().length < 10) { phone_field.showError('Enter a valid phone number'); // requirement - 4 } break; case 'Country': ZDK.Page.getField('Phone_Number').setMaxLength(10); break; case 'Category': if (ZDK.Page.getField('Category').getValue() === 'Ignition system') { ZDK.Page.getField('Number_of_Boxes').setMandatory(true); // requirement - 2 when category is changed in ui } break; } |
var user = ZDK.Apps.CRM.Users.fetchById($Crm.user.id); if (user.profile.name !== 'Administrator') { ZDK.Page.getField('Phone_Number').mask({ character: '*', length: 5, reverse: true }); } |
Writer is a powerful online word processor, designed for collaborative work.