none
Bit field value not saving RRS feed

  • Frage

  • I have a field type BIT on my form and code which sets the value depending on another picklist field value selected.
    Below code is on the OnChange of the picklist.

    if(ckPicklist == 'Value1')
    {
      crmForm.all.new_bitValue.DataValue = true;
     }
    else
    if(ckPicklist == 'Value2')
    {
      crmForm.all.new_bitValue.DataValue = false;
     }
    It's working fine however if I save the form and reopen it the set BIT value is not saved??
    Donnerstag, 11. Februar 2010 13:14

Antworten

  • Hi,

    if the bitfield is shown as picklist, you have to use crmForm.all.new_bitValue.DataValue = 1; to save the field as true.

    Is the bitfield readonly on the form, you must use  crmForm.all.new_bitValue.forcesubmit = true; to save the changes in the database.

    Viele Grüße

    Michael Sulz
    MVP für Microsoft Dynamics CRM
    • Als Antwort vorgeschlagen Michael Sulz Donnerstag, 11. Februar 2010 13:25
    • Als Antwort markiert Morjo Donnerstag, 11. Februar 2010 13:41
    • Bearbeitet Michael Sulz Donnerstag, 11. Februar 2010 17:26
    Donnerstag, 11. Februar 2010 13:25
  • Hi,

    what you want to store, the Picklist2 or the bit field? The code you postet stores the bit field, not the picklist2.
    To store the picklist2, use crmForm.all.new_Picklist2.forcesubmit = true;


    Viele Grüße

    Michael Sulz
    MVP für Microsoft Dynamics CRM
    • Als Antwort markiert Michael Sulz Freitag, 7. Januar 2011 13:44
    Donnerstag, 11. Februar 2010 17:24

Alle Antworten

  • Hi,

    if the bitfield is shown as picklist, you have to use crmForm.all.new_bitValue.DataValue = 1; to save the field as true.

    Is the bitfield readonly on the form, you must use  crmForm.all.new_bitValue.forcesubmit = true; to save the changes in the database.

    Viele Grüße

    Michael Sulz
    MVP für Microsoft Dynamics CRM
    • Als Antwort vorgeschlagen Michael Sulz Donnerstag, 11. Februar 2010 13:25
    • Als Antwort markiert Morjo Donnerstag, 11. Februar 2010 13:41
    • Bearbeitet Michael Sulz Donnerstag, 11. Februar 2010 17:26
    Donnerstag, 11. Februar 2010 13:25
  • when I use:
    crmForm.all.new_bitValue.DataValue = 1;
    and crmForm.all.new_bitValue.DataValue = 0;

    I get a error message saying "This control only supports true, false, or null as an input."

    Field is not set as readonly.
    Donnerstag, 11. Februar 2010 13:36
  • Tested with the crmForm.all.new_bitValue.forcesubmit

    works!!! Thanks. :)
    Donnerstag, 11. Februar 2010 13:41
  • Hi Michael,

    I just realized im having the same issue with a different picklist not saving.



    if(ckPicklist == 'Value1')
    {
      crmForm.all.new_bitValue.DataValue = true;
      crmForm.all.new_bitValue.forcesubmit;
      crmForm.all.new_Picklist2.SelectedText = 'something';
     }
    else
    if(ckPicklist == 'Value2')
    {
      crmForm.all.new_bitValue.DataValue = false;
      crmForm.all.new_bitValue.forcesubmit;
      crmForm.all.new_Picklist2.SelectedText = 'something else';
     }
    I tried the forcesubmit but won't work?
    Donnerstag, 11. Februar 2010 13:52
  • Hi,

    what you want to store, the Picklist2 or the bit field? The code you postet stores the bit field, not the picklist2.
    To store the picklist2, use crmForm.all.new_Picklist2.forcesubmit = true;


    Viele Grüße

    Michael Sulz
    MVP für Microsoft Dynamics CRM
    • Als Antwort markiert Michael Sulz Freitag, 7. Januar 2011 13:44
    Donnerstag, 11. Februar 2010 17:24
  • Changed my picklist to a bit type field before i saw your response so its all good for now :)

    Thank you.
    Montag, 15. Februar 2010 12:49