{"action":"created","issue":{"url":"https://api.github.com/repos/mithunsatheesh/node-rules/issues/35","labels_url":"https://api.github.com/repos/mithunsatheesh/node-rules/issues/35/labels{/name}","comments_url":"https://api.github.com/repos/mithunsatheesh/node-rules/issues/35/comments","events_url":"https://api.github.com/repos/mithunsatheesh/node-rules/issues/35/events","html_url":"https://github.com/mithunsatheesh/node-rules/issues/35","id":73747905,"number":35,"title":"Modify fact in consequences","user":{"login":"frauss","id":3495986,"avatar_url":"https://avatars.githubusercontent.com/u/3495986?v=3","gravatar_id":"","url":"https://api.github.com/users/frauss","html_url":"https://github.com/frauss","followers_url":"https://api.github.com/users/frauss/followers","following_url":"https://api.github.com/users/frauss/following{/other_user}","gists_url":"https://api.github.com/users/frauss/gists{/gist_id}","starred_url":"https://api.github.com/users/frauss/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/frauss/subscriptions","organizations_url":"https://api.github.com/users/frauss/orgs","repos_url":"https://api.github.com/users/frauss/repos","events_url":"https://api.github.com/users/frauss/events{/privacy}","received_events_url":"https://api.github.com/users/frauss/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-05-06T21:50:44Z","updated_at":"2015-05-07T04:04:58Z","closed_at":null,"body":"Thanks for the much needed module.\r\n\r\nI'm wondering if it's possible to modify the fact object inside of the consequences function?\r\n\r\nIf so, how do would you get at the modified fact in the execute callback?\r\n\r\nHere's a sample rule where I want to modify a field on the fact based on the test:\r\n\r\n\t{\r\n\t\tname: \"Source Test\",\r\n\t\tcondition: function(R) {\r\n\t\t\tR.when(this.Title === \"STF\" && this.Credit === \"Noble Source\")\r\n\t\t},\r\n\t\tconsequence: function(R) {\r\n\t\t\tthis.Caption = this.Caption + \". Noble Staffer found!\";\r\n\t\t\tR.next()\r\n\t\t}\r\n\t}\r\n\r\n\r\nThanks,\r\nFred"},"comment":{"url":"https://api.github.com/repos/mithunsatheesh/node-rules/issues/comments/99705242","html_url":"https://github.com/mithunsatheesh/node-rules/issues/35#issuecomment-99705242","issue_url":"https://api.github.com/repos/mithunsatheesh/node-rules/issues/35","id":99705242,"user":{"login":"mithunsatheesh","id":572597,"avatar_url":"https://avatars.githubusercontent.com/u/572597?v=3","gravatar_id":"","url":"https://api.github.com/users/mithunsatheesh","html_url":"https://github.com/mithunsatheesh","followers_url":"https://api.github.com/users/mithunsatheesh/followers","following_url":"https://api.github.com/users/mithunsatheesh/following{/other_user}","gists_url":"https://api.github.com/users/mithunsatheesh/gists{/gist_id}","starred_url":"https://api.github.com/users/mithunsatheesh/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mithunsatheesh/subscriptions","organizations_url":"https://api.github.com/users/mithunsatheesh/orgs","repos_url":"https://api.github.com/users/mithunsatheesh/repos","events_url":"https://api.github.com/users/mithunsatheesh/events{/privacy}","received_events_url":"https://api.github.com/users/mithunsatheesh/received_events","type":"User","site_admin":false},"created_at":"2015-05-07T04:04:58Z","updated_at":"2015-05-07T04:04:58Z","body":"In the execute callback, the first paramter points to the fact only.\r\n\r\n    R.execute(fact,function(result){\r\n        if(result.result)\r\n            console.log(result);// is fact with a result attribute attached to it\r\n        else\r\n            console.log(result);\r\n    });\r\n\r\n\r\n"}}