locked
Read form field values into silverlight C# RRS feed

  • Question

  • Is there a way to read a value of a field from CRM without saving the record first?

    Here is what i would like to do.

    1.  user creates a new quote

    2.  My onload event creates a temporary quote id

    3.  User fills out quote information (this is my silverlight app) and pushes a button

    4.  Save the quote information to my custom entity using the temporary quote id and populate the CRM quotes with specific details.

     

    How do i get that value (temporary quote id) when i click a button on my silverlight form without having to save the record first?

    Tuesday, August 30, 2011 8:29 PM

Answers

  • Hi,

    In Silverlight you can access the Xrm form context as:

    dynamic xrm = (ScriptObject)HtmlPage.Window.GetProperty("Xrm");
    

    then can access the form fields like:

    var xrm_QuoteId = xrm.Page.data.entity.attributes.get("new_quoteid");

    MessageBox.Show(xrm_QuoteId.getValue());

     


    Jehanzeb Javeed

    http://worldofdynamics.blogspot.com
    Linked-In Profile |CodePlex Profile

    If you find this post helpful then please "Vote as Helpful" and "Mark As Answer".
    • Proposed as answer by Jehanzeb.Javeed Wednesday, August 31, 2011 3:09 PM
    • Marked as answer by FutureSteel Wednesday, August 31, 2011 3:28 PM
    Wednesday, August 31, 2011 3:09 PM

All replies

  • why do you need a temporary quoteid to do that?

    you can access quote page context if your silver light resource is on the form.

    http://www.resultondemand.nl/support/sdk/982189a4-93a9-44ee-99e0-7b8d85318cf4.htm

    You can set the value of the attributes or read the values of the attributes.

     

    If you are using temp quote id to create some kind a relationship. you can store that temp id in some custom field and link those entities in a plugin when quote entity is saved.

     

    I hope this helps.

     


    Amreek singh Senior CRM Consultant CDC Praxa Sydney,Australia http://mscrmshop.blogspot.com/
    • Proposed as answer by Amreek Singh Wednesday, August 31, 2011 4:54 AM
    Wednesday, August 31, 2011 4:54 AM
  • Amreek,

     

    Thanks for your input.  How do i pass my temp quote id to my silverlight then upon opening the CRM form as an input parameter?  I'm just learning this stuff as i go along.

    Wednesday, August 31, 2011 2:30 PM
  • Hi,

    In Silverlight you can access the Xrm form context as:

    dynamic xrm = (ScriptObject)HtmlPage.Window.GetProperty("Xrm");
    

    then can access the form fields like:

    var xrm_QuoteId = xrm.Page.data.entity.attributes.get("new_quoteid");

    MessageBox.Show(xrm_QuoteId.getValue());

     


    Jehanzeb Javeed

    http://worldofdynamics.blogspot.com
    Linked-In Profile |CodePlex Profile

    If you find this post helpful then please "Vote as Helpful" and "Mark As Answer".
    • Proposed as answer by Jehanzeb.Javeed Wednesday, August 31, 2011 3:09 PM
    • Marked as answer by FutureSteel Wednesday, August 31, 2011 3:28 PM
    Wednesday, August 31, 2011 3:09 PM
  • That's exactly what i was looking for. 

    Just in case anyone else is interested, i also found this link.

    http://axforum.info/forums/showthread.php?p=252925

     

     

    Wednesday, August 31, 2011 3:29 PM