{"action":"closed","issue":{"url":"https://api.github.com/repos/afawcett/declarative-lookup-rollup-summaries/issues/163","labels_url":"https://api.github.com/repos/afawcett/declarative-lookup-rollup-summaries/issues/163/labels{/name}","comments_url":"https://api.github.com/repos/afawcett/declarative-lookup-rollup-summaries/issues/163/comments","events_url":"https://api.github.com/repos/afawcett/declarative-lookup-rollup-summaries/issues/163/events","html_url":"https://github.com/afawcett/declarative-lookup-rollup-summaries/issues/163","id":72505215,"number":163,"title":"System.DmlException: Update failed","user":{"login":"Inbarajd","id":8289753,"avatar_url":"https://avatars.githubusercontent.com/u/8289753?v=3","gravatar_id":"","url":"https://api.github.com/users/Inbarajd","html_url":"https://github.com/Inbarajd","followers_url":"https://api.github.com/users/Inbarajd/followers","following_url":"https://api.github.com/users/Inbarajd/following{/other_user}","gists_url":"https://api.github.com/users/Inbarajd/gists{/gist_id}","starred_url":"https://api.github.com/users/Inbarajd/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Inbarajd/subscriptions","organizations_url":"https://api.github.com/users/Inbarajd/orgs","repos_url":"https://api.github.com/users/Inbarajd/repos","events_url":"https://api.github.com/users/Inbarajd/events{/privacy}","received_events_url":"https://api.github.com/users/Inbarajd/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/afawcett/declarative-lookup-rollup-summaries/labels/Under%20Review","name":"Under Review","color":"eb6420"}],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":10,"created_at":"2015-05-01T19:35:46Z","updated_at":"2015-05-21T06:53:43Z","closed_at":"2015-05-21T06:53:43Z","body":"Hi, \r\nI have a custom object called Countries which is lookup relationship to Case object. My condition is a case record should have a country value when case is closed. I have a validation rule which will check for the condition at the time of case closed. Which is working fine by using the DLRS. My issues is when there is only one country and user try to delete the country when case is closed. I am getting the error\r\n\r\nSandbox\r\n\r\nApex script unhandled trigger exception by user/organization: 005r0000000Hsdx/00Dr00000000OWK Source organization: 00Dt0000000Gydl (null)\r\ndlrs_RelatedCountriesTrigger: execution of AfterInsert\r\n\r\ncaused by: System.DmlException: Update failed. First exception on row 0 with id 500r0000000nmcyAAA; first error: FIELD_CUSTOM_VALIDATION_EXCEPTION, To create a case, you must specify the related organization or a contact related to that organization.: [AccountId]\r\n\r\n(dlrs)\r\n\r\n\r\n\r\nTrigger.dlrs_RelatedCountriesTrigger: line 7, column 1\r\n\r\nValidation Rule:\r\nAND( CASE( Status , \"Successfully Closed\", 1, \"Administratively Closed\", 1,\"Unable to Resolve\",1,0)=1,Country_in_Case_Rollup__c = 0)\r\n\r\nCountry_in_Case_Rollup__c is the field in Case object which has the number of country values.\r\n\r\nI am not able to find what is wrong. Can you please help me in fixing this issue.\r\n\r\nThanks,\r\nInbaraj"}}