Skip to content

Instantly share code, notes, and snippets.

@sergeytunnik
Created November 5, 2019 20:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sergeytunnik/59476d80c0786e71522565ed65b554ec to your computer and use it in GitHub Desktop.
Save sergeytunnik/59476d80c0786e71522565ed65b554ec to your computer and use it in GitHub Desktop.
export namespace TimelineWallControl {
export type Command = "Assign" | "Delete" | "Close Activity" | "Add to Queue" | "Open Entity Record";
export function HideCommand(commandName: Command): void {
const timer = setInterval(() => {
try {
const parent = window.parent as any;
const activityCommands = parent.MscrmControls.TimelineWallControl.Utility.CommandFactory.ActivityCommands as Record<Command, any>;
if (activityCommands === undefined) {
throw new Error("ActivityCommands is undefined");
}
activityCommands[commandName] = {};
const timeline = Xrm.Page.getControl("Timeline");
timeline.refresh();
console.log("Clearing interval.");
clearInterval(timer);
} catch (err) {
console.log(`Error: ${err.message}.`);
}
}, 500);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment