0

I created formula field and is automatically populated the value and its working properly,please find the below formula field code

IF(
  ISBLANK(Community__c),
  Name,
  Community__r.Name & " > " & Name
)

Above code working properly while creating the record manually and the formula field is automatically created but the issue with Community__r (lookup relation) while mapping value to the relation field I'm facing the field is not writable issue. Please find the below code

 Community__c domain = new Community__c();                          
  domain.External_Id__c= communityid;
  **domain.Community__r= new Community__c(External_Id__c=parentid);**
  datadomainrelationList.add(domain);                              

I'm facing this issue only for relation field ( Community__r) but while mapping value to the Name field I didn't faced any issue. Please find the below issue ,I'm facing this issue

 I'm facing this issue

Please find below code image as well,I tried with these two ways but the issue is same

I tried with these two ways but the issue is same

Can anyone please help me on this issue ?

  • 1
    I know it's a stupid question. But can you confirm that there is a lookup field in the Community__c object, that it is called Community__c and it is pointing to itself? – Sebastian Kessel Mar 25 at 18:16
  • yes, it is a self lookup relation. – Obulamma Mudireddy Mar 26 at 3:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.