11/27/2024 9:24:18 AM
|
|
slxdeveloper.com Community Forums |
|
|
|
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!
Forum to discuss writing script in Architect plugins for SalesLogix & general SalesLogix customization topics (for Windows client only). View the code of conduct for posting guidelines.
|
|
|
|
Check for duplicates when entering information in a UserField
Posted: 12 Mar 07 11:32 AM
|
fiogf49gjkf0d Hi all.
I have SalesLogix v6.2.6 and we have two userfields (CustDiv and CustNumber) they are in the Accounts table.
Currently, the end user has the option of adding the CustDiv and CustNumber if they know it, but we are running into problems because they are incorrectly entering CustDiv and CustNumber and we have duplicates and sometimes the CustDiv and CustNumber is in the database 3 or 4 times for the wrong customer name.
So I would like to add an event that when the user enters the CustDiv and CustNumber it checks in the database and if those two exact fields are in the system it should not let them to save it and it should give them a pop up message.
I've gone to the Architect and I went to the plugin and I added my subroutine to the AXFormChange procedure, but I need to get an idea on how to start.
Any ideas? Thank you in advance. |
|
|
|
Re: Check for duplicates when entering information in a UserField
Posted: 12 Mar 07 1:16 PM
|
fiogf49gjkf0d The problem is two-fold. On one hand you need to validate what's entered but on the other you may want to automatically fill in the next available number.
AXFormChange is where you would look for the last CustNumber then increment it, most likely involving a SQL statement like "select top 1 custnumber order by custnumber desc" (I get the order wrong off the top of my head but you get the idea).
AXFormValidate (after your form's OnValidate event is configured) is where you'd place the validation code. Your routine is going to check to see if a record is found that matches CustNumber and/or CustDiv. If found, set AXFormValidate to false and it'll keep the form open as well as stop SLX from saving the record. Only when AXFormValidate is true will it operate normally and because of this you have to be careful or else you could introduce a scenario where the form will never close.
I'd suggest looking at the Account Details screen or any other stock code that implements AXFormValidate (doing a search through the entire database wouldn't hurt). That'll give you the basic structure to follow. Once you've done validation for a few times and understand how to make things start and stop, streamlining the process becomes much easier. I add validation to every form whether I immediately need it or not because 9/10 times I'll eventually need it and the code I reuse is simple to adjust. |
|
|
| |
|
You can
subscribe to receive a daily forum digest in your
user profile. View the site code
of conduct for posting guidelines.
Forum RSS Feed - Subscribe to the forum RSS feed to keep on top of the latest forum activity!
|
|
|
|
|
|
|
|