Skip to main content

Notifications

Power Apps - Microsoft Dataverse
Answered

Xrm.WebApi retrieveRecord/retrieveMultipleRecords returns null for a lookup value

(0) ShareShare
ReportReport
Posted on by

Hi,

I have a strange behaviour doing a web api call to get lookup value of an entity.

It works with a system admin, but doesn't return lookup value for a user with a security role with Organization access to the entities it is querying.

 

As you see I've built 2 calls, to test if second call work, despite first one works for the sys admin user, 

I've make sure user has Organization permissions to Resource and bank holiday jurisdiction, but it always return null.

Is there anything else related to permission I should check?

 

Xrm.WebApi.retrieveMultipleRecords("bookableresource", "?$select=name,_new_bankholidayjurisdiction_value&$expand=new_BankHolidayJurisdiction($select=new_name)&$filter=_userid_value eq " + userID).then(
			function success(resultQuery) 
			{
				if(resultQuery.entities.length == 0)
				{
					return;
				}
				else
				{
					var resultResource = resultQuery.entities[0].bookableresourceid; 
					
					Xrm.WebApi.retrieveRecord("bookableresource", resultResource, "?$select=_new_bankholidayjurisdiction_value").then(
					function success(resultFP) {						
						var payee = resultFP._new_bankholidayjurisdiction_value
						
					},
						function (error) {
						console.log(error.message);
						// handle error conditions
					}
					
					);

 

Jorge_0-1713974729730.pngJorge_1-1713974799952.png

 

 

system Admin call

Jorge_2-1713974901522.png

 

Categories:
  • Jorge_ Profile Picture
    Jorge_ on at
    Re: Xrm.WebApi retrieveRecord/retrieveMultipleRecords returns null for a lookup value

    Thanks so much Guido! I couldn't understand why it didn't work!

  • Verified answer
    Guido Preite Profile Picture
    Guido Preite 1,483 on at
    Re: Xrm.WebApi retrieveRecord/retrieveMultipleRecords returns null for a lookup value

    the field has a key icon beside the name, it means it is protected by Column Security

    you need to create a security profile (in addition to the security role the user has already) with the read permission on that field and assign it to the user so it can read the value (by the form or by web api)

  • Jorge_ Profile Picture
    Jorge_ on at
    Re: Xrm.WebApi retrieveRecord/retrieveMultipleRecords returns null for a lookup value

    Hi Guido, thanks for the reply

    Yes it has a value..

     

    Jorge_1-1713976019268.png

     

     

  • Guido Preite Profile Picture
    Guido Preite 1,483 on at
    Re: Xrm.WebApi retrieveRecord/retrieveMultipleRecords returns null for a lookup value

    you are running two different query, due to this condition:
    &$filter=_userid_value eq " + userID
    are you sure that the bookable resource record you are checking (the one with the ID starting with db7... has the lookup new_bankholidayjurisdiction filled with a value?
    because the other screenshot (the one you run with sysadmin) it shows a different record (starting with ID 7f35) due to how the first query is structured.

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

Microsoft Kickstarter Events…

Register for Microsoft Kickstarter Events…

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Announcing Forum Attachment Improvements!

We're excited to announce that attachments for replies in forums and improved…

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 145,666

#2
RandyHayes Profile Picture

RandyHayes 76,287

#3
Pstork1 Profile Picture

Pstork1 64,996

Leaderboard

Featured topics