+ Start a Discussion
ministe_2003ministe_2003 

Any way to flow to another object to enforce validation rules?

We have several validation rules on opportunities and opportunity product lines which come into force at different stages of an opportunity's life and users are regularly shown error messages, the likes of "you cant change the stage until you populate this field on all the product lines" so they are given errors when updating the opportunity because the change they're making triggers an error on the lines, and vice versa.

 

I'm just wondering if anyone has a nice solution to this other than constantly stopping users in their tracks?  Instead of the user just being stopped and having to manually go and change things, I'd like for salesforce to actually take them to the problem so they can fix it, and then have their original update performed.  All seamless with no horrible error messages and clicking here and there to get around.


In my mind, this is how it world work:

 

User tries to change stage to a value which causes validation rules to fire on the lines -> User is immediately taken to the first line page without any errors or clicking, and this page shows the field which they need to populate -> if there's any other lines, the user is looped through the pages so they can populate the values -> the user is taken back to the opportunity page and can see that their original change which triggered it all (the stage change) has been performed.

 

Is this possible?  Could it be achieved with flows or something like?  I'd love any feedback or suggestions.

Suresh RaghuramSuresh Raghuram

If I am in ur place, I will give a shot like this.

 

I will write a trigger on opportunity to fire when a stage change or populated, to check the line items as expected. If not i will redirect the user to the line items page and ask him to do the required changes. once he saves it i will redirect him back to the Opportunity.

 

But here there may be a problem, actually when u save a line item u will be directed to some other page but by doing the above said the actual functinality may get affected.

 

If this helps you make this as a solution.

 

I am eager to listen your opinion on my idea.

 

Thanks,

Suresh.

ministe_2003ministe_2003

Thanks for the suggestion, I was hoping there would be a simpler way rather than having to code the solution, but it seems there probably isn't.  I'll probably do something similar to your idea.  I won't have a problem with redirects because I'll perform the line updates in code before redirecting the user back to the opp.

 

Regards