Questions tagged [adderror]

The tag has no usage guidance.

15 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
3 votes
0 answers
690 views

How to check for/retrieve record-specific error message, e.g. by errors added through sObject.addError or validation rule?

I'm wondering about the documentation for the sObject class (API 50). It clearly states this for hasErrors(): Returns true if an SObject instance has associated errors. The error message can be ...
Christoph's user avatar
  • 1,022
2 votes
0 answers
42 views

Is it possible not to display INSERT FAILED Error in page, when our custom validation error is triggered

We have a visualforce page (Manage Packaged) that saves a record. We added a custom validation using trigger (addError method) to prevent it to save when a certain criteria is met. But when this is ...
jema's user avatar
  • 453
2 votes
0 answers
349 views

Send email in an Apex trigger (on CollaborationGroup) before calling addError

I want to have a trigger on ColllaborationGroup (Chatter group) that prevent users from deleting a group, and sending them an email for explanation. I read here and here and here that this is not ...
Karen R.'s user avatar
1 vote
0 answers
3k views

Apex Trigger to stop record from being saved in Salesforce

I have a requirement to stop the record from being saved when a checkbox is set to true in that record. This record is saved from Lightning component and on click of Save button from the component, ...
SK_112's user avatar
  • 73
1 vote
0 answers
315 views

addError is not showing anything on Lightning task page?

We have code that adds error messages to objects, and the point is to do so regardless of being in classic or lightning, so addError was used. All we are doing is this: if(validationMessage!=''){ ...
Tyler Dahle's user avatar
  • 2,699
1 vote
0 answers
32 views

Enforce DML statement to be failed within a batch

I am trying to make a DML statement in a batch to be failed. The reason for this is that I have logic executed in my batch in case the DML failed for some records. I would like to test it and get the ...
sfdcdev's user avatar
  • 389
1 vote
0 answers
52 views

HTML escape not working in Salesforce1

I am adding an error message to a record using the Sobject.addError(errorMsg, escape) method, and I am trying to add a clickable link to my customer service departments phone number. ptCaseObj....
Mike Lankfer's user avatar
0 votes
0 answers
21 views

adding an existing user to my sales app

scenerio: .......both user A and B are on salesforce...... user A runs a little Ad agency, user B requires the help of User A, as a mentor. My Question: why can't it be possible for user B to invite ...
sir John's user avatar
0 votes
0 answers
232 views

addError() method behavior on FeedItem trigger

I've written a basic trigger on FeedItem, which restricts users not to delete their chatter posts (simplified to clarify my question). trigger beforeDeleteFeed on FeedItem (before delete) { ...
Salesforce Developer's user avatar
0 votes
1 answer
267 views

Test Class Opportunity Line Item, add error

I wrote a trigger to count the number of values in a multi-select picklist (custom_coins__c), if more than 10, error (too many coins selected). I'm new at writing code and can't figure out the test ...
Mfrost's user avatar
  • 1
0 votes
1 answer
793 views

Raising friendly user error from trigger context

I have after update trigger on contact. I am trying to write a friendly error to screen whenever x is happening.(in apex code) I followed this explanation: Difference between the multiple messaging ...
shaked mezuman's user avatar
0 votes
0 answers
17 views

For all the records on a object how to enforce that there can only be one record where a checkbox field would be checked?

I've a checkbox field on an object. Now, for all the records on this object there can only be one record where this checkbox field would be checked. Need help here as to how do I implement this? Edit:...
Sagnik's user avatar
  • 605
0 votes
1 answer
1k views

Error in $A.getCallback() [TypeError: Invalid value used as weak map key] Failing descriptor: {markup://c:Top5Clients}. Please try again

I have two components 1)Top5Clients and 2)MessagesandAlerts which retrieves recodrs from their respective custom objects I want to display the two components side by side so I have included in a ...
vara's user avatar
  • 43
0 votes
1 answer
436 views

how to show error message on vfpage when user enter wrong datatype for field selected

<apex:pageBlock title="Find Duplicates"> <apex:pageBlockButtons > <apex:commandButton action="{!save}" value="Save"/> </apex:pageBlockButtons> &...
ravi's user avatar
  • 1
0 votes
1 answer
389 views

Map of attachment insertion

I have a map with String value and list of attachments. I am getting those by inputfile but not being able to insert those. Please find my snippet as below. Can someone please help? Apex page: ...
Testing_SFDC's user avatar
  • 2,940