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!
|
|
Adding a condition(where clause) to ALL queries
Posted: 16 Feb 07 7:09 PM
|
fiogf49gjkf0d Hello,
I would like to add a where clause to ALL queries performed on the contacts table. Can this be done..
The account ownership is everyone. however the sales rep should be able to see/query only the contacts he/she entered.. is this possible.. I would like to add a custom field called 'userid' on the contact table and restrict the users to only viewing these contacts
|
|
|
|
Re: Adding a condition(where clause) to ALL queries
Posted: 16 Feb 07 11:21 PM
|
fiogf49gjkf0d You do not need to add a column as you can use the createuser field. However, no, you can not impose this restriction via scripting. For example, consider the ability for users to add groups - you can not impose a condition that adds your restriction.
Depending on the version that you are running you can add security extensions that do what you need. This, however, seems like overkill. Why dont you just change your security model so that accounts are not owned by everyone? If all you are filtering on is a single column, why not use the stock product security that also filters by a single column (seccodeid)? When the sales rep adds a record make them the owner of the record. This requires zero customization (well maybe hardcoding the seccodeid to be the current user vs using useroptions requires a single line of code). If you have found short comings with this option please elaborate as I suspect we can get you what you need without a bunch of code.
Timmus |
|
|
|
Re: Adding a condition(where clause) to ALL queries
Posted: 19 Feb 07 2:17 PM
|
fiogf49gjkf0d Hello Timmus,
Thank you for your response. I like the option of updating the SeccodeID for each record.. This however will make the Account SeccodeID different from the contact and Opportunity SeccodeId. is this OK (so, the account seccodeId will be Everyone/Team, the contact and the Opportunity SeccodeID will be the individual users). Will this cause any issues? Please advice.
also, we are panning to upgrade our current 6.1 version to 7.0 and you had mentioned the use of security extensions. can you guide me to some documentation on this and how this could be done?
|
|
|
|
Re: Adding a condition(where clause) to ALL queries
Posted: 19 Feb 07 4:41 PM
|
fiogf49gjkf0d David,
This is doable especially since you are leaving the Account.SecCodeID alone. The system is hard coded to cascade the Account.SecCodeID to its children Contacts and Opportunities. But as mentioned this will not matter since you are leaving Account.SecCodeID alone. For example, you can not use the Territory Realigment tool as any changes to the Account will be applied to its child records.
Note that there are ways around this even if you do intend on changing Account.SecCodeIDs in the future. It just requires a bit of hacking (and its not supported).
For now, I would just modify the Add New Account Contact form to map the Contact.SecCodeID to the current user. In version 6.2.4 the line number is 244: I have included the signature of the member as well, just in case your has been customized:
Sub InsertNewContact(strSeccodeID, strPrimaryAddress, strShippingAddress) Dim strSQL Dim objRS
Set objRS = objSLXDB.GetNewRecordSet strSQL = "Select * From CONTACT Where 1=2" 'DNL objRS.Open strSQL, objSLXDB.Connection With objRS .AddNew .Fields("CONTACTID").Value = CheckForNull(mLastConID) 'DNL .Fields("ACCOUNTID").Value = CheckForNull(mLastAccID) 'DNL .Fields("ACCOUNT").value = CheckForNull(txtAccount.Text) 'DNL '.Fields("SECCODEID").Value = strSeccodeID 'DNL .Fields("SECCODEID").Value = Application.Users.Item(Application.BasicFunctions.CurrentUserID).DefaultSecCodeID 'DNL
I commented out the original line which uses strSeccodeID and instead used the current user's defaultseccodeid.
I have not tested this but it should get you started at least.
Timmus |
|
|
| |
| |
|