Skip to content

Instantly share code, notes, and snippets.

@AshikaSuresh
Last active December 19, 2024 12:22
Show Gist options
  • Select an option

  • Save AshikaSuresh/1464c13425a125c0f162264dd98fdb8b to your computer and use it in GitHub Desktop.

Select an option

Save AshikaSuresh/1464c13425a125c0f162264dd98fdb8b to your computer and use it in GitHub Desktop.
At Zylker, the admin felt ensuring data integrity during key Deal stages is crucial. To prevent accidental loss of information, deleting items from the subform is restricted when a deal is in the following stages: Proposal/Price Quote, Negotiation/Review, Closed Won, Closed Lost, or Closed Lost to Competition.
Row Delete Prevention : beforeRowDelete subform Event by returning false after verifying Deal Stage.
//Detail Page - Subform Items beforeRowDelete
const restricted_Stages = ["Proposal/Price Quote","Negotiation/Review","Closed Won","Closed Lost","Closed Lost to Competition"];
let stage = ZDK.Page.getField('Stage').getValue();
if (restricted_Stages.includes(stage)) {
ZDK.Client.showAlert("Order deletion is not allowed once the deal reaches the "+stage+" stage.","Can't delete!","Got it!");
return false;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment