11/25/2024 7:22:56 PM
|
|
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 using & developing the legacy SalesLogix Web Client (For versions 7.0 and earlier). View the code of conduct for posting guidelines.
|
|
|
|
Problems adding validation to closing an Opportunity
Posted: 30 Jan 08 5:35 AM
|
[ This is no longer a problem. This thread can be deleted or ignored ]
Background: ---------------
I've been asked to add some validation to the Opportunity info page. When a user attempts to change the Status to 'Closed - Won', a check needs to be done to ensure the Account of this Opportunity has subscribed to a Service. Here's a brief description of this data structure which resolves the M:M relationship of Account and Service:
Account.AccountID -> AccService.AccountID, AccService.ServiceID -> Service.ServiceID
The validation process is simple, in theory. Opportunities have an Account and also a Service associated. To close the Opportunity successfully, the associated Account must be subscribed to the Service of that Opportunity - i.e. there must be a record in the AccService table where the AccountID and ServiceID of the Opportunity are matched.
Problem(s): --------------
i) I attempted to create a field which contained the result of an SQL query, with the intention of checking the value of this field in Javascript when the Status was changed to 'Closed - Won'. The query was as follows: SELECT COUNT(*) FROM ACCSERVICE WHERE SERVICEID = '' AND ACCOUNTID = '' The problem is, I don't know the best way (or indeed any way) to get the ServiceID into this string, so that it fits syntactically into a <#SQL code=...> tag. I got the AccountID in by using ':accid' in the string. Here's what the field looks like in code: <input type="text" name="checkservice" value="<#SQL code="SELECT ...<truncated>... WHERE SERVICEID = 'Q6UJ9A0004AK' AND ACCOUNTID = :accid" format=0>" /> I've only been able to make this display the correct result by hard-coding in a ServiceID ("WHERE SERVICEID = 'Q6UJ9A0004AK'"). Obviously this won't work in practice as there are multiple possible Services. FYI, ServiceID is held in a hidden field on the form, with the value "<#FIELD name=oppservice>", therefore in the control 'document.mainform.oppservice(.value)'. I've tried all ways I can think of to get the ServiceID from here to the SQL string. Hopefully someone can point out what I'm doing wrong? Is there a better way of accomplishing this?
ii) The value of "<#AF name=accid>" seems to be lost when scrolling through Opportunities using the 4 arrow buttons on the title bar. That is, a hidden field with the aforementioned tag is empty when scrolling through Opportunities; it's only populated when you access an Opportunity through the list view, and then only for that Opportunity. If I right-click > properties on the page, I get this: http://localhost:3333/scripts/slxweb.dll/view?name=oppinfo&id=O6UJ9A0001G1&oppid=O6UJ9A0001G1&accid=&atemplate=accmain&ctemplate=conmain&otemplate=oppmain Sure enough, the 'accid=' part is empty. Is this something I've done somehow or is this a bug?
Any assistance you can offer for either of these problems would be greatly appreciated.
Alec D (alec.denholm@qgate.co.uk) |
|
|
|
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!
|
|
|
|
|
|
|
|