Hi,I'm really new to this and need help. My customer has requested that I add a new field onto the workspace form. She has asked that I make the field a required field depending the value of the nrCustom1 field. I have created a newws.nrs script with the following code. It works perfectly the first time but only the first time. How can I make this code fire everytime a new workspace is being added? The script:newws.nrsConst nrCustom8 = 32Sub IManNewWorkspaceDlg_OnChange(dlg,id)Dim lngArrayDim MyCustom1If id = 25 then MyCustom1 = dlg.GetAttributeByID(id) If MyCustom1 = "CL" then lngArray = Array(nrCustom8) dlg.RequiredList = lngArray else If MyCustom1 = "L" then dlg.SetAttributeValueByID nrCustom8, "Not Required", False End If End IfEnd If End Sub
Thank you, I really appreciate the quick response. My problem is that I can't get the OnChange event to fire a second time. Example:I click new to add a new workspace. When I click off of the Custom8 field, my new field is populated with "not required" if the Custom8 is "L" or the new field is made Required if Custom8 is "CL". It all works fine the first time. Let's say I decide to Cancel out of the new workspace and then click new to add a new workspace again. The On_Change event does not fire again at all. If I exit out of Word or OutLook altogether and then log back in and try to add a new workspace, the On_Change event works fine again. I have seen that some of the other events like the OnInitDialog will only fire a second time if you use the Cmd_OnInitDialog. It seems that the Dlg_OnInitDialog only fires the first time. Is there a Cmd_OnChange event for a new workspace? I haven't found one yet.
Const nrCustom8 = 32Sub IManNewWorkspaceDlg_OnChange(dlg,id)Dim lngArrayDim MyCustom1If id = 25 then msgbox "OnChange" MyCustom1 = dlg.GetAttributeByID(id) If "CLIENT1" = MyCustom1 Then lngArray = Array(nrCustom8) dlg.RequiredList = lngArray dlg.SetAttributeValueByID nrCustom8, "",True End If If "CLIENT2" = MyCustom1 Then dlg.SetAttributeValueByID nrCustom8, "Not Required", False End If If len(trim(MyCustom1)) = 0 Then dlg.SetAttributeValueByID nrCustom8, "", True End IfEnd If End Sub
Since we are not in a position to upgrade to FileSite 8.2, we will make the field required all of the time and the customer will need to select "Not Required" from the dropdown. Thanks again for your prompt replys and help.
Sub IManNewWorkspaceDlg_OnChange(dlg,id)' Declare constant locally within the functionConst nrCustom8 = 3Dim lngArrayDim MyCustom1If id = 25 then' msgbox "OnChange" MyCustom1 = dlg.GetAttributeByID(id) If "CLIENT1" = MyCustom1 Then lngArray = Array(nrCustom8) dlg.RequiredList = lngArray dlg.SetAttributeValueByID nrCustom8, "",True End If If "CLIENT2" = MyCustom1 Then dlg.SetAttributeValueByID nrCustom8, "Not Required", False End If If len(trim(MyCustom1)) = 0 Then dlg.SetAttributeValueByID nrCustom8, "", True End IfEnd If End Sub
I've also moved the Const declare inside the event and it does work but the event only fires the first time. If I log out and back in to word or outlook, then it works fine again. Like I said before, it seems like I'm missing something that initializes the workspace profile or something like that. For now, we are going to make the field required no matter what the contents of nrCustom1 is. Thanks for all your help.