Hi,
I want to get GUID of territory ID of systemUserSet by using Json and odata. Please find below script used for getting this but I am getting Firstname correctly as first name of user and objectid as shown below image against result of alerts in the scripts
clientid = Xrm.Page.context.getUserId();
var context = Xrm.Page.context;
serverUrl = context.getServerUrl();
var ODataPath = serverUrl + "/XRMServices/2011/OrganizationData.svc";
var retrieveResult = new XMLHttpRequest();
retrieveResult.open("GET", ODataPath + "/SystemUserSet?$select=FirstName,TerritoryId&$filter=SystemUserId eq guid'" + clientid + "'", false);
retrieveResult.setRequestHeader("Accept", "application/json");
retrieveResult.setRequestHeader("Content-Type", "application/json; charset=utf-8");
retrieveResult.send();
if (retrieveResult.readyState == 4 )
{
if (retrieveResult.status == 200)
{
var retrieved = JSON.parse(retrieveResult.responseText).d;
var terid = retrieved.results[0].TerritoryId;
var fname = retrieved.results[0].FirstName;
alert(fname);
alert(terid);
}
}
fname GP
tried
but I need to get not object the GUID value as shown below screen. How I can get this. Kindly help me.
*This post is locked for comments