Issue while saving loggedinuser()

Certified Senior Developer

Hi Everyone,

I am saving value of loggedinuser() function into cloud mysql db, but everytime it saves the "Administrator" instead of the my username. I test this function in expression rule where it gives my username.

Can anyone please help me out?

  Discussion posts and replies are publicly visible

Parents
  • +1
    Certified Associate Developer

    Hi,

    This is normal behavior. If there is no user context, the function will return the "administrator" value. See below the extract from the documentation:

    It is only applicable in situations where there is a user context, such as when rendering an interface, displaying a report, or executing a process task form.
    
    If there is no user context, such as when used in an expression in a node output, loggedInUser() returns "Administrator".

    It highly depends what user you are trying to save in the db - is it the user that initiated a process or a user that acted on a process task? If it's the first, just use the pp!initiator parameter, if it's the second use the tp!owner parameter populated after a user task.

Reply
  • +1
    Certified Associate Developer

    Hi,

    This is normal behavior. If there is no user context, the function will return the "administrator" value. See below the extract from the documentation:

    It is only applicable in situations where there is a user context, such as when rendering an interface, displaying a report, or executing a process task form.
    
    If there is no user context, such as when used in an expression in a node output, loggedInUser() returns "Administrator".

    It highly depends what user you are trying to save in the db - is it the user that initiated a process or a user that acted on a process task? If it's the first, just use the pp!initiator parameter, if it's the second use the tp!owner parameter populated after a user task.

Children