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
James GeorgeJames George 

Displaying Case data on Asset object using formula

Hi All,
Please help me on this scenerio.
There is a Lookup field to Asset Object already exists
1. Created a new text field "C1" in Case Object
2. Created a new formula field "A1" in Asset Object

How can I display the data from Case Object's "C1" Field to Asset Object's "A1" field using the formula.

Anyhelp will be appreciated.

Thanks,
JG
 
Best Answer chosen by James George
CharuDuttCharuDutt
Hii James George

1. I Think Its Not Showing In Your Org Cause May Be You Have Asset Lookup on Case(i.e you've made asset lookup in case object)  That's Why It's Not Showing Case Fields While Inserting Fields In Fromula



2. To Get Case Field Value From Formula Field In Asset Object You Have To Make Case LookUp in Asset Object Then You Can And Be Able To Insert Case Fields in Formula 

Thanks CharuDutt

All Answers

James GeorgeJames George
Hi CharuDutt,
Thanks for your reply.
Lookup field is on Case Object looking to Asset Object.

Thanks,
JG
 
Suraj Tripathi 47Suraj Tripathi 47
Hi James,

User-added image

If this answer is helpful for you then mark it as the best answer. 
CharuDuttCharuDutt
Hii James George
Try The Below Trigger.
As You've Lookup On Case Object And Formula Field On Asset Object. So Formula Field On Asset Object Can't Access The Field On Case Object However You Can Access Field Of Asset Object On Case Object By Formula Field
trigger test on Case (before insert,before update) {
    list<Asset> lstAsstToUpdate = new list<Asset>();
    set<Id> lstAsst = new set<Id>();
    string FldUpdate;
    If(Trigger.IsBefore){
        If(Trigger.IsInsert||Trigger.IsUpdate){
            For(Case Ocase:Trigger.new){
                lstAsst.Add(Ocase./*Add Asset lookup Field Here*/);
                fldUpdate = Ocase.C1__c;
            }
        }
    }
    for(Asset Oasst : [select Id,A1__c From Asset Where ID In:lstAsst]){
        Oasst.A1__c = FldUpdate;
        lstAsstToUpdate.add(Oasst);
    }
    Update lstAsstToUpdate;
}
Please Mark It As Best Answer If It Helps
Thank You!

 
James GeorgeJames George
Hi CharuDutt,
Thanks for your code, and it works.
Is there any declarative way to achieve this functionality.

Thanks,
JG
James GeorgeJames George
Hi Suraj,
Thanks for your comments.
The solution you have provided did not work.

Thanks,
JG
CharuDuttCharuDutt
Hii James George
Your Formula  for your Formula Field WIll Be As Shown Below
Formula Field Data Type Text This Will Show C1 Field Of Contact In A1 Field In Asset Object

Contact.C1__c
Please Mark It As Best Answer If It Helps
Thank You!

 

 
James GeorgeJames George
Hi CharuDutt,
I tried your above solution but did not work as Case and Asset cannot be reached through Cross Object Formulas as they are only related through Lookup relationship.
Asset Formula
Thanks for trying to help me though.

Thanks,
JG
CharuDuttCharuDutt
Hii Jame George
Sorry For Late Reply
It Should Be Case__r.Subject  And Not Case.Subject Which You Typed
As You Can See In Below Image It Works In my Org As I"ve Made Case Lookup On Asset
User-added image 
Please Let Me Know If It Works And Like And Mark It As Best Answer
Thank You!

 
CharuDuttCharuDutt
Hii Jame George

Or You Can Click On Insert Field Button Below Simple Formula Tab And Select Whichever Field To Want To Show And Click Insert
As Shown In Image Below
User-added image

Please Let Me Know If It Works And Like And Mark It As Best Answer
Thank You!
James GeorgeJames George
Hi CharuDatt,
Do you have a master detail relationship between Asset and Case?.
For me the relationship is not coming up, please see the screenshot attached and let me know the comment.

Thanks,
JGUser-added image
CharuDuttCharuDutt
Hii James George 
​​​​​​I have lookup relationship that is case lookup field on asset
In your screenshot you are on simple formula tab you have to click on advance formula tab and then click the insert field Button as you can see in the screenshot given by me

Please Let Me Know If It Works And Like And Mark It As Best Answer
Thank You!
James GeorgeJames George
Hi CharuDatt,
Thanks for your comments, anyway the Case object is not showing up.
Any idea...
User-added image

Thanks,
JG
CharuDuttCharuDutt
Hii James George

1. I Think Its Not Showing In Your Org Cause May Be You Have Asset Lookup on Case(i.e you've made asset lookup in case object)  That's Why It's Not Showing Case Fields While Inserting Fields In Fromula



2. To Get Case Field Value From Formula Field In Asset Object You Have To Make Case LookUp in Asset Object Then You Can And Be Able To Insert Case Fields in Formula 

Thanks CharuDutt
This was selected as the best answer
James GeorgeJames George
Hi CharuDutt,

Thanks for providing the solution, once the Step 2 mentioned above implemented I'm able to resolve the issue and able to use the Formula.

Thanks again,
JG