Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics CRM (Archived)

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

Posted on by 275

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
    Turbo Forms 275 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
    RaviKashyap 55,410 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
    Mahendar Pal 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
    gdas 50,085 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
    rthompson 1,530 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

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,280 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,214 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans