The Forums on slxdeveloper.com are now retired. The forum archive will remain available for the time being. Thank you for your participation on slxdeveloper.com!
|
|
Forcing users to update two fields when they open a contact in detail view.
Posted: 25 Sep 06 9:28 AM
|
fiogf49gjkf0d Hi all.
Is there a way to force users to update two fields when they open a contact in detail view, if those two fields are empty. Both fields will be populated by choosing from a pick list.
So when a user opens a contact in detail view, if those two fields are empty then it will send them a message to update the one or both of the fields that are empty, and it will not let the user leave the contact detail view until they update it.
Any help would be great!
Thank you in advance. |
|
|
|
Re: Forcing users to update two fields when they open a contact in detail view.
Posted: 26 Sep 06 12:45 AM
|
fiogf49gjkf0d Hi Fabian, You can create a procedure to find whthere these two fields are empty or not. It's empty then you prompt a message to fill it. At same time you can set modulresult of plugin = mrCancel so that the form cannot save. You call this procedure from 'AXFormValidate' event of plugin. Hope this will help you. |
|
|
| |
|
Re: Forcing users to update two fields when they open a contact in detail view.
Posted: 26 Sep 06 10:30 AM
|
fiogf49gjkf0d Fabian
You can add an OnCreate or OnExit type of function that surveys the fields and {if NULL} then pop a message or complete pop up window. However from a business logic point of view; What if the user doesn't know? What if it is a manager who pulled into the screen for a drill down to history or activities? In these cases, you may get data but it will probably be dirtier data than a NULL value...
Carla
|
|
|
|
Re: Forcing users to update two fields when they open a contact in detail view.
Posted: 26 Sep 06 10:52 AM
|
fiogf49gjkf0d Thanks for the reply Carla.
The pick list will have Yes, No, N/A. And we will run a process that will send the manager of each territory all contacts that have N/A and it's up to them to have their people update the picklist. I will try the OnExit type of function in the contact detail view and see how that goes. |
|
|
|
Re: Forcing users to update two fields when they open a contact in detail view.
Posted: 26 Sep 06 12:46 PM
|
fiogf49gjkf0d Dim PriceLevel PriceLevel = PickList2.Text
if PriceLevel = "" then
MsgBox "Enter a Price Level", 0, "Error"
End if
Where can I add this script so that when a user tries to go to another contact or go to Accounts or Opportunities it will prompt the message. I saw a function: AXFormChange in the account detail view, should I add this code as the last if statement? |
|
|
|
Re: Forcing users to update two fields when they open a contact in detail view.
Posted: 26 Sep 06 3:20 PM
|
fiogf49gjkf0d Swapnil,
what do mean by: At same time you can set modulresult of plugin = mrCancel so that the form cannot save. You call this procedure from 'AXFormValidate' event of plugin.
Do I have to include that in my procedure? Here is what I have (the beginning is part of SalesLogix):
Function AXFormValidate(Sender)
strCRLF = chr(13) & chr(10)
if strAccount <> txtAccount.Text then if MsgBox ("You have changed the account name from " & chr(34) & strAccount & chr(34) & " to " & chr(34) & txtAccount.Text & chr(34) & strCRLF & strCRLF & _ "Are you sure you want to change the acccount name?", vbYesNo + vbExclamation + vbDefaultButton2, "Warning") = vbNO then txtAccount.Text = strAccount end if 'if MsgBox (...) = vbNO end if 'if strAccount <> txtAccount.Text
Dim PriceLevel PriceLevel = PickList2.Text
if PriceLevel = "" then MsgBox "Enter a Price Level", 0, "Error" AXFormValidate = False end if
'if you don't set AXFormValidate = True, then the form will abort the close function that called this function '(This would be similar to SetProperty "Postable", "False" in legacy scripts) AXFormValidate = True End Function
|
|
|
| |
|
Re: Forcing users to update two fields when they open a contact in detail view.
Posted: 26 Sep 06 11:38 PM
|
fiogf49gjkf0d Fabian, Yes you are right. You have to add your code in AXFormValidate function.If these values are blank or null then you have to set value of function = False. eg. AXFormvalidate = False Exit the procedure before end if. eg. if PriceLevel = "" then MsgBox "Enter a Price Level", 0, "Error" AXFormValidate = False exit function end if
Regarding that error "Validation Error: "You must fill in all required information!". In some control(s) the 'required' property set as true. Just b'coz of this SLX won't allow you to move further. You have to put some values in that fields. Don't keep it blank.
|
|
|
| |
| |
|
Re: Forcing users to update two fields when they open a contact in detail view.
Posted: 28 Sep 06 1:25 PM
|
fiogf49gjkf0d Fabian,
If I understand this correctly.. is the item they are filling a picklist..? if so you can add to the AXFormChange Event the following:
pklPriceLevel.setfocus
and make the picklist a required entry.. this will force them to enter something into the picklist before it will move on. By setting the focus to the control your forcing them into it and forcing the required collection. This will then happen everytime they change an account.
Only downside is that each time the screen changes they will be in that picklist and possiblity of accidental changes.. ut you can force the picklist to match the listings and that usally takes care of accidential changes..
If you need this to happen for only certain accounts just add it into a select of if statement where it checks for the "Type" of account or status etc. before sending focus to the picklist.
Hope this helps if I understood what you needed..
Rich |
|
|
|
Re: Forcing users to update two fields when they open a contact in detail view.
Posted: 29 Sep 06 8:11 AM
|
fiogf49gjkf0d Originally posted by Carla Tillman
In these cases, you may get data but it will probably be dirtier data than a NULL value...
|
|
I agree with Carla on this one too. Required fields are a tricky business from a development perspective. Sales people are notorious for finding ways around restrictions when they slow them down.
I've always found that 'required' data becomes a PEOPLE problem not a technology one.
Marc |
|
|
|
Re: Forcing users to update two fields when they open a contact in detail view.
Posted: 04 Oct 06 8:05 AM
|
fiogf49gjkf0d Originally posted by RJ Eaton
Fabian,
If I understand this correctly.. is the item they are filling a picklist..? if so you can add to the AXFormChange Event the following:
pklPriceLevel.setfocus
and make the picklist a required entry.. this will force them to enter something into the picklist before it will move on. By setting the focus to the control your forcing them into it and forcing the required collection. This will then happen everytime they change an account.
Only downside is that each time the screen changes they will be in that picklist and possiblity of accidental changes.. ut you can force the picklist to match the listings and that usally takes care of accidential changes..
If you need this to happen for only certain accounts just add it into a select of if statement where it checks for the "Type" of account or status etc. before sending focus to the picklist.
Hope this helps if I understood what you needed..
Rich |
|
Rich I tried that and indeed it does focus on the picklist when I go from one account to the next, and I made it a required entry but it still allows me to go to the next record. I did not think this would be so difficult to accomplish!...so I'm going to suggest making a business rule out of the picklist to keep SalesLogix up to date.
Thanks for everyone's help! |
|
|
| |
|
Validating a picklist on btnOKClick
Posted: 27 Jan 16 11:30 AM
|
Hi,
I thought this might be a suitable place to fit my question in.
I have a picklist which is successfully validated on field exit, i.e. the user cannot exit the blank field if no item chosen.
However they can press the OK button and the plugin closes with no validation.
I have tried the following code which sucessfully raises a message, but the once the message is cleared the plugin form should remain open - but it doesn't. Can you please advise how I can keep the popup open? I thought SetFocus whould do it.
If (Not strStatus = Application.Translator.Localize("Closed - Won")) & CheckForNull(pklReasonWon.Text) Then
MsgBox Application.Translator.Localize("Please enter a Reason Lost."),, "SalesLogix"
pklReasonWon.SetFocus
'--- Keep popup open
Else
'--- Process and close
Thanks,
Lee |
|
|
|
Re: Validating a picklist on btnOKClick
Posted: 28 Jan 16 6:03 AM
|
Hi,
Are you running your validation code in the OnClick event of the button?
Try moving your code to the form event OnValidate. Then after your line where you set focus to your picklist add the following line:
AXFormValidate = false
That should be enough to stop the form from closing if the user has not selected a value in the picklist.
|
|
|
|