Hi,
I am in MT Cloud environment.
I need to get in my Form Script user information. Exactly username of current user whom is operation my Form.
How can I do that?
Thanks.
Bind a variable to the keyword USERNAME() and then you can access that variable value in form script.
Thanks for pointing me to right direction.
But I can't found solution how to bind variable directly to USERNAME() keyword.
I found working solution with hidden edit field, which is bind to my variable, and there is option to add initial value. And now everything is working fine.
Thanks
Just call API MNS150 / GetUserData
No user need to be provided, it automatically uses current user.
Please which API is that? In which API section I should search for it?
I only found this one, in IFS Service APIs:
But it returns this structure for current user, without username.
}Can email be considered as username? I am not sure if in MT Cloud is always email as username login?{ <span class="hljs-attr">"sub": "string", <span class="hljs-attr">"name": "string", <span class="hljs-attr">"family_name": "string", <span class="hljs-attr">"given_name": "string", <span class="hljs-attr">"preferred_username": "string", <span class="hljs-attr">"email": "string", <span class="hljs-attr">"identity2": "string", <span class="hljs-attr">"tenantId": "string", <span class="hljs-attr">"lastLogon": "string", <span class="hljs-attr">"securityRoles": [ "string" ]
Hi Pavel
You don't mention which ERP you are using but presumably not M3. In Syteline formscript, I can do something like this:
Sub GetCurrentUser() Dim sUserId as String = Application.Variables("User_UserID").Value Dim UserRequest As LoadCollectionRequestData = New LoadCollectionRequestData() Dim UserResponse As LoadCollectionResponseData UserRequest.IDOName = "SLUsernames" UserRequest.PropertyList.SetProperties("Username") UserRequest.Filter = "UserId = '" & sUserId & "'" UserRequest.RecordCap = 1 UserRequest.Distinct = True
UserResponse = IDOClient.LoadCollection(UserRequest) Dim sUserName as String = (UserResponse(0, "Username").ToString) ThisForm.Variables("XX_Username").Value = sUserName End Sub
In most Syteline forms the global variable User_UserID can be accessed and this can be used as a search key in the relevant IDO(s).
Sorry my bad. I am in Mongoose.
Remove the single quotes, it should just be USERNAME()