CRM 4.0 I have 4 fields; all are bit type with default = "No" Field 1 = Compliance Question 1 | bit | No | Radio Button on Form Field 2 = Compliance Question 2 | bit | No | Radio Button on Form Field 3 = Compliance Question 3 | bit | No | Radio Button on Form Field 4 = Compliant ? | bit | No | Radio Button on Form. I would like to change Field 4 value from No to Yes if ALL 3 compliance questions = "Yes" and leave it at "No" if ANY of the 3 compliance questions = "No" Any help is greatly appreciated!! TIA - R. Fisher
Edit the code below and replace field1, field2, etc with your field names. Paste the edited code into the on change event of each of your three compliance question fields. If these fields can be set by workflow or callout, paste the code in the onload event of the form as well to handle those scenarios. if (crmForm.all.field1.DataValue == true && crmForm.all.field2l.DataValue == true && crmForm.all.field3.DataValue == true) { crmForm.all.field4.DataValue = true; } else { crmForm.all.field4.DataValue = false; } -- Richard Riddle CRM Developer Autonomix "RJ Fisher" wrote: > CRM 4.0 > I have 4 fields; all are bit type with default = "No" > > Field 1 = Compliance Question 1 | bit | No | Radio Button on Form > Field 2 = Compliance Question 2 | bit | No | Radio Button on Form > Field 3 = Compliance Question 3 | bit | No | Radio Button on Form > > Field 4 = Compliant ? | bit | No | Radio Button on Form. > > I would like to change Field 4 value from No to Yes if ALL 3 compliance > questions = "Yes" and leave it at "No" if ANY of the 3 compliance questions > = "No" > > Any help is greatly appreciated!! > > TIA - > R. Fisher > > >
What Richard suggested will work just fine. A shorter way is to simply assign the value of the if part as the value of field4. Note this this shorthand can be confusing when used in complex situations, so Richards way would be easier to understand, especially when someone else has to read your code. But here's my alternative as one line: crmForm.all.field4.DataValue = (crmForm.all.field1.DataValue == true && crmForm.all.field2.DataValue == true && crmForm.all.field3.DataValue && true); -- Cheers Paul Reyneke CRM Blog - http://paulreyneke.blogspot.com/ "Richard Riddle" wrote: > Edit the code below and replace field1, field2, etc with your field names. > Paste the edited code into the on change event of each of your three > compliance question fields. If these fields can be set by workflow or > callout, paste the code in the onload event of the form as well to handle > those scenarios. > > if (crmForm.all.field1.DataValue == true && crmForm.all.field2l.DataValue == > true && crmForm.all.field3.DataValue == true) > { > crmForm.all.field4.DataValue = true; > } > else > { > crmForm.all.field4.DataValue = false; > } > -- > Richard Riddle > CRM Developer > Autonomix > > > "RJ Fisher" wrote: > > > CRM 4.0 > > I have 4 fields; all are bit type with default = "No" > > > > Field 1 = Compliance Question 1 | bit | No | Radio Button on Form > > Field 2 = Compliance Question 2 | bit | No | Radio Button on Form > > Field 3 = Compliance Question 3 | bit | No | Radio Button on Form > > > > Field 4 = Compliant ? | bit | No | Radio Button on Form. > > > > I would like to change Field 4 value from No to Yes if ALL 3 compliance > > questions = "Yes" and leave it at "No" if ANY of the 3 compliance questions > > = "No" > > > > Any help is greatly appreciated!! > > > > TIA - > > R. Fisher > > > > > >
Even shorter :-) crmForm.all.field4.DataValue = crmForm.all.field1.DataValue && crmForm.all.field2.DataValue && crmForm.all.field3.DataValue; -- Michael Höhne, Microsoft Dynamics CRM MVP CRM Blog: http://www.stunnware.com/?area=blog "Bossie" wrote in message news:D64B60D5-A9F2-4DAE-9ED2-79040AD849C5@microsoft.com... > What Richard suggested will work just fine. A shorter way is to simply > assign > the value of the if part as the value of field4. Note this this shorthand > can > be confusing when used in complex situations, so Richards way would be > easier > to understand, especially when someone else has to read your code. But > here's > my alternative as one line: > > crmForm.all.field4.DataValue = (crmForm.all.field1.DataValue == true && > crmForm.all.field2.DataValue == true && crmForm.all.field3.DataValue && > true); > -- > Cheers > > Paul Reyneke > CRM Blog - http://paulreyneke.blogspot.com/ > > > "Richard Riddle" wrote: > >> Edit the code below and replace field1, field2, etc with your field >> names. >> Paste the edited code into the on change event of each of your three >> compliance question fields. If these fields can be set by workflow or >> callout, paste the code in the onload event of the form as well to handle >> those scenarios. >> >> if (crmForm.all.field1.DataValue == true && crmForm.all.field2l.DataValue >> == >> true && crmForm.all.field3.DataValue == true) >> { >> crmForm.all.field4.DataValue = true; >> } >> else >> { >> crmForm.all.field4.DataValue = false; >> } >> -- >> Richard Riddle >> CRM Developer >> Autonomix >> >> >> "RJ Fisher" wrote: >> >> > CRM 4.0 >> > I have 4 fields; all are bit type with default = "No" >> > >> > Field 1 = Compliance Question 1 | bit | No | Radio Button on Form >> > Field 2 = Compliance Question 2 | bit | No | Radio Button on Form >> > Field 3 = Compliance Question 3 | bit | No | Radio Button on Form >> > >> > Field 4 = Compliant ? | bit | No | Radio Button on Form. >> > >> > I would like to change Field 4 value from No to Yes if ALL 3 compliance >> > questions = "Yes" and leave it at "No" if ANY of the 3 compliance >> > questions >> > = "No" >> > >> > Any help is greatly appreciated!! >> > >> > TIA - >> > R. Fisher >> > >> > >> >
LOL true ;-) -- Cheers Paul Reyneke CRM Blog - http://paulreyneke.blogspot.com/ "Michael Höhne" wrote: > Even shorter :-) > > crmForm.all.field4.DataValue = crmForm.all.field1.DataValue && > crmForm.all.field2.DataValue && crmForm.all.field3.DataValue; > > -- > Michael Höhne, Microsoft Dynamics CRM MVP > > CRM Blog: http://www.stunnware.com/?area=blog > > "Bossie" wrote in message > news:D64B60D5-A9F2-4DAE-9ED2-79040AD849C5@microsoft.com... > > What Richard suggested will work just fine. A shorter way is to simply > > assign > > the value of the if part as the value of field4. Note this this shorthand > > can > > be confusing when used in complex situations, so Richards way would be > > easier > > to understand, especially when someone else has to read your code. But > > here's > > my alternative as one line: > > > > crmForm.all.field4.DataValue = (crmForm.all.field1.DataValue == true && > > crmForm.all.field2.DataValue == true && crmForm.all.field3.DataValue && > > true); > > -- > > Cheers > > > > Paul Reyneke > > CRM Blog - http://paulreyneke.blogspot.com/ > > > > > > "Richard Riddle" wrote: > > > >> Edit the code below and replace field1, field2, etc with your field > >> names. > >> Paste the edited code into the on change event of each of your three > >> compliance question fields. If these fields can be set by workflow or > >> callout, paste the code in the onload event of the form as well to handle > >> those scenarios. > >> > >> if (crmForm.all.field1.DataValue == true && crmForm.all.field2l.DataValue > >> == > >> true && crmForm.all.field3.DataValue == true) > >> { > >> crmForm.all.field4.DataValue = true; > >> } > >> else > >> { > >> crmForm.all.field4.DataValue = false; > >> } > >> -- > >> Richard Riddle > >> CRM Developer > >> Autonomix > >> > >> > >> "RJ Fisher" wrote: > >> > >> > CRM 4.0 > >> > I have 4 fields; all are bit type with default = "No" > >> > > >> > Field 1 = Compliance Question 1 | bit | No | Radio Button on Form > >> > Field 2 = Compliance Question 2 | bit | No | Radio Button on Form > >> > Field 3 = Compliance Question 3 | bit | No | Radio Button on Form > >> > > >> > Field 4 = Compliant ? | bit | No | Radio Button on Form. > >> > > >> > I would like to change Field 4 value from No to Yes if ALL 3 compliance > >> > questions = "Yes" and leave it at "No" if ANY of the 3 compliance > >> > questions > >> > = "No" > >> > > >> > Any help is greatly appreciated!! > >> > > >> > TIA - > >> > R. Fisher > >> > > >> > > >> > >