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
MVJMVJ 

Were did the User click NEW

Is there any way in APEX to tell where the user is createing an Opportunity from.  I need to build a process that will create an activty to notify the User that they did not create the Opportunity from the Contact Tab.

We want to instill best practices by having the user create new opportuities from the contact tab so that the contact role will be automaticly populated for the user.

When you click new on the contact page the url has a contactid parameter that gets passed to the new page and SFDC knows to create the role but I need to know if in a Trigger I can read that URL or not.

Thanks in advance.

Mike
mikefmikef
MVJ:

I don't think you can check to see what new button was pressed to create your oppty.

But you could have a process on the update trigger for your oppty that checks to see if there is a contact from the account on the contact role. If there isn't then send the owner a task to create one.
MVJMVJ

That is exactly what I did.  I have a trigger on an after update/insert to check the contact role.  The trigger is firing before the contact role gets created.  It woks fine on the update but not the insert.