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
P00j@P00j@ 

Throwing an error on two diff objects

i have a object called stock in that i have a field quantity and other object i have is order in that object i have a field quantity ordered so if quantity order is more than quantity it should throw an error.The two objects are not related by master detail so by which way the task can be done 
KaranrajKaranraj
Pooja - There should be some relationship between that two object to derive the logic. Lets take an example, you have 10 records in the order object like Ord1,ord2,ord3 etc ord10. Now I'm creating new stock record, if there is no relation between those object in which order record we need to check the quantity for the stock record?
Vijay NagarathinamVijay Nagarathinam
Hi Pooja,

If your custom objects have master details relationship, you can easily acheive your requriement. Please refer the following link it will be helpful to you.

https://success.salesforce.com/answers?id=90630000000hiFNAAY.

If two object not have the relationship then you need to write trigger 
P00j@P00j@
Thanks for the help..!