locked
How to assign/ set a record to subgrid in MS CRM 2011 online using javascript RRS feed

  • Question

  • Hi,

    I am using MS CRM 2011 online.

    In this i want to assign / set / insert a record value in to subgrid using java script.

    Example: I have retrieved a lookup value from a field and i want to set / insert this value into subgrid.

    can anyone help us to solve this requirement.

    Thanks in Advance

    Chandra

    Wednesday, December 11, 2013 10:57 AM

All replies

  • get the record guid and update,create assign the record

    for that u need to use ODATA ;the below sample is for update the record try you will get it

    http://lakshmanindian.wordpress.com/2012/10/11/update-record-using-jscript-in-microsoft-dynamics-crm-2011/

    http://samantasayantan.wordpress.com/2011/10/27/crm-2011-updating-lookup-values-using-odata-and-javascript/


    ms crm

    • Proposed as answer by Anubhav Bajpai Monday, December 16, 2013 6:29 AM
    Wednesday, December 11, 2013 11:13 AM
  • Hi Reddy,

    Thanks for your reply.

    provided links contains how to update a record in subgrid.

    but in my situation i have record guid, name in a textbox, using that values i want to enter/ insert/ associate that record into subgrid.

    can you please help me to find a solution.

    Thanks in Advance

    Chandra

    Wednesday, December 11, 2013 6:29 PM
  • you can do it through insert and associate method in ODATA 

    or through plugin you can achieve ur requirement.


    ms crm

    Thursday, December 12, 2013 6:14 AM
  • Hi Chandra,

    We can able to achieve this using javascript and plugin with the below steps,

    1. Trigger the action (OnSave, Field Change, Button Click...etc)

    2. Form the EntityReference with the Guid which is stored in the textbox

    3. Retrieve all the associated subgrid records for the parent record

    4. Update the associated records with the EntityReference

    Let me know if still you cannot able to achieve your requirement.

    Regards,

    Prabhu G


    Prabhu G

    Thursday, December 12, 2013 7:11 AM
  • Hi Prabhu,

    Thanks for the reply.

    Can you please give any sample code to achieve the requirement.

    is their any other way to insert the records into subgrid


    Thanks

    Chandra


    Friday, December 13, 2013 7:23 AM
  • Hi Reddy,

    Can you please give an example or sample code for associate method in Odata.

    Thanks

    Chandra

    Sunday, December 15, 2013 7:19 PM
  • Hi,

    Refer this post:

     http://social.microsoft.com/Forums/en-US/8be63dab-4d11-4bac-b03e-77ae5e21dfee/copying-values-into-subgrid-in-crm-2013?forum=crmdevelopment#8e601054-f19b-4f8f-b325-3d55a11c18ba

    Showing the data in a subgrid involves the data being associated into the target entity for which you showing the data.

    1. For Associating the record, refer this link
    2. In case, you are not associating an existing record and want to create a new record to be displayed in your grid, refer this link or you may refer to the SDK sample for the rest or jquery operations. For doing this through .NET you can write plugin which you can also refer from the CRM SDK samples.

    I hope this helps to resolve your query.

    Thanks & Regards,


    Anubhav Bajpai

    • Proposed as answer by Anubhav Bajpai Monday, December 16, 2013 6:28 AM
    Monday, December 16, 2013 6:27 AM
  • Hello Chandra,

    If you know how to write ODATA query ,then u would not require any example here. You can easily do Google for the same.

    We can guide you here for the Steps to follow.

    As Prabhu describes, please wrote your ODATA query (with Assign request of CRM SDK).

    Follow below blog for reference

    http://msdn.microsoft.com/en-us/library/hh372956.aspx


    If this post answers your question, please click "Mark As Answer" on the post and "Mark as Helpful"

    • Proposed as answer by DynamicsCRM31 Monday, December 16, 2013 10:42 AM
    Monday, December 16, 2013 10:42 AM