Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I think I understand this problem now. </p> <p>In short: You are assuming that a lookup field will give you access to the fields of the lookup'ed record. This is incorrect.</p> <p>To expand on that, lets start with what Crm actually gives you in a lookup field.</p> <p>If you have a look at the MSDN <a href="http://msdn.microsoft.com/en-us/library/6881e99b-45e4-4552-8355-2eef296f2cd8#BKMK_getValue" rel="nofollow">here</a>. We can see that when getValue() is performed on a lookup attribute we are returned an array with three string properties.</p> <blockquote> <p>entityType String: the name of the entity displayed in the lookup</p> <p>id String: The string representation of the GUID value for the record displayed in the lookup.</p> <p>name String: The text representing the record to be displayed in in the lookup.</p> </blockquote> <p>Things to note:</p> <p>There is no <code>keyValues</code> property (I'm not sure where you have got this from - please let me know if I'm missing something here). </p> <p>Apart from the name field the we don't have any other record data. E.g: If this was a lookup to a contact we could tell its fullname (from the name property) but not its address or phone number.</p> <p>So, to summarise the reason it fails when Crm sets the lookup is because it only provides the information from above, it will not populate <code>keyValues</code> or any of the fields from the lookup'ed record, e.g. <code>po_months</code>.</p> <p>I'm guessing the reason it works when you set the lookup, is because you are creating the <code>keyValues</code> property somewhere else in code.</p> <p>If you want information from a record related via a lookup, you have to perform a webservice call to get that information - using the id from the lookup.</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. 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