How to display Salesforce Validation Rule error messages at once via the API - salesforce

In the current version of Salesforce,
IF I have multiple Validation Rules Error message defined on one object
AND IF these rules are not respected when clicking on Save
THEN I get multiple error messages (all at once).
This is what I would like to have when using API calls.
As it is now, I am only getting error messages one by one via API calls. Is there any way to display all error messages at once, as it is in the Salesforce interface?

No, currently API processing stops at the first error and report thats, there's no way to have to report all the errors.

Related

Why webhook never finishes after calling Slack in Azure LogicApps?

I have LogicApps and trying to do Webhook to Slack.
I understood that webhook is done by giving a single URL to the webbook.
I can successfully post messages to the Slack channel. No errors.
However, the pipeline never completes. It is running forever unless I cancel it. I wonder why?
We discovered that this is due to one of the following causes after testing it in our environment.
The subscribe-URL for Webhooks :
We've seen the identical issue you're getting when there isn't a correct link supplied.
The body of the subscription :
The similar problem occurs when the structure of the JSON inside the body of the subscription is not properly organized.

How to read azure service queue message in Logic apps?

I am trying to create small Azure Logic app which will have some order flows.I will get the message in service bus queue. I need to get the message in logic app and based upon the message content, I need to follow the further steps. The message will contain the order data as well. There will be conditional logic, let's suppose, if order type is "new", I need to call HTTP request where I need to pass the message data as body content in POST request.
I have create a service bus queue and in logic apps, added service bus trigger which will be called when message will be received in service bus queue(automatically).
I need to able to implement conditional logic but as i am newbie in this, i am not sure how to pass this data in condtional logic from message.
You just need to mention the condition in the block and design the flow that we require. If the condition is true I have added the HTTP action mentioning the required details. For understanding purpose I have mentioned the other condition to trigger an email.
Here the flow of my logic app
If you want to continue the flow just click Add an action in True Connector.
REFERENCES:
Get started with Azure Service Bus queues (Azure.Messaging.ServiceBus) - Azure Service Bus | Microsoft Docs

Azure AD B2C Custom Policy Localized REST API Conflict Response

This is sort of an extension of this question here. I have a policy that calls a REST API. The API returns an error message and this message needs to be localized.
One way is to of course get the API to return a localized message, but is there a way for the CustomPolicy itself to localize the error code? According to the CustomPolicy Docs, a REST API can send an error code along with the Conflict error code. Our thinking was to use this error code as a key and select a localized message (from the messageValue enum mentioned in the answer in the link).
However, we can't seem to capture/handle the error data returned by the API. The Policy seems to handle error codes by itself and we would like to know if it is possible to inject localized exception/error messages from the policy itself.
Thanks in advance!
Edit: A little more information about the setup. We have a TechnicalProfile that has a DisplayWidget and a ValidationTechnicalProfile. The DisplayWidget is used for entering & verifying the user's phone/email and the ValidationTechnicalProfile makes the final call to the RestAPI with all the user's information to register him/her. This RestAPI call output is what we want to localize.
The suggestion in the linked SO question, from what I understand, is that we integrate another DisplayClaim (that references an enum) in the DisplayWidget, and depending on the ErrorCode returned by the call, change it to display the appropriate code. However, as per my understanding, this would also require editing the API to return only 200 along with a code. This code would indicate the true nature of the result - success or a code for one of the enums to be displayed.
Our aim therefore is to check if there is a way to follow the Policy's flow (disrupt the SignUp/SignIn process) but at the same time localize the API's displayed response.
We managed to find a workaround to this, so I'm posting this here for anyone else who might be interested in this.
Our restriction for localizations was the fact that used Phrase to manage our translations and wanted the CustomPolicy specific translations all in one place. Our CD workflow was as follows:
PolicyCommit -> Build Variable Replacement through PS -> Release Variable Replacement and localized strings replacement through PS & Policy Uploads
Barring the policy from localizing the APIs response, we had the following options to achieve this:
Sending the language to the API and having the API return the appropriate error message
in the appropriate language. We were reluctant to follow this because of a multitude of reasons, but mostly because we would also have to handle different regions, etc. in the API - something the policy does by itself.
We actually had only one API that we called, and also only two error messages that were used. Hence we created an enum with the two error messages that would be localized. We then used a chain of InputClaimsTransformations that did the following:
Repeat Steps 1 through 3 for all the errors
1. CreateStringClaim (Create ClaimTypes for each of the error codes, holding the index of the error code in the enum)
2. GetMappedValueFromLocalizedCollection (Make the localized enum choose and hold the value of the required error code)
3. AddItemToStringCollection (Add the localized error from the enum to a StringCollection)
4. GenerateJson (Add the error codes StringCollection to the JSON payload to be sent to the API)
This way, the policy performed the localization for all the errors and we sent them along with the request to the API. The API, when an error occurred, picked one of the error messages from the policy and sent it back. This method was for us, because of our CD structure and Phrase integration, much easier than actually having the translations in a file hosted on the cloud to be accessed by the API.
Hope this helps someone; I can also add code in case someone needs it :)

Log Logic Apps error messages to Azure storage file

I have some steps in my logic apps eg Parse JSON. If they fail, I can see the reason for the failure when I open the step in logic apps eg string instead of integer.
How can I log these error messages in my Azure storage account.
The dynamic content dialogue box doesn't specify error messages.
I have created a storage account, created files, populated them with a string and put them into the storage account. I just need to get hold of the error message.
I will be processing JSON from HTTP requests. If the JSON is invalid ie does not conform to the expected schema, I need the error logged, so people can query it with the provider of the data.
If you just want to log the runs error message, it is not necessary to be so troublesome. You could just use outputs to implement it.
You set the create blob action run after parse json action fails, the blob content could be outputs('Parse_JSON')['errors'], if just want to get the error message it should be outputs('Parse_JSON')['errors'][0]['message'].

CakePHP: Send emails for crashes

What's the best way to add email notifications for CakePHP crashes? I want to be emailed with a stacktrace whenever a fatal error occurs, so that I can know immediately instead of checking the logs.
I looked at overriding AppController::appError(); but I don't want to replace all of the exception handling.
Check this out, it is to long to paste here.
https://github.com/CakeDC/utils/blob/develop/Error/EmailErrorHandler.php
It is a customized error handler for CakePHP. You need to configure CakePHP to use that error handler class. My pull request to the core was rejected that introduced an Event in the handleError() method... An event there would make it really easy to handle use cases like this.

Resources