Sales

Get Involved. Join the Conversation.

Topic

    Mohammed Rafi
    Email ID of current user loggedAnswered
    Topic posted January 19, 2019 by Mohammed RafiBlack Diamond: 60,000+ Points 
    108 Views, 5 Comments
    Title:
    Email ID of current user logged
    Summary:
    Email ID of current user logged
    Content:

    Hi,

    How to get the email address of user currently logged into Sales Cloud.

    Can this be achieved using configuration or need groovy?

    Thanks

    Best Comment

    Usha Ramesh

    Dear Mohammed,

    We can use similar groovy that we use for getting any of the resource related attributes, is what I suppose.

    Just an example of code.. Please do let me know if this is what you were looking for. 

    //getting the logged in user
    def loggedinuserpartyId = adf.util.getUserPartyId();

    //querying the resource object
    def view_Resource = newView('Resource')
    def view_Criteria = newViewCriteria(view_Resource)
    def view_criteria_row = view_Criteria.createRow()

    //adding criteria for the loggedin user
    def view_condition = view_criteria_row.ensureCriteriaItem(PartyId)
    view_condition.setOperator('=')
    view_condition.setValue(loggedinuserpartyId)
    view_Criteria.insertRow(view_criteria_row)
    view_Resource.appendViewCriteria(view_Criteria)
    view_Resource.setMaxFetchSize(1)
    view_Resource.executeQuery()

    //accessing the emailaddress
    String OwnerEmail = view_Resource.first().EmailAddress

    Regards

    Usha Ramesh

     

    Comment

     

    • Usha Ramesh

      Dear Mohammed,

      We can use similar groovy that we use for getting any of the resource related attributes, is what I suppose.

      Just an example of code.. Please do let me know if this is what you were looking for. 

      //getting the logged in user
      def loggedinuserpartyId = adf.util.getUserPartyId();

      //querying the resource object
      def view_Resource = newView('Resource')
      def view_Criteria = newViewCriteria(view_Resource)
      def view_criteria_row = view_Criteria.createRow()

      //adding criteria for the loggedin user
      def view_condition = view_criteria_row.ensureCriteriaItem(PartyId)
      view_condition.setOperator('=')
      view_condition.setValue(loggedinuserpartyId)
      view_Criteria.insertRow(view_criteria_row)
      view_Resource.appendViewCriteria(view_Criteria)
      view_Resource.setMaxFetchSize(1)
      view_Resource.executeQuery()

      //accessing the emailaddress
      String OwnerEmail = view_Resource.first().EmailAddress

      Regards

      Usha Ramesh

       

    • Mohammed Rafi

      Thanks Usha, helpful

    • Jairo Rojas Mendez

      Thanks Usha, helpful smiley

    • Mohana Gopal Selvam

      Thanks Usha.. It is helpful..

    • Suresh Kumarasamy

      Thanks Usha,