locked
how to get value from child to parent between lookup RRS feed

  • Question

  • Hi to all,

    in crm 2011 i have a salesorder entity with some field like department, customer...we have also a lookup attribute contact.

    From lookup of the contact we can choose a contact or can create new one.

    I need to fill automally some fields of the new contact taking them from the salesorder entity.

    If i try to get the parent data  but i get only the lookup entity and not the salesorder entity.

    Is it possible to get these values and how?

    Thanks

    Thursday, September 19, 2013 9:38 AM

All replies

  • Hi

    If you are doing this in javascript and you have opened the contact from the parent you can access parent attributes via

    window.top.opener.Xrm.Page.getAttribute("attributename").getValue()

    If it is still open!!!

    If the window has been closed or the record is opened without a parent, you can use odata queries to retrieve the attributes you need.

    Chris

    Thursday, September 19, 2013 10:26 AM
  • Thanks for the answer

    The first problem is that i need to copy the values of some field from salesorder in the new contact, but between contact and salesorder i have

    the lookup and i try to get the parent i get only the object lookup.

    The second problem is that i can use the webservice but i need for examples which salesorderid was created by user for edit the query to retrieve the values to insert in the form


    - The problem is that is create a New contact from button New and i want to fill the field Department of the new contact get the data from salesorder is it possible?


    • Edited by armore2000 Friday, September 20, 2013 7:37 AM
    Friday, September 20, 2013 7:34 AM
  • Hi I'm not sure I fully understand.

    So if the user selects a contact with the look up you want to populate that contacts department onto the sale order department?

    If this is the case, you can do this in javascript using an oData call when the contact is changed to retrieve the contacts department and populate the field.

    Alternatively you can populate the department field in a plugin when the sales order is created or updated.

    Chris

    Friday, September 20, 2013 9:29 AM