{"action":"closed","issue":{"url":"https://api.github.com/repos/mautic/mautic/issues/3820","repository_url":"https://api.github.com/repos/mautic/mautic","labels_url":"https://api.github.com/repos/mautic/mautic/issues/3820/labels{/name}","comments_url":"https://api.github.com/repos/mautic/mautic/issues/3820/comments","events_url":"https://api.github.com/repos/mautic/mautic/issues/3820/events","html_url":"https://github.com/mautic/mautic/issues/3820","id":219852738,"number":3820,"title":"Form api discards given alias on formfields","user":{"login":"Woeler","id":18422096,"avatar_url":"https://avatars3.githubusercontent.com/u/18422096?v=4","gravatar_id":"","url":"https://api.github.com/users/Woeler","html_url":"https://github.com/Woeler","followers_url":"https://api.github.com/users/Woeler/followers","following_url":"https://api.github.com/users/Woeler/following{/other_user}","gists_url":"https://api.github.com/users/Woeler/gists{/gist_id}","starred_url":"https://api.github.com/users/Woeler/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Woeler/subscriptions","organizations_url":"https://api.github.com/users/Woeler/orgs","repos_url":"https://api.github.com/users/Woeler/repos","events_url":"https://api.github.com/users/Woeler/events{/privacy}","received_events_url":"https://api.github.com/users/Woeler/received_events","type":"User","site_admin":false},"labels":[{"id":154414515,"url":"https://api.github.com/repos/mautic/mautic/labels/Bug","name":"Bug","color":"e11d21","default":false}],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2017-04-06T10:24:56Z","updated_at":"2017-07-27T14:34:30Z","closed_at":"2017-07-27T14:34:30Z","body":"What type of report is this:\r\n\r\n| Q  | A\r\n| ---| ---\r\n| Bug report? | X\r\n| Feature request? | \r\n| Enhancement? | \r\n\r\n## Description:\r\nHello all,\r\n\r\nI'm trying to create forms where I set the alias in the post request, however Mautic keeps discarding them and simply adding a random string as alias. This looks like a bug to me. It is a problem when I try to edit an already existing form via the API because it will completely delete all the results and all the fields from the form and then recreate them instead of looking if the aliases match, as they will never match with this random string thing intervening somewhere.\r\n\r\nHere is a simple request:\r\n\r\n```\r\n$data = array(\r\n    'name' => 'test',\r\n    'alias' => 'testform',\r\n    'formType' => 'standalone',\r\n    'description' => 'API test',\r\n    'fields' => array(\r\n        array(\r\n            'label' => 'field name',\r\n            'alias' => 'myfield',\r\n            'type' => 'text'\r\n        )\r\n    ),\r\n    'actions' => array(\r\n        array(\r\n            'name' => 'action name',\r\n            'description' => 'action desc',\r\n            'type' => 'lead.pointschange',\r\n            'properties' => array(\r\n                'operator' => 'plus',\r\n                'points' => 2\r\n            )\r\n        )\r\n    )\r\n);\r\n\r\n$form = $formApi->create($data);\r\n```\r\n\r\nThe form is now created but the alias of my field is 'qmoyx' (and for you will probably be some other random string).\r\n\r\n## If a bug:\r\n\r\n| Q   | A\r\n| --- | ---\r\n| Mautic version | 2.7.1\r\n| PHP version | 5.6\r\n\r\n### Steps to reproduce:\r\n1. Create an API POST request with a new form\r\n2. Set alias in the request\r\n3. Send request\r\n4. Find a form with a random generated field alias instead of the one specified\r\n \r\n### Log errors: \r\n\r\nN.A.\r\n\r\n"}}
{"actor":{"display_login":"Woeler"}}