web
You’re offline. This is a read only version of the page.
close
Skip to main content
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

I have the same question (0)
  • 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.

  • 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.

  • 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
    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.

  • 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

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…

Abhilash Warrier – Community Spotlight

We are honored to recognize Abhilash Warrier as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics CRM (Archived)

#1
HR-09070029-0 Profile Picture

HR-09070029-0 2

#1
UllrSki Profile Picture

UllrSki 2

#3
ED-30091530-0 Profile Picture

ED-30091530-0 1

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans