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

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Customer experience | Sales, Customer Insights,...
Answered

How can I check the property exists or not from jquery.

(0) ShareShare
ReportReport
Posted on by 5

How can I check the property exists or not in the Entity from jquery.

If I am querying with the column name then it throws an error that column does not exist.

I have the same question (0)
  • Suggested answer
    oliver.rodrigues Profile Picture
    4,052 on at

    is this portals or dynamics crm? can you share your code

  • Community Member Profile Picture
    on at

    I don't understand what are you trying to do, are you trying to write a web resource on a form?

  • Sandeep Pruthi Profile Picture
    5 on at

    Xrm.WebApi.retrieveRecord("account", "<guid>", "?$select=_ownerid_value,testColumn")

    I want to get information from account table. But in some sechnario testColumn exists in entity but in some secnario it doesn't exists. I want to check in jquery that this column exists or not in database.

    But in all secnario it is giving me null record.

    I am looking for the funciton like ContainsKey or HasKey in entity.

    Thanks

  • Verified answer
    Community Member Profile Picture
    on at

    first of all the Xrm.WebApi.retrieveRecord() is a javascript method, which means you are working with a javascript web resource on a form in the entity account. and from what I understand you are trying to retrieve the testColumn field from the entity account, if the field was already created in the entity account then it will always exist in the database,

    my advice is to make sure you're entering the field name and not the display name, and here is a sample code to retrieve the phone and account name :

    function test(){

    var accountRecordGuid = null,nextLine="\n";

    accountRecordGuid = Xrm.Page.data.entity.getId();

    if (accountRecordGuid != null && accountRecordGuid != "") {

    // Retrieve Record

    Xrm.WebApi.retrieveRecord("account", accountRecordGuid, "?$select=name,telephone1").then(

    function success(result) {

    // Perform operations on record retrieval

    var sampleValueText = "Retrieved values: ";

    // Single Line of Text

    if (result.name != null) {

    sampleValueText += "Account Name : " + result.name + nextLine;

    if (result.telephone1!= null) {

    sampleValueText += "Description : " + result.telephone1+ nextLine;

    }

    alert(sampleValueText );

    },

    function (error) {

    // handle error conditions

    Xrm.Utility.alertDialog("Error while retrieving the Account Record : " + error.message, null);

    });

    }

    }

    hope I answered your question if not please explain more the scenario

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > Customer experience | Sales, Customer Insights, CRM

#1
Tom_Gioielli Profile Picture

Tom_Gioielli 170 Super User 2025 Season 2

#2
#ManoVerse Profile Picture

#ManoVerse 61

#3
Gerardo Rentería García Profile Picture

Gerardo Rentería Ga... 52 Most Valuable Professional

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans