How to access and use TrackVia's API or Application Scripts?

How can I get currently logged in user?

Is there a way to get the currently operating user record in script?

1 vote
Vote
Sign in
(thinking…)
Sign in with: facebook google
Signed in as (Sign out)
You have left! (?) (thinking…)
George Dong shared this idea  ·   ·  Flag idea as inappropriate…  ·  Admin →

3 comments

Sign in
(thinking…)
Sign in with: facebook google
Signed in as (Sign out)
Submitting...
  • Andrew Reid commented  ·   ·  Flag as inappropriate

    Hi George -

    Scripts require a database action in order to run. So the user must be either adding or updating a record in order to trigger a script. There's not a situation in which a script could be triggered where they're neither the creator nor the updater.

  • George Dong commented  ·   ·  Flag as inappropriate

    Hi Andrew, thank you for your comment.
    But what if the currently logged in user (the operating user) is neither the creator nor the updater?

  • Andrew Reid commented  ·   ·  Flag as inappropriate

    Hi George-

    You can access either the Created By User (for record inserts) or the Last User (for record updates) via script.

    To pull that Last User value into a variable on record update, you'd use the following syntax:
    Map userVariable = currentValues["Last User"] as Map

    Once you've accessed the user record, you can either store that value in an Application User field or parse it via script to get the user's name or email address.

Feedback and Knowledge Base