Forum Discussion
Hi,
there is not id when using onBeforePromote. Throw an error message just with "this" and you will see.
It only contains an idlist:
Innovator inn = this.getInnovator();
// Get the Items(s) affected by this promotion
string idlist = this.getAttribute("idlist");
// Get items by idlist
Item xy= inn.newItem("xy", "get");
xy.setAttribute("idlist", idlist);
xy.setAttribute("select","xy");
xy= xy.apply();
// Prevent execution of code if more than one items was selected (if you want this behavior...)
int itemCount = xy.getItemCount();
if (itemCount > 1)
{
return inn.newError("This action only works for one item...");
}
onBeforePromote is not my favourite kind of event. If you can achieve the same behavior with a LifeCycle pre Method, better use this one!
Bye
Angela