0

I have an issue here. I have an object O1 and a field F1. Field F1 is getting updated when an record is created in another object O2 by a trigger running on object O1.

Field F1 cannot be edited by inline.

There is are validtions rules on object O1.

I need when i create a record in object O2 all the validation rules in O1 should get by passed and field F1 should get updated.

But when an user does an inline edit on a record present in object O1 the validation rule should fire.

To achieve this i created a heirachy custom setting with a checkbox field and added into the validation rule in object O1.

But on inline editing the validation rule is not firing.

validation rule that i used is

NOT( $Setup.ByPassvalidation__c.Bypassrules__c ) && (TODAY() > PRIORVALUE(CloseDate))

Can anyone throw some light on this.

1

Sounds like you are basically asking How to disable inline edit on custom object?. Chris found a way to toggle the setting for all objects.

Unless you are talking about in a Visualforce page, which I assume you aren't, there is no way to turn it off by object. You can turn the feature on and off by going to

Setup -> Customize -> User Interface -> Enable Inline Editing

Its a checkbox you can chec or uncheck. Unfortunately though it's not object specific. Its for all objects.


It is possible to implement a Visualforce Page that disables inline edit for a specific object, though. Oddly enough, this markup works and does not introduce a recursion if you override the View action with it.

<apex:page standardController="MyObject__c">
    <apex:detail subject="{!MyObject__c.Id}" inlineEdit="false" />
</apex:page>

If you want to disable inline edit support for just one field, you're going to have to build your own View from scratch.

0

If I understand your requirement correctly, you could have a checkbox field on O1 object which is not present on the layout. When the trigger fires let it make this checkbox as true.

In your validation check if this checkbox is true and priorvalue was false. If it is then bypass the validation, or else do the validation.

This will ensure that the validation fires everytime, except when the first time the checkbox is made from false to true.

Also not sure how your custom setting is helping. The setting will always be the same unless you are updating it from the Apex.

  • Hey .. Now i am using the above custom setting checkbox and making it true in my trigger which is working fine. But when user is doing an inline edit to O1 the validation rule is not firing. – user2542953 Jun 21 '16 at 14:16
  • Of course the validation rule won't fire. You are not making it false. So that's why have that check box on the record and try what I suggested. – AslamK Jun 21 '16 at 14:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.