locked
Saving a change in state of an HTML table displayed in a form in crm 2011 on-premise. RRS feed

  • Question

  • Hi Everyone,

    I have a form which shows a table with tr and td's. Each TD has a number assigned to it which can be selected from a option set pick list in the form. When the number is chosen from the pick list the appropriate TD should turn red and stay red when the form is saved. 

    What is happening is even though the TD turns red (using javascript), after i save the form and open it again it reverts back to its previous non-red state. 

    Why is it not saving? Do I need Odata or Json calls? I need help regarding this. 

    P.s. I have made a web resource where the table is being generated and I am using javascript  to change the color and cross match the ID's of TD's in the table and the options from the option set. Here is an image of the table being generated.

    Tuesday, September 17, 2013 3:12 PM

Answers

  • there could be three ways to go about it

    1. just like you set the td color to red in the onchange event of picklist, call the same function from onload.

    2. pass the optionset value as a parameter to your webresource through the custom data parameters box.

    3. check the option to pass parameters to web resource this would pass the entityid as the parameter to your webresource. make an odata call to read details of the particular entity and set the color.

    HTH

    Sam


    Dynamics CRM MVP | Inogic | http://inogic.blogspot.com| news at inogic dot com

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

    • Proposed as answer by Sam - Inogic Wednesday, September 18, 2013 12:00 PM
    • Marked as answer by Hamzak Thursday, September 19, 2013 10:05 AM
    Wednesday, September 18, 2013 12:00 PM

All replies

  • CRM does not save the color of the table. you just change the color by the Javascript. When you save the record it cause onload on the html page, so it reverts back to its original state. You can use OnLoad event on the form and change the color based on the pick list value.


    Make sure to "Vote as Helpful" and "Mark As Answer",if you get answer of your question.

    Tuesday, September 17, 2013 7:30 PM
  • I dont think so i can do it. The image above is a simplified image. There  are basically 6 divisions(A,B,C...) and there are rooms in these divisions(as shown in the image, these numbers are rooms actually). So basically the exact room of that particular division should change the color when chosen from the pick list, the divisions are also chosen from another pick list.

    So if I choose division A, room 2, that TD should change to red. 

    This is actually happening but the thing is if I open a new record the previously chosen TD is no longer red. I absolutely agree with what you said but I think your reply does not answer the query.

    Do you think I need Odata Jason calls for this? 

     
    • Edited by Hamzak Wednesday, September 18, 2013 11:53 AM
    Wednesday, September 18, 2013 11:40 AM
  • there could be three ways to go about it

    1. just like you set the td color to red in the onchange event of picklist, call the same function from onload.

    2. pass the optionset value as a parameter to your webresource through the custom data parameters box.

    3. check the option to pass parameters to web resource this would pass the entityid as the parameter to your webresource. make an odata call to read details of the particular entity and set the color.

    HTH

    Sam


    Dynamics CRM MVP | Inogic | http://inogic.blogspot.com| news at inogic dot com

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

    • Proposed as answer by Sam - Inogic Wednesday, September 18, 2013 12:00 PM
    • Marked as answer by Hamzak Thursday, September 19, 2013 10:05 AM
    Wednesday, September 18, 2013 12:00 PM