Skip to content

Instantly share code, notes, and snippets.

@arvind-zohocrm
Last active April 29, 2024 08:15
Show Gist options
  • Star 7 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save arvind-zohocrm/ddf97d21e27a7ce24cec595f1ba7481a to your computer and use it in GitHub Desktop.
Save arvind-zohocrm/ddf97d21e27a7ce24cec595f1ba7481a to your computer and use it in GitHub Desktop.
Client Script code samples
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 });
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);
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");
}
var Phone = ZDK.Page.getField('Phone');
Phone.mask({ character: '*', length: 10, reverse: false });
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' });
var label = ZDK.Page.getField('Name');
label.setReadOnly(true);
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