web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

Finding Position of a CRM user programatically

(0) ShareShare
ReportReport
Posted on by

Hi guys,

I would like to retrieve the position of a systemuser, however I am not able to get the positionid.

WhoAmIRequest whoReq = new WhoAmIRequest();
WhoAmIResponse whoResp = (WhoAmIResponse)_service.Execute(whoReq);

   Guid userid = whoResp.UserId;


Entity queryPositionid = _service.Retrieve("systemuser", userid, new ColumnSet("positionid"));
if (queryPositionid.Contains("positionid"))
{
_positionid = queryPositionid["positionid"].ToString(); //I am not able to get the id here, having exception :Guid //should contain 32 digits with 4 dashes (xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx).

Entity _position = _service.Retrieve("position", new Guid(_positionid), new ColumnSet("name"));
if (_position.Contains("name"))
{
_positionname = _position["name"].ToString();

}

....

Please advise, thanks guys!

*This post is locked for comments

I have the same question (0)
  • David Jennaway Profile Picture
    14,065 on at
    Use the Id property to get the guid:


    _positionid = queryPositionid["positionid"].Id


     

  • Verified answer
    Aiden Kaskela Profile Picture
    19,696 on at

    Hi,

    queryPositionid["positionid"] is a generic object that needs to be cast as an Entity Reference, which has an Id and name property. This should do it for you:

    EntityReference _positionid = (EntityReference)queryPositionid["positionid"];

    Entity _position = service.Retrieve("position", _positionid.Id, new ColumnSet("name"));

    Hope this helps! I'd appreciate if you'd mark this as Answering your question.

    Thanks,

     Aiden

  • Community Member Profile Picture
    on at

    Thanks, finally solve it by casting to EntityReference.

  • Suggested answer
    Nithya Gopinath Profile Picture
    17,078 on at

    Hi Kentan,

    Please use the code below to get the GUID position id.

    // Get LookUp Position from User Entity
    EntityReference _position = (EntityReference)queryPositionid.Attributes["positionid"]; // Get LookUp Value of position Guid _positionId = _position.Id // this will give you id of the position

    Hope this helps.

  • Community Member Profile Picture
    on at

    Hello

    Tenfold offers this integration. Tenfold offers a call pop up feature for every inbound and outbound calls and the details that will be provided in the pop up window are contact details, previous notes (if any), call duration and task creation if you need to follow up on that customer. They support MS Dynamics integration. They also offer other functions and you can check them out for more info on the link below.

    www.tenfold.com/.../dynamics

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Meet the Microsoft Dynamics 365 Contact Center Champions

We are thrilled to have these Champions in our Community!

Congratulations to the March Top 10 Community Leaders

These are the community rock stars!

Leaderboard > 🔒一 Microsoft Dynamics CRM (Archived)

#1
JS-09031509-0 Profile Picture

JS-09031509-0 3

#2
AS-17030037-0 Profile Picture

AS-17030037-0 2

#2
Mark Eckert Profile Picture

Mark Eckert 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans