On Create - On Success profile: Agent is not valid: Line: (1)

On Create - On Success profile: Agent is not valid: Line: (1)

Hello to the forum! :)

I've been trying to add permissions to users from my own registration form using a successful form submition. But I've been getting the same error 


The code line I am using is this:
thisapp.permissions.assignUserInProfile(input.Email,"Agent");


Am I making a mistake? I've found this line of code in this forum and I can't figure out the issue :/


Kind regards,
Alen