0

I have a reference custom object called Test_one__c . Another object called Test_two__c and create a new lookup relation of Test_one__c.

My Question is,when i delete the record of Test_one__c ,it is deleting the lookup record of Test_one__c in Test_Two__c object.

For example : Test_one__c has Standard field called "Name" and it has record "1234". I am assigning "1234" through lookup in Test_two__c object . when i delete 1234 in Test_one__c ,it is deleting 1234 in Test_Two__c.

I want that record in Test_two__c when 1234 is deleted in Test_one__c parent object ?

Please help me and give the solution.

2 Answers 2

1

First of all from your question its not clear on what your ask is

  1. do you want to retain test two record when the lookup record from test one is deleted?

OR

  1. you want the test one record to be retained in lookup to test two record even if its still deleted from test one object.

what you can do is stop deletion of a record thats part of a lookup relationship by using configuring options in the lookup record in test two object

enter image description here

if you dont want the lookup record to be deleted even if its deleted in test one object use a custom field and stamp the id in that field instead of a lookup relationship that way it wont get wiped off.

3
  • do you want to retain test two record when the lookup record from test one is deleted? Yes the records which are created in test_one__c ,am assigning in test_two__c using look up . the test_one__c object records loading from third party tool and daily they are running the job.While running the job ,it is deleting and loading the records back to test_one__c object . when records are deleted in test_one__c ,the existing lookup records are also deleted in test_two__c object Commented Feb 19, 2018 at 9:22
  • if its deleting the records from test one then the lookup reference will also go away. if you dont want that to happen then select the second option from my answer(dont allow deletion).
    – RedDevil
    Commented Feb 19, 2018 at 14:35
  • third party tool running the job and it is deleting the records and loading again into Test_one__c object .Between Deleting and loading ,records are deleting in Test_one__c and also lookup field data aslo deleting in Test_two__c object. Commented Feb 19, 2018 at 22:47
0

Change your field type from master to lookup, then your relationship will be independent of each other, so your record in Test_two__c will remain when you delete 1234 in Test_one__c

7
  • Hi Dinesh , i am not using Master relationship, am using lookup relation . for ex : on Test_two__c object i have a custom field called testOne__c and the data type is lookup(Test_one__c) Commented Feb 19, 2018 at 9:01
  • If the lookup field is optional, you can specify one of three behaviors to occur if the lookup record is deleted: 1.Clear the value of this field 2.Don’t allow deletion of the lookup record that’s part of a lookup relationship . 3.Delete this record also available only if a custom object contains the lookup relationship
    – user11
    Commented Feb 19, 2018 at 9:05
  • i am using clear the value of this field option but it deletes the look up record when the reference object is deleted . if i use the second option "Don't deletion of the lookup record" ,if i delete the parent record ,it is asking me to delete the related child records . if i use the third option the entire record of child will be deleted Commented Feb 19, 2018 at 9:10
  • IF you have triggers on Test_one__c, deactivate all and check. if it is not getting deleted then you should check ur triggers
    – user11
    Commented Feb 19, 2018 at 9:16
  • No its a new object and dont have any triggers on it . Commented Feb 19, 2018 at 9:25

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .