{"action":"created","issue":{"url":"https://api.github.com/repos/seanmcne/Microsoft.Xrm.Data.PowerShell/issues/116","repository_url":"https://api.github.com/repos/seanmcne/Microsoft.Xrm.Data.PowerShell","labels_url":"https://api.github.com/repos/seanmcne/Microsoft.Xrm.Data.PowerShell/issues/116/labels{/name}","comments_url":"https://api.github.com/repos/seanmcne/Microsoft.Xrm.Data.PowerShell/issues/116/comments","events_url":"https://api.github.com/repos/seanmcne/Microsoft.Xrm.Data.PowerShell/issues/116/events","html_url":"https://github.com/seanmcne/Microsoft.Xrm.Data.PowerShell/issues/116","id":158334275,"number":116,"title":"Set-CrmRecordState for Invoice is not working","user":{"login":"thuld","id":1762830,"avatar_url":"https://avatars.githubusercontent.com/u/1762830?v=3","gravatar_id":"","url":"https://api.github.com/users/thuld","html_url":"https://github.com/thuld","followers_url":"https://api.github.com/users/thuld/followers","following_url":"https://api.github.com/users/thuld/following{/other_user}","gists_url":"https://api.github.com/users/thuld/gists{/gist_id}","starred_url":"https://api.github.com/users/thuld/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/thuld/subscriptions","organizations_url":"https://api.github.com/users/thuld/orgs","repos_url":"https://api.github.com/users/thuld/repos","events_url":"https://api.github.com/users/thuld/events{/privacy}","received_events_url":"https://api.github.com/users/thuld/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/seanmcne/Microsoft.Xrm.Data.PowerShell/labels/question","name":"question","color":"cc317c"}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":4,"created_at":"2016-06-03T10:08:45Z","updated_at":"2016-06-24T13:47:12Z","closed_at":null,"body":"The following code is not working:\r\n\r\n````\r\n$conn = Get-CrmConnection -InteractiveMode\r\n\r\n$invoiceNo = \"INV-07017-G5W3W7\"\r\n\r\n# status\r\n$stateCodeActive = 0\r\n$stateCodePaid = 2\r\n\r\n# status-reason\r\n$statusCodeNew = 1\r\n$statusCodeComplete = 100001\r\n\r\n$invoice = (Get-CrmRecords -EntityLogicalName \"invoice\" \"invoicenumber\" \"eq\" $invoiceNo -Fields \"invoiceid\", \"statuscode\", \"statecode\").CrmRecords\r\n\r\n# change invoice status back to \"Active\"\r\n\r\n# not working!\r\n# Set-CrmRecordState -EntityLogicalName \"invoice\" -conn $conn -Id $invoice.invoiceid -StateCode $stateCodePaid -StatusCode $statusCodeComplete\r\n# Set-CrmRecordState -EntityLogicalName \"invoice\" -conn $conn -Id $invoice.invoiceid -StateCode \"Paid\" -StatusCode \"Complete\"\r\n    \r\n# working\r\n$conn.UpdateStateAndStatusForEntity(\"invoice\", $invoice.invoiceid, $stateCodePaid, $statusCodeComplete)\r\n````\r\n\r\nWhen I use  `UpdateStateAndStatusForEntity`...\r\n````\r\n$conn.UpdateStateAndStatusForEntity(\"invoice\", $invoice.invoiceid, $stateCodePaid, $statusCodeComplete)\r\n````\r\n... instead of `Set-CrmRecordState`, is it possible to set the state of an invoice\r\n\r\n````\r\nSet-CrmRecordState -EntityLogicalName \"invoice\" -conn $conn -Id $invoice.invoiceid -StateCode \"Paid\" -StatusCode \"Complete\"\r\n````\r\n\r\nIs it possible that this is caused by the fakt that `Set-CrmRecordState`useds string instead of int? "},"comment":{"url":"https://api.github.com/repos/seanmcne/Microsoft.Xrm.Data.PowerShell/issues/comments/228349937","html_url":"https://github.com/seanmcne/Microsoft.Xrm.Data.PowerShell/issues/116#issuecomment-228349937","issue_url":"https://api.github.com/repos/seanmcne/Microsoft.Xrm.Data.PowerShell/issues/116","id":228349937,"user":{"login":"thuld","id":1762830,"avatar_url":"https://avatars.githubusercontent.com/u/1762830?v=3","gravatar_id":"","url":"https://api.github.com/users/thuld","html_url":"https://github.com/thuld","followers_url":"https://api.github.com/users/thuld/followers","following_url":"https://api.github.com/users/thuld/following{/other_user}","gists_url":"https://api.github.com/users/thuld/gists{/gist_id}","starred_url":"https://api.github.com/users/thuld/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/thuld/subscriptions","organizations_url":"https://api.github.com/users/thuld/orgs","repos_url":"https://api.github.com/users/thuld/repos","events_url":"https://api.github.com/users/thuld/events{/privacy}","received_events_url":"https://api.github.com/users/thuld/received_events","type":"User","site_admin":false},"created_at":"2016-06-24T13:47:12Z","updated_at":"2016-06-24T13:47:12Z","body":"Really odd....I run the follwoing code and the invoice was not update, the method returned `False`\r\n\r\n````\r\n$conn.UpdateStateAndStatusForEntity(\"invoice\", $invoice.invoiceid, $stateCodePaid, $statusCodeComplete)\r\n````\r\n\r\nMaybe this is caused by the fact that I try to update an invoice in status \"Paid\" status-reason \"Partial\"?\r\n\r\nRegarding the language queston: My user language and base-language are English. "}}
{"actor":{"display_login":"thuld"}}