Discussions
- General Development
- Schema Development
- Apex Code Development
- Visualforce Development
- Formulas & Validation Rules
- Security
- Mobile
- Force.com Sites & Site.com
- Chatter Development
- Java Development
- .NET Development
- Perl, PHP, Python & Ruby
- Desktop Integration
- APIs and Integrations
- Visual Workflow
- Apple, Mac and OS X
- VB and Office Development
- AppExchange Directory & Packaging
- Salesforce Labs & Open Source Projects
- Other Salesforce Applications
- Jobs Board
- Force.com Discussion Boards
- :
- Developer Boards for Force.com and Database.com
- :
- General Development
- :
- Related Object Required
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic to the Top
- Bookmark
- Subscribe
- Printer Friendly Page
Related Object Required
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
02-01-2013 08:18 AM
Hello
I have a "Main Object" (Sales Opportunity) and a "Related" object (Product).
Is there a way to setup my main object so that if "Sales Opportunity" status is set to "Prepare Quotation" the object must have a Product related to it?
Thanks
Re: Related Object Required
[ Edited ]- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
02-01-2013 08:31 AM - edited 02-01-2013 08:34 AM
Sales Opportunity should have a lookup field for Product. And on the Sales Opportunity status field do a validation rule which checks if the value of picklist is "Prepare Quotation"and the then the lookup field is"Blank", throw error.
Re: Related Object Required
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
02-01-2013 08:41 AM
Thanks. This will do if I have at least 1 product. How about if I must require at least "X" product to be related? Can I have something that counts the number of products related and then work the validation rule from there?
Re: Related Object Required
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
02-01-2013 08:47 AM
Re: Related Object Required
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
02-01-2013 09:50 AM
Did it work?
Re: Related Object Required
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
02-01-2013 11:53 AM
Let me explain a bit more. Imagine we sell luxury cars. So for every sales oportunity we need to incluide at least a few products (car model, leather seats, hifi sound system, etc). So I will always need to add more than one product.
If it were just the one product, your idea would do. But for several I need to go and look how many product items are liked to this Sales Oportunity and then count them up.
Thanks
Re: Related Object Required
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
02-01-2013 12:48 PM
I understood that, so what is the issue?
As said earlier, create a rollup summary field on the Sales Opportunity which basically does store count of related records of "product"
In the validation rule, when ever you change status to the "Request Quote" , do a check for the count and see if it is > 0. If it is then you are fine, else throw error.
Re: Related Object Required
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
02-01-2013 01:06 PM
Re: Related Object Required
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
02-01-2013 01:19 PM
Job Application can have multiple reviews, so it is 1 to many relation. There is a status field of picklist which has values "Hired", rejected, ...so on so forth. I created a roll up summary field called "Count of Reviews" which counts how many related child records of review exist. I wrote a validation rule
AND(Number_of_Reviews__c = 0, ISPICKVAL( Status__c , 'Hired') )
What this does is, it checks if the picklist value is "Hired" and the number of reviews is 0, then it throws error saying, you have to have atleast 1 review before you can Hire.
Re: Related Object Required
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
02-01-2013 02:18 PM
Thanks. This looks pretty much what I need. However, I already have my Oporunity object with a large number of records and not all of them have "products" linked to them, so I cannot creat the Master-Detail relationship.
I there a way around the loop? If i relate at least one "product" record to each Oportunity will I be able to do it?

