locked
Calculated Read Only Field RRS feed

  • Question

  • I have a calculated field on a form. It takes data from Field 1 multiplies it by the data in Field 2 and populates Field 3. The calculation works fine unless I make the field Read Only. 

    If it is Read Only then the first time it calculates everything is fine.

    If you update the data in one of the other fields that is being used in the calculation (Field 1 or Field 2) the data in the Read Only field does not change.  If the calculated field is Read Write then it updates.

    I have tried adding

    crmForm.all.resultpct.ForceSubmit = true;

    to the code but it still doesn't work.

    I am fairly new to this so it is possible I don't have the code in the correct place(s)

    Can I correct this or does the calculated field need to remain Read Write in order to update?

     

    Thanks

     

    Wednesday, June 30, 2010 7:46 PM

Answers

  • Readonly fields are not saved into database. If I want to save readonly field in the database, then I use form OnSave event where I set the field to readwrite.

    crmForm.all.<fieldname>.Disabled = false;


    Dejan Dular

    Microsoft Certified Business Management Solutions Specialist
    • Proposed as answer by Dejan Dular Monday, August 9, 2010 8:08 AM
    • Marked as answer by Jim Glass Jr Monday, August 9, 2010 3:01 PM
    Monday, August 9, 2010 7:11 AM

All replies

  • Should it be in crm forums?
    Have fun with Reporting Service
    Thursday, July 1, 2010 5:44 AM
  • Yes this should be in the CRM forum - my mistake.
    Thursday, July 8, 2010 3:21 PM
  • First of all you have to write the code in OnChange() event of both attributes, so that it will calculate whenever the value get changes in any / both attributes.

    Entity FORMS in Design Mode -> Double Click on the attribute -> Events Tab - > click on OnChage Button - > Paste the code. Repear this for both attributes.

    And you can use the below code to submit the changes in the read-only field which should save in MS CRM Database.

    crmForm.all.resultpct.ForceSubmit = true;

    Hope this helps.


    Thanks, Ranjitsingh R | http://mscrm-developer.blogspot.com/ | MS CRM Consultant
    • Proposed as answer by Ranjitsingh R Monday, August 9, 2010 6:12 AM
    Monday, August 9, 2010 6:12 AM
  • Readonly fields are not saved into database. If I want to save readonly field in the database, then I use form OnSave event where I set the field to readwrite.

    crmForm.all.<fieldname>.Disabled = false;


    Dejan Dular

    Microsoft Certified Business Management Solutions Specialist
    • Proposed as answer by Dejan Dular Monday, August 9, 2010 8:08 AM
    • Marked as answer by Jim Glass Jr Monday, August 9, 2010 3:01 PM
    Monday, August 9, 2010 7:11 AM
  • Do not make field to read only

    Just make disabled it on form load

    crmForm.all.____________.Disabled = true;

    and on save make it false

     

     

     

     

    Monday, August 9, 2010 8:08 AM