Is that possible to write a validation rule that would allow to update only two fields of 800 on a custom object record?
Clash Royale CLAN TAG#URR8PPP
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty margin-bottom:0;
up vote
2
down vote
favorite
My colleague asked me today an interesting question I never thought of before.
Is that possible to write a validation rule that would allow to update only two fields of 800 on a custom object?
I know that this question might sound strange, as I would never try to do something like this myself, I would use page layout to restrict users from editing fields or FLS or in the worst case I would write an apex trigger to implement this. But this question is about configuration approach.
Also the reason why he doesn't want to use page layout is that he doesn't want to use record types and due to his requirements he had to make 798 fields of 800 readonly if value of some custom status field on record is On Hold.
I was thinking of using "ISCHANGED" advanced formula function but that would not distinguish if only two permitted fields were changed or more.
validation validation-rule configuration
add a comment |Â
up vote
2
down vote
favorite
My colleague asked me today an interesting question I never thought of before.
Is that possible to write a validation rule that would allow to update only two fields of 800 on a custom object?
I know that this question might sound strange, as I would never try to do something like this myself, I would use page layout to restrict users from editing fields or FLS or in the worst case I would write an apex trigger to implement this. But this question is about configuration approach.
Also the reason why he doesn't want to use page layout is that he doesn't want to use record types and due to his requirements he had to make 798 fields of 800 readonly if value of some custom status field on record is On Hold.
I was thinking of using "ISCHANGED" advanced formula function but that would not distinguish if only two permitted fields were changed or more.
validation validation-rule configuration
add a comment |Â
up vote
2
down vote
favorite
up vote
2
down vote
favorite
My colleague asked me today an interesting question I never thought of before.
Is that possible to write a validation rule that would allow to update only two fields of 800 on a custom object?
I know that this question might sound strange, as I would never try to do something like this myself, I would use page layout to restrict users from editing fields or FLS or in the worst case I would write an apex trigger to implement this. But this question is about configuration approach.
Also the reason why he doesn't want to use page layout is that he doesn't want to use record types and due to his requirements he had to make 798 fields of 800 readonly if value of some custom status field on record is On Hold.
I was thinking of using "ISCHANGED" advanced formula function but that would not distinguish if only two permitted fields were changed or more.
validation validation-rule configuration
My colleague asked me today an interesting question I never thought of before.
Is that possible to write a validation rule that would allow to update only two fields of 800 on a custom object?
I know that this question might sound strange, as I would never try to do something like this myself, I would use page layout to restrict users from editing fields or FLS or in the worst case I would write an apex trigger to implement this. But this question is about configuration approach.
Also the reason why he doesn't want to use page layout is that he doesn't want to use record types and due to his requirements he had to make 798 fields of 800 readonly if value of some custom status field on record is On Hold.
I was thinking of using "ISCHANGED" advanced formula function but that would not distinguish if only two permitted fields were changed or more.
validation validation-rule configuration
asked Aug 14 at 9:28
Patlatus
4,85411848
4,85411848
add a comment |Â
add a comment |Â
3 Answers
3
active
oldest
votes
up vote
5
down vote
No. You can't have enough validation rules that could cover this, nor could you have one (or even a few) rules that would compile within the limits of the system. Something this complicated would be best served by a trigger that could check all 798 fields for changes.
add a comment |Â
up vote
1
down vote
You can assign the Account to a specific recordType lets say CustomRecX
and assign to page layout and make all the fields as readonly except that two fields.
In the validation rule, use this logic to throw the error when user is trying to save without changing any of the field values:
(RecordType.DeveloperName = 'CustomRecX')
&& (NOT(ISCHANGED(Field1__c))
|| NOT(ISCHANGED(Field2__c)))
Otherwise, you need to handle with triggers.
add a comment |Â
up vote
0
down vote
I'm not sure if this wouldn't be to long for a validation rule, but I think you could just count the number of changed fields?
3 > ( IF(ISCHANGED(field1__c), 1, 0) +
IF(ISCHANGED(field2__c), 1, 0) +
IF(ISCHANGED(field3__c), 1, 0) ... etc )
1
I think it would fail the compiled formula size
â Patlatus
Aug 14 at 10:25
@Patlatus Yeah I guess you're right.
â Kasper
Aug 14 at 11:11
add a comment |Â
3 Answers
3
active
oldest
votes
3 Answers
3
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
5
down vote
No. You can't have enough validation rules that could cover this, nor could you have one (or even a few) rules that would compile within the limits of the system. Something this complicated would be best served by a trigger that could check all 798 fields for changes.
add a comment |Â
up vote
5
down vote
No. You can't have enough validation rules that could cover this, nor could you have one (or even a few) rules that would compile within the limits of the system. Something this complicated would be best served by a trigger that could check all 798 fields for changes.
add a comment |Â
up vote
5
down vote
up vote
5
down vote
No. You can't have enough validation rules that could cover this, nor could you have one (or even a few) rules that would compile within the limits of the system. Something this complicated would be best served by a trigger that could check all 798 fields for changes.
No. You can't have enough validation rules that could cover this, nor could you have one (or even a few) rules that would compile within the limits of the system. Something this complicated would be best served by a trigger that could check all 798 fields for changes.
answered Aug 14 at 10:25
sfdcfox
225k10170384
225k10170384
add a comment |Â
add a comment |Â
up vote
1
down vote
You can assign the Account to a specific recordType lets say CustomRecX
and assign to page layout and make all the fields as readonly except that two fields.
In the validation rule, use this logic to throw the error when user is trying to save without changing any of the field values:
(RecordType.DeveloperName = 'CustomRecX')
&& (NOT(ISCHANGED(Field1__c))
|| NOT(ISCHANGED(Field2__c)))
Otherwise, you need to handle with triggers.
add a comment |Â
up vote
1
down vote
You can assign the Account to a specific recordType lets say CustomRecX
and assign to page layout and make all the fields as readonly except that two fields.
In the validation rule, use this logic to throw the error when user is trying to save without changing any of the field values:
(RecordType.DeveloperName = 'CustomRecX')
&& (NOT(ISCHANGED(Field1__c))
|| NOT(ISCHANGED(Field2__c)))
Otherwise, you need to handle with triggers.
add a comment |Â
up vote
1
down vote
up vote
1
down vote
You can assign the Account to a specific recordType lets say CustomRecX
and assign to page layout and make all the fields as readonly except that two fields.
In the validation rule, use this logic to throw the error when user is trying to save without changing any of the field values:
(RecordType.DeveloperName = 'CustomRecX')
&& (NOT(ISCHANGED(Field1__c))
|| NOT(ISCHANGED(Field2__c)))
Otherwise, you need to handle with triggers.
You can assign the Account to a specific recordType lets say CustomRecX
and assign to page layout and make all the fields as readonly except that two fields.
In the validation rule, use this logic to throw the error when user is trying to save without changing any of the field values:
(RecordType.DeveloperName = 'CustomRecX')
&& (NOT(ISCHANGED(Field1__c))
|| NOT(ISCHANGED(Field2__c)))
Otherwise, you need to handle with triggers.
edited Aug 14 at 10:48
answered Aug 14 at 10:42
Santanu Boral
28.4k51847
28.4k51847
add a comment |Â
add a comment |Â
up vote
0
down vote
I'm not sure if this wouldn't be to long for a validation rule, but I think you could just count the number of changed fields?
3 > ( IF(ISCHANGED(field1__c), 1, 0) +
IF(ISCHANGED(field2__c), 1, 0) +
IF(ISCHANGED(field3__c), 1, 0) ... etc )
1
I think it would fail the compiled formula size
â Patlatus
Aug 14 at 10:25
@Patlatus Yeah I guess you're right.
â Kasper
Aug 14 at 11:11
add a comment |Â
up vote
0
down vote
I'm not sure if this wouldn't be to long for a validation rule, but I think you could just count the number of changed fields?
3 > ( IF(ISCHANGED(field1__c), 1, 0) +
IF(ISCHANGED(field2__c), 1, 0) +
IF(ISCHANGED(field3__c), 1, 0) ... etc )
1
I think it would fail the compiled formula size
â Patlatus
Aug 14 at 10:25
@Patlatus Yeah I guess you're right.
â Kasper
Aug 14 at 11:11
add a comment |Â
up vote
0
down vote
up vote
0
down vote
I'm not sure if this wouldn't be to long for a validation rule, but I think you could just count the number of changed fields?
3 > ( IF(ISCHANGED(field1__c), 1, 0) +
IF(ISCHANGED(field2__c), 1, 0) +
IF(ISCHANGED(field3__c), 1, 0) ... etc )
I'm not sure if this wouldn't be to long for a validation rule, but I think you could just count the number of changed fields?
3 > ( IF(ISCHANGED(field1__c), 1, 0) +
IF(ISCHANGED(field2__c), 1, 0) +
IF(ISCHANGED(field3__c), 1, 0) ... etc )
answered Aug 14 at 9:53
Kasper
1,009615
1,009615
1
I think it would fail the compiled formula size
â Patlatus
Aug 14 at 10:25
@Patlatus Yeah I guess you're right.
â Kasper
Aug 14 at 11:11
add a comment |Â
1
I think it would fail the compiled formula size
â Patlatus
Aug 14 at 10:25
@Patlatus Yeah I guess you're right.
â Kasper
Aug 14 at 11:11
1
1
I think it would fail the compiled formula size
â Patlatus
Aug 14 at 10:25
I think it would fail the compiled formula size
â Patlatus
Aug 14 at 10:25
@Patlatus Yeah I guess you're right.
â Kasper
Aug 14 at 11:11
@Patlatus Yeah I guess you're right.
â Kasper
Aug 14 at 11:11
add a comment |Â
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsalesforce.stackexchange.com%2fquestions%2f228798%2fis-that-possible-to-write-a-validation-rule-that-would-allow-to-update-only-two%23new-answer', 'question_page');
);
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password