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
Phuc Nguyen 18Phuc Nguyen 18 

Add custom field to another object record layout using LWC

Hello,
I have fields on a custom object(B) that I need to render on another object(A).  I was thinking about creating a LWV and adding it to the the lightning page layout of (A).  Is this a sound approach.  The org is in Lightning.
Thanks,
ShirishaShirisha (Salesforce Developers) 
Hi Phuc,

Greetings!

I don't think this is possible,as it is not possible to use the fields/values of one Object without having any relationship to the other object where you want to render the other's objects fields.

Please feel free to reach out to the accelerator team who can give you the idea on how you can implement according to your business requirement,if you have premier success plan.

Please find the details on how to request for an accelerator:https://help.salesforce.com/articleView?id=000337601&type=1&mode=1

Otherwise,I would request you to reach out to your account Executive If you wish to upgrade to Premier Support please contact your Account Executive.

Kindly let me know if it helps you and close your query by marking it as solved so that it can help others in the future.

Warm Regards,
Shirisha Pathuri
Phuc Nguyen 18Phuc Nguyen 18
Hey Shirisha,
Thank you for the reply.  I should have stated that the 2 objects are related.  Task object and TaskExt__c object. They have a master/detail relationship where the TaskExt__c object is the child.  I am trying to add a a field from the TaskExt__c to the Task layout.  I am trying to populate the TaskExt__c field with a value from the Task oject.  So the field on teh Task object has a vlaue of Apple.  I want to copy the value to the TaskExt__c field and null out the original Task field.
Thank you for your time,
Barthelemy Laurans 1Barthelemy Laurans 1
Hi,

Sorry I find your explanation about relationship confusing. So I will try to answer with assumption I made :
  • Display a field value of Task on TaskExt__c can be made using formula field on TaskExt__c that points to Task object field
  • Display a field value of TaskExt__c on Task isn't recommend because of the direction of the relation 1 Task for n TaskExt__c (maybe you have some integrity rules that ensure a 1 - 1 relation, in such case it is acceptable)
    • Depending on the type of data, you can workaround using roll-up summary formula
    • Other workaround would be using Process Builder or Apex Trigger
  • Copy values from Task to TaskExt__c is not recommened because of synchronisation issues that you can encounter
    • You can do it using workflow field update (on TaskExt__c take parent field value to copy to itself)
    • You can use process builder
    • You can use Apex Trigger
  • If none of this works, you can probably do a LWC or Aura component that will display the correct value

Best regards,
​​​​​​​Barthélemy