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
gyorkozgyorkoz 

Open Visualforce page from trigger or workflow rule

hi,

I'd like to enforce my users not to leave the lead in default status after they could reach the customer. Depending on the call the new status can be divers, so I need to open a picklist-values-choosing page.
It would be great to get it directly from the trigger or I could set a checkbox field and create a workflow rule on it, so the next time the users open the lead they have to set the new status.

Is there any way to open a visualforce page from a trigger?

Best Answer chosen by Admin (Salesforce Developers) 
gyorkozgyorkoz

Meanwhile I created a not so beautiful but working solution:

I've already had a trigger on the welcome call tasks so I completed it with setting the undesired Lead Status to a custom task field (related lead status). Then a validation rule checks if the task is success and forces the user to choose another related lead status. After all, another trigger writes the new status back to the lead.

All Answers

gyorkozgyorkoz

It would be also great, if I could forbid the users to save the welcome-call-task till they don't change the lead status..

 

thanks

paul-lmipaul-lmi

triggers and workflow rules don't run in the context of any UI.  what you could do, is override the "view" action for the object, and use a visualforce page to redirect, either to your other VF chooser page, or to a default view page, depending on the criteria you evaluate as part of the page load.

gyorkozgyorkoz

Meanwhile I created a not so beautiful but working solution:

I've already had a trigger on the welcome call tasks so I completed it with setting the undesired Lead Status to a custom task field (related lead status). Then a validation rule checks if the task is success and forces the user to choose another related lead status. After all, another trigger writes the new status back to the lead.

This was selected as the best answer
pj_27pj_27

Hello ! 

 

I have a similar requirement where I need to open a VF page to insert a New task through UI when a trigger is fired on Task.Can anybody please give me an example of it ? 

 

Thanks in advance.

 

Regards.

 

pj_27