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
alchemyalchemy 

formulas

i have two custom object Asset and Goal. i have to write a formula for goal object field where i need to use a field of asset object. there is no relation between these two objects then how do i use the field of Asset object.

 can i get a solution for the same

Pratibh PrakashPratibh Prakash

If there is no relationship i.e. lookup or Master-Detail then parent fields cannot be refrence in formula.

Now if there is some kind of logical relationship that means something like if some field on Goal is equal to Some field on Asset.

That is there has to be some logic to find corresponding Goal and Asset record. So once that logic is determined then further functionality can be achieved through custom code.

Shashikant SharmaShashikant Sharma

Create a formula field in Goal Object and another field of  the same data type that is of the formula field's return type. Write a trigger on Goal object, use SOQL to fetch asset objects records , make your calculations , save value to that field. Your formula field should directly be copying this fields value.

 

I hope you understand my solution.