0
votes

I am using below scripts to get the reference entity from email entity. When the scripts was triggered, it prompts 'Could not find a property named 'new_queue' on type 'Microsoft.Dynamics.CRM.email''. The reference entity's scheme name is new_queue, and I think the structure of the script is same as the guidance of microsoft knowledge article. (https://docs.microsoft.com/en-us/powerapps/developer/model-driven-apps/clientapi/reference/xrm-webapi/retrieverecord)

Can anybody point out what's wrong here?

Xrm.WebApi.retrieveRecord("email", '4884f79f-42f3-ea11-a815-000d3a44afcc', "?$select=subject&$expand=new_queue($select=queueid,name)").then(
                    function success(result) {
                        var toLookup = new Array();
                        toLookup[0] = new Object();
                        toLookup[0].id = result.queueid;
                        toLookup[0].entityType = "queue";
                        toLookup[0].name = result.name;

                    alert(result.name);

                    }, function (error) {
                        Xrm.Utility.alertDialog(error.message);
                    });
2
Is this resolved?Arun Vinoth

2 Answers

0
votes

This issue is usually an outcome of case sensitive schema name, try new_Queue instead of new_queue. You can always verify this by checking in xml metadata.

Update:

I remember that the activity (email, task, appointment, etc) is special and little different. Make sure you download the metadata xml from Developer resources and check the correct navigation property. It should look like email_new_queue or new_queue_email

0
votes

To know the correct navigation property name to use it in $expand:

Request the "Email" entity and Include the following header Prefer: odata.include-annotations="*".

In the response, you should find a field that looks something like:

"_new_queue_value@Microsoft.Dynamics.CRM.associatednavigationproperty": "????"

Use the name you'll find in the place of "????" in the $expand expression.