Unexpected exception while validating invocable action requests - validation

When we try to change the pricebook to add products in opportunity; we are not able to do it because of one validation rule(that is we can not edit opportunity if this opportunity does not contain opportunity products )
I wrote the validation rule:
NOT(OR(ISNEW(),IF(ISCHANGED(Pricebook2Id),true,HasOpportunityLineItem) ))
when the validation rule should trigger, it triggers and showing error message as expected, but when it should not trigger it is showing some different error( not validation rule error) like:
"Can't update Price Book. Unexpected exception while validating invocable action requests"
Can anyone suggest anything?

jhumur
I think the appropriate object should be PricebookEntry rather than Pricebook2.

Related

Microsoft Access - not using a validation code

Under PostCode, I've put an input mask as well as a validation rule of 'Is Not Null'
The input mask is working fine. However, the validation rule isn't working as it allows the postcode to be null.
Is there a way to fix this?
Options I can see:
Nz([Postcode],"")<>""
set field as required in table and let Access nag users
validation code in BeforeUpdate event of control and form

Laravel 5.6 ERR_TOO_MANY_REDIRECTS on GET request

I have a custom Request class which deals with the validation of a form. This form uses 'GET' and will filter down all the results the User can see on the page.
My rule for the start date:
'date_start' => 'nullable|date|required_with:date_end',
is causing a message:
ERR_TOO_MANY_REDIRECTS
My controller looks like this:
public function index (ApprovedSubmissionsFilterRequest $request)
{
...
I believe that this is because when the validation fails, it sends a GET request back to the index method, which once more fails the validation and redirects back to the index method etc. etc.
How do I avoid this loop? I do not want to use a POST request instead of a GET.
Here is my route:
Route::get('formSubmission', 'FormSubmissionController#index')
->name('formSubmission.index');
Thank you.
NOTE (edit):
Not all validation errors cause this - it only seems to be the required_with that is causing the issue. Somebody has mentioned it here previously.
I tried your code in my project, and cannot reproduce the problem. So do you really use the correct validation rule, because from the docs, the required_with takes an effect only if the other field that you are trying to validate exists in the request. So in your case date_start should not be present in the request and date_end should exist in order for this validation to take place:
required_with:foo,bar,...
The field under validation must be present and not empty only if any of the other specified fields are present.
Also from the github issue that you have mentioned, you can debug in the exception handler what happens when ValidationException is thrown
Your last note, have you tried with all validation rules except that one if it passes?

Add a global error in Spring MVC from a non-controller location

Somewhere in my Spring MVC app I need to add a global error. I no longer have access to any BindingResult, I only have my Request. My error is not the result of any binding issues, it's a global condition. Then I need to attach my new Errors object to the "errors" Req. attribute, so the JSP can display it.
But how to do this? I can't do
Errors errors = new Errors();
errors.reject(....);
request.setAttribute("errors", errors);
because Errors is an interface. The implementations all have to do with 'Binding',like BindException, AbstractBindingResult, MapBindingResult, etc. These all have nothing to do with my case, I don't have a binding field error, it's a general error msg.
Any tips?
Our resolution to this problem: The proper way to handle EXCEPTIONS (rather than VALIDATION errors) is to keep track of our own, custom Request Attribute that we display ourselves in our error area on the JSP.
BindingResult/Errors/etc. are all Binding-related, we can't hack it to handle general exception errors.
We just add a custom Request Attr. called "exceptions" and then our Error section checks for this additonal attribute list to display.
SpringMVC doesn't provide its own 'generic' Error collection.

IBM Integration Toolkit Issue for Validation

I am working on IBM Integration toolkit. I wanted to understand the exact validation feature of a particular input node via an example. Can anyone help?
Validation on inputs node you can see them in validation tab, you can choose how to validate (content, conent and value or none if you like to implement your own vaildation and what to do if this validate is failure (Exception , Exception List , user trace, log local error),
validation done automatically depends on the message parser : [BLOB, XMLNSC, XMLNS, SOAP, MRM, ..etc ], and message structurewhich is defined in your message set.
for example :
If you create a message set with message definition file and this message definition has got and element and this element is required and integer, and you set this message set to your input node, validation feature runs automatically if you put for example string value or you left it empty validation exception occurs.

Codeigniter Form Validation - Is there a way to define multiple different %s when setting error messages?

Based on the documentation, %s will be replaced by field name when setting error messages.
If you include %s in your error string, it will be replaced with the
"human" name you used for your field when you set your rules.
Is there a way to have multiple %s in the string and define them differently?
This is the line in the form validation library that creates the error message:
// Build the error message
$message = sprintf($line, $this->_translate_fieldname($row['label']), $param);
$line: The error message template, for example "The % field is invalid"
$this->_translate_fieldname($row['label']): The field's label
$param: The parameter passed the the validation function, if any, max_length[5] would pass "5"
So that's the extent of what the form validation class does for you. If you need more flexibility you'll have to prepare the error message yourself <-- might be useful beforehand with the extra variables already populated.
It might be interesting to extend the form validation class via core/MY_form_validation.php and work this functionality in. Unfortunately this line is contained in the main function _execute which is very big and messy, and from looking at it now, you'd need to overload some other functions as well. I started to write an example but it actually looks like a chore. You might be better off using:
$this->form_validation->set_message('rule_name', 'Your custom message here');
More on setting error messages: http://ellislab.com/codeigniter/user_guide/libraries/form_validation.html#settingerrors

Resources