Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I think the error is pretty straightforward: either <code>Xrm.Page.getAttribute("po_contractterm").getValue()[0].keyValues</code> has no property <code>po_months</code> or <code>Xrm.Page.getAttribute("po_contractterm").getValue()[0].keyValues.po_months === null</code></p> <p>Your code is navigating through a lot of properties on one line. If you cannot guarantee the existence of something at every one of those properties, you're asking for trouble.</p> <p>Since I think you're still a bit confused, set a breakpoint just before the error line and see , of all the following possible expressions, what fails. </p> <pre><code>Xrm.Page.getAttribute("po_contractterm").getValue() //this shouldn't be null Xrm.Page.getAttribute("po_contractterm").getValue()[0] Xrm.Page.getAttribute("po_contractterm").getValue()[0].keyValues Xrm.Page.getAttribute("po_contractterm").getValue()[0].keyValues.po_months //this probably doesn't exist or is null. Xrm.Page.getAttribute("po_contractterm").getValue()[0].keyValues.po_months.value </code></pre> <p>We can eliminate checking part of the expression <code>Xrm.Page.getAttribute("po_contractterm").getValue()</code> because that part is tested in the <code>if</code>. It wouldn't hurt to check it just to keep your sanity, though, and with the Visual Studio debugger, I would think you should be able to click navigate through each of these anyway, unless the object is too large. It'd also be useful to know if the debugger is lying to you, as some of your comments seem to suggest you believe. Debuggers do <em>occasionally</em> lie, or (much more often) present information quite obtusely. </p> <p>This is something you can't be lazy with. Well, maybe if you use something like <a href="http://goessner.net/articles/JsonPath/" rel="nofollow">JSONPath</a>, you can be <em>a bit</em> lazy, but otherwise, if you are not going to use a tool like that, make sure the path exists when you need it, or do proper testing in case parts of it might not exist.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload