0

Can I call pagereference method from trigger. I tried to call but I got nullPointerException.

  • why do you event want to do that ? – karthikselva Feb 25 '16 at 19:09
  • Actually I am creating an order from custom button and passing some parameter in url. In my class I want to get url parameter. – salesforce Developer Feb 25 '16 at 19:10
  • 1
    you should refactor the code so that both the trigger and VF controller share some common service – cropredy Feb 25 '16 at 19:36
  • 1
    Can we see the structure and intent of your code ? – Samuel De Rycke Feb 25 '16 at 21:39
1

You shouldn't really do this. In this post you can find some explanations why. But basically trigger runs behind the scene so users can't see it and be redirected from there.

  • Basically i want to do some dml operation based on parameter passed url – salesforce Developer Feb 25 '16 at 19:40
  • Are you passing that parameter to a VF page or to a standard detail page? – Oles Malkov Feb 25 '16 at 19:47
  • I am passing the parameter in standard detail page – salesforce Developer Feb 26 '16 at 2:43
  • Then I would recommend changing your logic, because workarounds might be difficult here. For example you can create a custom setting and store there that parameter Id of the record and Id of the running user. – Oles Malkov Feb 26 '16 at 9:08
  • Basically I am creating one Order from custom java script button, based on the parameter passed in URL I want to perform certain operation in class. As I am passing URL in standard page, I can not do custom logic. If it is not possible, then is there any way to find out from where the Order record is getting created i.e. either via Order Tab, Account related list or Custom button and based on condition I want to perform some operations – salesforce Developer Feb 27 '16 at 20:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.