Last active
April 29, 2024 08:15
-
-
Save arvind-zohocrm/ddf97d21e27a7ce24cec595f1ba7481a to your computer and use it in GitHub Desktop.
Client Script code samples
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
var Category = ZDK.Page.getField('Type').getValue(); | |
var Product = ZDK.Page.getSubform("Instruments_List").getField("Instrument_Name"); | |
Product.setCriteria("(Instrument_Category:equals:"+Category+")", { filterOnSearch: true }); |
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
ZDK.Client.createFlyout('myFlyout', { header: 'Shipment Charges', animation_type: 2, height: '400px', width: '420px', top: 'center', right: '0' }); | |
ZDK.Client.getFlyout('myFlyout').open({ api_name: 'widget_api_name', type: 'widget' }); | |
var response = ZDK.Client.getFlyout('myFlyout').notify({ data: value }, { wait: true }); | |
ZDK.Client.getFlyout('myFlyout').close(); | |
log('??? ', response); | |
ZDK.Page.getField('Shipment_Charge').setValue(response.price); | |
ZDK.Page.getField('Shipping_Speed').setValue(response.speed); | |
ZDK.Page.getField('Warehouse').setValue(response.wh); |
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
ZDK.Page.getList().freezeColumns(true); | |
ZDK.Page.getList().style( | |
{ | |
record: { backgroundColor: '#e9fbf4' }, | |
field: { Status: { backgroundColor: '#e9fbf4', foregroundColor: '#00cc44' , fontWeight: 'bold' } } | |
}, | |
"((Status:equals:Delivered))" | |
); | |
ZDK.Page.getList().style( | |
{ | |
field: { Status: { foregroundColor: '#ff6666' , fontWeight: 'bold' } } | |
}, | |
"((Status:equals:Cancelled))" | |
); | |
ZDK.Page.getList().style( | |
{ | |
field: { Status: { foregroundColor: '#2d72d9' , fontWeight: 'bold' } } | |
}, | |
"((Status:equals:Approved))" | |
); | |
ZDK.Page.getList().maskField('Phone', { length: 10, character: '*', reverse: false }); | |
var count = 0; | |
var rec = ZDK.Page.getList().getRecords(); | |
rec.forEach(x => { | |
if ((x.Warehouse == "San Bruno") && (x.Status == "Created")) { | |
count++; | |
} | |
}); | |
if (count != 0) { | |
ZDK.Client.showConfirmation("Hi " + $Crm.user.full_name + ", " + "[" + count + " orders](http://google.com) are *overdue* and are _not approved yet_. \n\nWould you like to approve them now?", 'Yes. Approve!', "No, Not now"); | |
} |
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
var Phone = ZDK.Page.getField('Phone'); | |
Phone.mask({ character: '*', length: 10, reverse: false }); |
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
var field_obj = ZDK.Page.getField('Warehouse'); | |
log(field_obj.getValue()); | |
var Warehouse_data = field_obj.getValue(); | |
var resp = ZDK.Client.openPopup({ api_name: 'widget_api_name', type: 'widget', header: 'Delivery Error Alert', animation_type: 1, close_icon :false, height: '350px', width: '650px', left: 'center' }, { data: ZDK.Page.getForm().getValues() }); | |
log(resp); | |
ZDK.Page.getField('Warehouse').setValue(resp); | |
ZDK.Client.showMessage('Warehouse changed successfully.', { type: 'success' }); |
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
var label = ZDK.Page.getField('Name'); | |
label.setReadOnly(true); |
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
var status = ZDK.Client.showConfirmation('Do you want to update the status as *'+value+'*?', 'Yes', 'No'); | |
return status; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment