apex.message.confirm( "Are you sure to reject this work order?", function( okPressed ) {
if( okPressed ) {
apex.item("P30_YOURITEM").setValue("Y");
} else {
// this code will execute if cancel button pressed
apex.item("P30_YOURITEM").setValue("N");
}
});