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

Event on Save?

Good evening everyone.

I have the following questions. I hope it's doable.

I have my rule in a business object called FAP, which should be "compulsorily" every time I have created an opportunity - and gets closed.

I wonder if you can create an event, not to speak, to save the opportunity he would open the page to create the FAP.

I hope you can help me.

Thanks to all who respond.


You could write a trigger that when the Opp get set to closed a new page reference to the FAP is returned. Not sure if you can get it directly into edit mode but I believe you can.




You could make them create the FAP BEFORE closing the opp. So you vould have a validation that an FAP exists before they are allowed to change the status to closed. A bit backwards but it ensure they create it before closing the opp.


Thanks for the answer.


I am new to Salesforce and I know absolutely nothing about triggers.


Could you give me an example, in a generic way, preferably by explaining what happens in each row, so you can shape my needs?


Actually I'm not sure where I want to do a trigger.

If you feel better, you could send me a link with content, which can remove my doubts.

The second case that you proposed, I could not understand how I would check the existence ofan object FAP, before saving the OP.

Waiting for a new answer.

Thank you for your help. Even.


Answering the second part of question..


in your trigger code you can query child object (FAP)


Select Id from FAP where OpporutnityID = <your current opp ID>


if query returns 0 then its mean there is no FAP record for this given opportunity.


Second option is get it all done through Configuration. You can create a rollup summary field on opportunity which will COUNT All Child Record (FAP). if this value is 0 then your validation rule will know that there is no FAP record with this opportunity.