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
p.gleixnerp.gleixner 

Open lookup after exception

Hio!

 

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.

Peter

crop1645crop1645

Peter:

 

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.