+ Start a Discussion

Open lookup after exception



I am writing a apex trigger, wich populates a Asset lookup field in Case when creating one. The trigger searches the database after a matching asset via Data(SystemID) from the Description. Becuase the System ID is not always unique  it can accure that more than 1 Asset is found. This case I want to catch with an Exception.

Now my question:

Is it possible that when the Exception is triggered, instead of printing an error message or write an email, to open up the PopUp Window of the Asset lookup, so the engineer can manually choose wich asset to look for?

If that is not possible (what i am actually excpecting) What other, more elegant possibilities do I have when an exception is triggered?

I hope my question is clear enough.

Thanks alot in advance.





This is going to require you to override the Save method with a VF controller extension and replacing your Case edit out-of-the-box page with a VF page.


Your VF controller will detect the error condition and populate a list of SelectOption with the assets. Your VF page will display that controller variable for user selection


The above only scratches the surface and you'll need to read up on VF controllers and pages.