RE: InvalidPluginExecutionException message to portal
Is the record being created from the portal? If so, why not validate it before you create anything in crm? Doing that will help prevent unclean data from getting into the system. Validating the data before create in the portal can be done easily with JQuery and JavaScript
if (window.jQuery) {
(function ($) {
if (typeof (entityFormClientValidate) != 'undefined') {
var originalValidationFunction = entityFormClientValidate;
if (originalValidationFunction && typeof (originalValidationFunction) == "function") {
entityFormClientValidate = function ()
{
//DO VALIDATION HERE. RETURN TRUE IF PASSED AND FALSE IF FAIL
};
}
}
}(window.jQuery));
}
To output a message to the user on fail here is a code snippet that will work:
$('.notifications').append($("<div class='notification alert alert-danger' role='alert'>PUT ERROR MESSAGE TEXT HERE</div>"));
I do want to note that the first snippet of code will only validate on entity forms (entityFormClientValidate) if you need it to work on web forms then replace entityFormClientValidation with webFormClientValidate