locked
CRM 2013 - Display calculated total in a readonly field. RRS feed

  • Question

  • Hi all,

    Can anyone help me how to solve the below issue?

    I have three field in my form:  Field A, Field B, Field Total.

    I have put a calculation, javascript to calculate total of Field A & Field B and display the total in Field Total.

    I have set Field Total as readonly so that user will not be able to manipulate it's value.

    When I am saving the form the value of Field Total doesnt get saved.

    Why is it so?

    Can anyone help me please?

    Thanks & regards

    Vinay

    Thursday, January 23, 2014 2:11 PM

Answers

  • you need to set the submit mode of the field to always, so it will be saved also when it is readonly:

    Xrm.Page.getAttribute("fieldName").setSubmitMode("always"); 


    My blog: www.crmanswers.net - Rockstar 365 Profile

    • Proposed as answer by Guido PreiteMVP Thursday, January 23, 2014 2:13 PM
    • Marked as answer by Vinay J Friday, January 24, 2014 9:03 AM
    Thursday, January 23, 2014 2:13 PM

All replies

  • you need to set the submit mode of the field to always, so it will be saved also when it is readonly:

    Xrm.Page.getAttribute("fieldName").setSubmitMode("always"); 


    My blog: www.crmanswers.net - Rockstar 365 Profile

    • Proposed as answer by Guido PreiteMVP Thursday, January 23, 2014 2:13 PM
    • Marked as answer by Vinay J Friday, January 24, 2014 9:03 AM
    Thursday, January 23, 2014 2:13 PM
  • Hi guido,

    Thanks a lot.

    That works fine.

    Regards

    Vinay

    Friday, January 24, 2014 9:03 AM
  • Hi there,

    force to submit!

    In detail:

    after writing the set attribute in the save event of the the record, please use

    Xrm.Page.getAttribute("fieldnamelogicalname").setSubmitMode("always"); 

    that should do the job.

    Thanks

    Friday, January 24, 2014 5:10 PM