All Questions
Tagged with validation-rule trigger
67 questions
0
votes
1
answer
25
views
Salesforce User with a certain profile can only delete contact base on Account.field__c and the user.field__c is the same
Salesforce User with a certain profile can only delete contact base on Account.field__c and the user.field__c is the same.
do you guys have any ideas on how to do this. I need the user to delete a ...
0
votes
1
answer
57
views
What is the better way to know if the value was already used in the record previously?
I need to have a validation wherein a certain picklist value (e.g: in progress) was already selected before in the record. So basically, the "in progress' status should only be selected once in ...
0
votes
2
answers
62
views
How to exclude a related object type from validation rule
I have an Object called 'Program' which is creating/inserting a Task record.
On the Task I have a validation rule for a specific profile which is blocking the creation of Program indirectly through a ...
1
vote
1
answer
145
views
Can you automatically retry a trigger if record validation fails without user intervention?
We have a custom field with the Unique Id attribute. This field represents a randomly generated string that is used as a publicly facing identifier.
This public id field is randomly generated and ...
0
votes
1
answer
63
views
Null Pointer Exception when referencing a known valid field
I am writing custom before insert validation rules into a Case trigger to check fields on Account when a related Case is created.
When running my test classes they all pass which leads me to believe I ...
-2
votes
1
answer
157
views
Moving Validation rule to Trigger
I want to move this validation rule to trigger the Validation rule is
AND(
LR_Disease_Condition__c = $Label.Label_for_Disease_Condition,
NOT(CONTAINS( $User.LHJ__c , ...
0
votes
1
answer
1k
views
Trying to Bypass Validation Rule within Flow
I am trying to bypass a validation rule on the Opportunity object from within a Flow. I have attempted this using the 'Toggle' technique as seen here: https://admin.salesforce.com/blog/2022/how-i-...
0
votes
1
answer
474
views
How to write a validation rule that throws an error when a field value was already inserted?
There is a field CreatedById.
I want to throw an error if there are already values with the same CreatedById values.
How can I write such a validation rule?
0
votes
1
answer
521
views
Trigger to allow only one checked record or to update other records
Hard to describe what I need in a title.
I am not a developer, but it seems I can't do this with a validation rule. And since this is a managed package field, I have no direct access to change the ...
0
votes
1
answer
452
views
Check Duplicate Records and sObject row does not allow errors
I read through some of the existing posts on here about this error and I think I'm still confused on how to solve it in my context.
I am trying to prevent duplicate products from being added to an ...
-2
votes
1
answer
1k
views
make a field required for a specific profile
I want to make the field deadline required if the user profile is Profile Bs , it not should be empty . (The deadline is a Date ) , but with this code is not working for me , I tried before the ...
0
votes
0
answers
413
views
How to restrict user from selecting previous values in picklist Journey
Hi We have a unique scenario in the Picklist value selection for the users.
I have already checked on this earlier post from salesforce stackexchange Trigger to validate selection of Pick-list values
...
0
votes
1
answer
993
views
Bypass the trigger fired by Rollup summary field update [duplicate]
I have a use case where we want the Opportunity owner to be always owned by a Sales User, as sometimes a non-Sales users creates an opportunity & forgets to change the owner to Sales user as Sf ...
0
votes
1
answer
94
views
Specific Profile Access to Create or Edit in Account Related Contacts in Validation Rule or Triggers
Iam trying to create a validation rule for specific profile access to create or edit in account related contacts in validation rule
my code in validation rule at account object
AND(
NOT( $Profile....
0
votes
1
answer
3k
views
Validation is not firing due to before update trigger .how to fire validation
I have one validation rule which is checking
account. Type == 'other' then throw error.
I have before update trigger which is updating
account. Type ="technical"
when i deactivated the ...
0
votes
0
answers
253
views
Encrypted text field issue in the validation rule
I have an encrypted text field called Bank_Account__c used in the validation rule with priorvalue as AND( PRIORVALUE(Bank_Account__c) <> Bank_Account__c , Bank_Account__c <> "") apart from ...
0
votes
1
answer
437
views
How to restrict all the Contact Name fields using validation rule?
Tried creating a validation rule as below,but i still can edit the suffix, salutation on page layout.
how to restrict salutation,Suffix, do they have any api names for this or should i consider ...
0
votes
1
answer
556
views
Setting Contact mandatory in Cases
Our org Cases in SF, contacts are not set as mandatory. I want to set it to mandatory by using a validation rule to associate with Contacts. But the validation rule will not work, as we have designed ...
1
vote
1
answer
367
views
Lock Record with Exception of enumerated fields
I have a case where we want Closed Opportunities to be read only for a certain profile, with the exception of two fields, Opportunity Owner and a custom field we have (then I also assume I would need ...
1
vote
1
answer
23
views
Assign leads per slot time
can validation do this ? Max 10 leads on Slot time per branch.. For example only 10 leads must be in 10:00am(Slot Time) per Iron Man(Machine)..
Or apex/triggers will the job
0
votes
0
answers
34
views
issue in Validation rule firing
I have a one validation rule which is checking if phone length is 10 and start not with 03 then thrown an error
I have also written a code in before trigger which is updating 0 to +91
I have a issue ...
0
votes
2
answers
2k
views
Validation Rule to check PRIORVALUE
I am writing one validation rule where status is Pending/In Progress and I am changing any value from record then I need to throw an error 'you cannot edit the record'.
AND(OR( ISPICKVAL( Status , '...
0
votes
2
answers
612
views
validation on lookup object
I have lookup on account of Sell_Request__c object.
I want validation on Sell_Request__c to check if account-status is Inprogress
then thrown an error.but i am not able to achieve this as not able to ...
1
vote
1
answer
789
views
I want to create a validation rule which will throw an error if account created date is less than 6 months and type='Active'
i have used below validation rule ,but the issue is, it will check exact 180 days.there might be chances that there are 31 days in month and then days will be more than 180 days.Please suggest how can ...
2
votes
1
answer
142
views
Salesforce Metadata Update tools
We are looking for a tool to reactivate Apex triggers(100), Flows(20), WF rules(50) and Validations rules (1700). During data seeding in a sandbox from PROD using a famous tool had deactivated all the ...
1
vote
3
answers
680
views
Restrict of updating opportunity owner
I want to restrict updating the opportunity owner. I'm not able to use the validation rule because ISCHANGED( Owner.Id ) is not working. It's giving the following error, Error: The ISCHANGED function ...
0
votes
1
answer
337
views
Lock Opportunity Contact Role record
Since the OpportunityContactRole object is not a first class object you cannot create a trigger on the object, nor add fields or create a validation rule. Is it possible to prevent the deletion of an ...
2
votes
1
answer
33
views
force an opportunity to always have the same contract
Currently our salesforce users are changing the contracts of the opportunities. We automatically create a contract and do some maintenance on the contracts so we do not want anyone to replace the ...
1
vote
2
answers
4k
views
Why do we disable validation rules and triggers while Data loads via loader
I'm trying to understand why do we disable validation rules and triggers while loading data via data loader or other tool. If we not disable, what will happen in the system level?
2
votes
1
answer
13k
views
Validation rule to prevent a profile user to edit a record in certain case
I have setup a validation rule to prevent any user with a particular profile(Worker) not to edit the record except the status field. This record is of Case object. I wish to allow the user to update ...
0
votes
2
answers
11k
views
Fire Validation Rule from Apex
Is there a way to fire an existing Validation Rule from apex. Specifically, I want to fire the rule during a "before delete" trigger.
1
vote
0
answers
653
views
Insert operation triggering NOT(ISNEW())
I would like to ask for help regarding why an insert operation would trigger and fail this validation rule:
AND(NOT(ISNEW()), ISPICKVAL(Pipeline_Type__c,'Licence'), ISBLANK(Related_Pipeline__c))
The ...
5
votes
2
answers
2k
views
Determine if an SObject has an error
Is there a way to calculate if an SObject in a trigger context has had an error added to it (either with addError or through a validation rule)?
I have some trigger processes I don't want to run if ...
0
votes
1
answer
59
views
Trigger logic and/or VR for identfying the Case form and related list record?
I am trying to write the Validation Rule OOTB or trigger to accomplish the following functionality but doesn't succeeded yet.
I have a Type field on the Child object called as Authorization, which ...
1
vote
2
answers
2k
views
when to use validation rule & trigger's add error method
what is the difference between validation rule & triggers add error method? mens when I can use validation rule & when use adderror method?
0
votes
1
answer
94
views
In Salesforce Apex code or in trigger code can we check if all my validations on the on Case Object or on Custom object passes
In Salesforce Apex code or in trigger code can we check if all my validations on the on Case Object or on Custom object passes ?
In my current implementation, although validation Rule is Failing, ...
0
votes
1
answer
96
views
How can I create a Validation rule for this scenario
When I selected a picklist value on the Lead object and Lead converted into an Account. Now the value of picklist should not be editable.
For this, I have to write a validation rule.
1
vote
2
answers
1k
views
Prevent insertion of records based on a condition
I have a zoo__c object. On Zoo__c , I have a field called firstName__c. I want to prevent insertion/updating of records if firstName__c has any of these characters at the end - "op" , "gp" , "kp". If ...
0
votes
2
answers
708
views
Rolling back a complete transaction
I have two object foo__c and zoo__c. zoo__c is a child of foo__c with a master detail relationship. I have validation rule created on Zoo__c with a condition that when the status__c field on related ...
1
vote
1
answer
187
views
Is it possible to have a validation rule with a finely nuanced loophole to create and modify detail records?
We have Opportunity with a custom checkbox property "Locked__c".
While this value is set to true (never mind how), it should be impossible to change any value on the Opportunity.
The Opportunity has ...
0
votes
0
answers
75
views
How to Create a Trigger to prevent a connected app from Enriching account
Part of my question is also whether creating a trigger is the way to go or if there is an alternate or easier way...
Here's the situation - there is a 3rd party integration with a data set that ...
2
votes
2
answers
4k
views
Before Update Trigger, Custom Validation rule and process builder
I have existing validation rule and process builder. I need some programmatic logic which will be possible through apex. If i update a custom field on my object through before update trigger, will i ...
0
votes
1
answer
208
views
Before insert trigger isn't working properly? [duplicate]
Account field and integration__c fields combination of record is have already in case object don't allows duplication if sftype__C checkbox is true otherwise allows if sftype__c is false allows for ...
1
vote
1
answer
46
views
Suggest right Validation Rule?
Account field and integration__c fields combination of record is have already in case object don't allows duplication
if sftype__C checkbox is true otherwise allows if sftype__c is false allows ...
0
votes
0
answers
45
views
Trigger with a validation rule not working as expected
I'm facing a weird issue with trigger and validation rule.
The requirement here is
When User enters comment information it should be appended with the user lastname along with the timestamp ---Done ...
3
votes
2
answers
1k
views
Limit # child records to one per day per parent. Trigger or workflow+VR?
There are 2 Custom objects Position__c and Job_postings__c. They both have master detail relationship. where Position__c is master and job posting is detail.
Requirement: For a day only one Job ...
0
votes
1
answer
309
views
Make UnitPrice read Only using triggers
Currently I am trying to block certain profiles from changing UnitPrice within Quote. I used validation rules under customize> QuoteLineItem and worked perfectly fine. However those validation rules ...
0
votes
1
answer
1k
views
Getting error while updating record through After update trigger
I have 2 objects A and B where B is linked to A via LOOKUP relationship. There is a checkbox on object A which becomes TRUE when the stage (Picklist field) for object A is changed to "Funded", and ...
0
votes
1
answer
313
views
Need suggestion on Queue name check
I have one object where i am using one custom field (Queue_Name).
I am entering the queue Label in that text field.
I need to check wheather we are entering the correct queue Label present in Queues ...
1
vote
1
answer
1k
views
how to enforce the user to enter case comment on each status change
I got a requirement to enforce the user to enter case comment on each status change. So are there any ways to validate that a case comment is entered when a status change is made on case.