Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

Xrm.Page.getAttribute looking for value on the page but not within DB table.

(0) ShareShare
ReportReport
Posted on by 277

Hello Experts, this is definitely a weird scenario occurred this week. I'm using Xrm.Page.getAttribute("").getvalue() to check if a field is null or not before progressing forward. If it's null throw a popup to fill in the value. If it has a value kick off a OOB workflow(All this executes by clicking a button). Whats happening here is, when the field is null it's throwing popup, but when user enters the value and clicks button again without saving the field value, it's considering that the field is having a value. Any Ideas?

*This post is locked for comments

  • Turbo Forms Profile Picture
    277 on at
    RE: Xrm.Page.getAttribute looking for value on the page but not within DB table.

    Checking for Dirty fields first when button is  clicked clears the issue. Thanks mahender

  • Suggested answer
    RaviKashyap Profile Picture
    55,410 Moderator on at
    RE: Xrm.Page.getAttribute looking for value on the page but not within DB table.

    Hi,

    This is expected behaviour Xrm.Page.getAttribute("").getvalue() will return you the value entered in the field and not the one which is in db. If you want to get the db value then you need to use web api to retrieve the updated (database value) from crm. You could refer this sample blog -

    community.dynamics.com/.../get-lookup-value-from-other-entity-and-set-it-on-the-form-using-web-api-in-microsoft-dynamics-crm

    Hope this helps.

  • Verified answer
    Mahendar Pal Profile Picture
    45,095 on at
    RE: Xrm.Page.getAttribute looking for value on the page but not within DB table.

    Hi,

    This is because Xrm.Page object is used to access form fields, so if you want to check if user have saved this value or not you can simply check if form is dirty ask them to save first. carldesouza.com/checking-isdirty-dynamics-365-using-javascript

  • Suggested answer
    gdas Profile Picture
    50,091 Moderator on at
    RE: Xrm.Page.getAttribute looking for value on the page but not within DB table.

    Hi ,

    Xrm.Page.getAttribute("").getvalue() is a client side code so no matter the the value is exists in database or not. If the field is exists in the form you should get the value using Xrm.Page.getAttribute("").getvalue() without saving .

    By the way If my understanding is correct you are calling OOB workflow which is absolutely server side  and if you are doing some operation with field value changes your workflow does not trigger until and unless you save the value in the database or save the form. In other words workflow does not know when you fill the data in the form in client side , you should save the data to trigger workflow .

    Hope this helps.

  • rthompson Profile Picture
    1,532 on at
    RE: Xrm.Page.getAttribute looking for value on the page but not within DB table.

    Hi Turbo,

    Just a suggestion:

    Please share your code or images of your issue.  It's will make things easier for people that would like to help you.  This way people do not have guess on what you are asking for.

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

🌸 Community Spring Festival 2025 Challenge Winners! 🌸

Congratulations to all our community participants!

Adis Hodzic – Community Spotlight

We are honored to recognize Adis Hodzic as our May 2025 Community…

Kudos to the April Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard > Microsoft Dynamics CRM (Archived)

#1
Mohamed Amine Mahmoudi Profile Picture

Mohamed Amine Mahmoudi 83 Super User 2025 Season 1

#2
Community Member Profile Picture

Community Member 52

#3
dkrishna Profile Picture

dkrishna 6

Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans