+ Start a Discussion
Siddharth LakhotiaSiddharth Lakhotia 

Need help on deleting existing entry , when new entry with same value gets added?


I have a condition , where-in I am selecting a cushion no. , and the  amount corresponding to same cushion no. gets added.

So lets say, 

For Inquiry 1 , cushion no: 123 , Amount : 100
For inquiry 2  ,cushion no: 123 , Amount 200
For inquiry 3 , cushion no: 456 , Amount : 500

So, whenever, I choose, inquiry ( lookup on inquiry detail ) , the summed amount against cushion no. appears . so lets say , if I select cushion no. 123 , the amount comes to 300.

However, one problem that I face is , If a different invoice is again added , lets say If a user adds an invoice with cushion no. 123 , the sum gets added again, which is wrong. the first entry of cushion no. 123 sums up all the amount against cushion no. 123.

I want that if a cushion no entry is already selected, whenever a new entry against the same cushion no. is made , it should deleted the existing entry and just allow the new entry.

So , in future if there is an inqiury  with cushion no 123 and amount 400.

adding it , will show me only one entry and a total amont of 600.

Trigger against this logic is already made. I just need the deletion logic