function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
sfdc.dev.ax856sfdc.dev.ax856 

Lookup filters Validation aspect.

Hi,

 

When user edits an old record with an invalid value because of the filter (the value was valid before), if user does not change the lookup field value, the record should be saved. ie, the lookup filter should only apply on creating new record (isnew), or editing the lookup field in an existing record (ischanged), it should not apply when user edits other fields in an existing record(not(ischanged()).

Here is the scenario:
I have purchase items which user can select to add to a purchase requisition record, and I have a lookup filter so user can only select "active" items(if the price changed for an item, the old item will be marked inactive and new record will be created).

The issue is if user edits an old purchase requisition record which has an inactive item, they cannot save because the item is inactive (but it was active at the time of purchase), and they are not changing the item during the editing.

 

Can you please provide alternative for this.

GoldwinGoldwin

Hi,

 

I think you can use the trigger here. The system should not allow the user to inactive the item if it has any related records are valid, otherwise you can use the trigger to check for active items while editing the old purchase requisition record.

 

But here I have one doubt why you are inactivate the old item, if the values changed?