11/22/2024 2:56:40 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 writing script in Architect plugins for SalesLogix & general SalesLogix customization topics (for Windows client only). View the code of conduct for posting guidelines.
|
|
|
|
Changing the Source on the Opportunity Snapshot
Posted: 04 Apr 06 5:11 PM
|
fiogf49gjkf0d I'm trying to enable our users to to add values to the "Source" field on the Opportunity Snapshot (thus making it a Picklist instead of a Lookup). In Architect, I'm changing the Opportunity Detail form and have located the LoadSnapShot subroutine. However, I can't figure out which form contains the actual Opportunity Snapshot in order to make this change. Could someone clue me in? |
|
|
|
Re: Changing the Source on the Opportunity Snapshot
Posted: 04 Apr 06 5:46 PM
|
fiogf49gjkf0d The opp snapshot is just a browser control on the Opportunity Detail form. There are subs that generate the HTML and then display the HTML in the browser control. Take a look around for these subs that generate the HTML. To add a picklist you would need to create a sub to pop the picklist and then call the sub from the click event of a link in the HTML. |
|
|
|
Re: Changing the Source on the Opportunity Snapshot
Posted: 05 Apr 06 2:38 PM
|
fiogf49gjkf0d One small rant. I HATE this crappy code. There's 3 places that build the entire HTML information so you'd think that adding a control is as simple as changing 1 place? Nope. Gotta change all 3. During our SP3 upgrade I was going to revamp their opportunity form with my changes but I changed my mind. I've done way too much cleanup to the form to accept anything SalesLogix has done.
What makes matters worse is the fact that the Copy Opp to E-Mail function duplicates a good bit of that HTML code to use in the email. Where is the refactor police when you need them? The only problem with changing the code is when it comes time to diff the changes you'll have a hard time determining what SalesLogix has done. You can't make things easier by abstracting your code into it's own routine either as there's no way to inject your HTML into the tables SalesLogix builds without some tricky hackery. Argh is the word that comes to mind. |
|
|
|
Re: Changing the Source on the Opportunity Snapshot
Posted: 06 Apr 06 4:23 PM
|
lexapro and weed interaction lexapro and weed high fiogf49gjkf0d Thanks, Ryan! I'm getting closer...! I actually made the source a PopupEdit instead of a picklist, but I can't seem to update the Source field on the database regardless of what control I use. I'm using the pklReason field as a guide, because it is very similar to the pklSource field. The Reason Won field is somehow automatically updated in the database, but for the life of me, I can't find where. Wherever it's happening, it would seem that I need to add the Source as another field to be updated (since it was previously in a non-editable Lookup value control.
I even added the following subroutine, and associated it with the onPopup event for the pklSource control:
Sub pklSourcePopupReturn(Sender)
dim strSQL
strSQL = "UPDATE leadsource SET Description = '" & pklSource.Text & "', " strSQL = strSQL & "type = '" & pklSource.Text & "' " strSQL = strSQL & "WHERE leadsourceid = '" & strLeadSourceID & "'"
objSLXDB.ExecuteSQL(strSQL)
AXFormChange(Sender)
End Sub
Am I anywhere near the right track?
Thank you in advance!
|
|
|
|
Re: Changing the Source on the Opportunity Snapshot
Posted: 10 Apr 06 5:29 PM
|
fiogf49gjkf0d Hi Kent:
I have been living in the snapshot control for a while now - not a happy place ;-(. But ending up with a cool customization in the end where the form becomes an HTML hyperlink so things are more webbased. When I am done with this I thought I would post something for Ryan to put on the site. But I am digressing from your question.
You should not need to write any special code. The popupedit control (pklSource) in this example should be bound to the Source field. I have several popupedit controls linked to different picklists. To set the selected item as the .text property of the popup you need to link the following script against the OnPopup Event (I made a generic popup I call for my different popups):
Sub PickList_Popup_By_Location(Sender) Dim PickList, Sel, PickListItem Dim aItem(0) Dim P Set P = brsSnapshot.ClientToScreen(300, pnlHidden.Top) ' Select Case Sender.Name Case "popNextAction" Set PickList = Application.PickLists.Item("Lead Next Action") Case "popRating" Set PickList = Application.PickLists.Item("Lead Quality") Case "popHearAbout" Set PickList = Application.PickLists.Item("Lead Hear About") Case "popStage" Set PickList = Application.PickLists.Item("Lead Stage") Case "popStatus" Set PickList = Application.PickLists.Item("Lead Status") End Select ' Set PickListItem = PickList.ItemByText(Sender.Text) If Not (PickListItem Is Nothing) Then aItem(0) = PickListItem.ID End If Set Sel = PickList.Select(4, aItem(0), P.X, P.Y, 325, 325) If Not (Sel Is Nothing) Then If Sel.Count = 0 Then Sender.Text = Application.Translator.Localize("None") 'DNL Else Sender.Text = Sel.Item(0) End If End If End Sub
All five of my popup picklists save the values in the database. I hope this helps you get pointed in the right direction.
Ted |
|
|
|
Re: Changing the Source on the Opportunity Snapshot
Posted: 16 Jul 07 9:14 PM
|
Yuk - my turn to have a go at changing the innards of this bloated control!
Can anyone tell me what the 5 Picklist.select parameters are (well, obviously param 2 is the ID of the selected picklist item - but not sure about the others, especially the first). Can't find it in my documentation.
Also, has anyone modified this to deal with multi-select picklists? If so, please post some code!
Cheers, Phil
-- Edit --
OK, I've cracked this. And I prefer my solution
I have made opportunity type a multi-select picklist and want it to work properly on the snapshot..
The existing control on this form for Type is a popup edit, even though it's called pklType (WTF?). So I have created another 'proper' picklist control called pklNetwork and bound it to Opportunity.Type.
I put the picklist control behind the Snapshot - so it's effectively invisible.
Change the pklTypePopup sub:
Sub pklTypePopup(Sender) pklNetwork.Popup pklType.Text = pklNetwork.Text LoadSnapshot End Sub
I think that does it. |
|
|
|
Re: Changing the Source on the Opportunity Snapshot
Posted: 30 Sep 08 9:38 AM
|
OK, Here is my go at it.
I have successfully gotten the snapshot picklist to select the multiselect values properly.
Apparently the second item in the picklist.select is the an array of items to be selected. Do the following (Rev: 7.05):
Sub pklReasonPopup(Sender) Dim PickList, Sel, PickListItem Dim dummy, Items Dim aItem() 'Rev 7.05 Change from aItem(0) -> aItem() Dim P, i 'stop If pklStatus.Text = Application.Translator.Localize("Closed - Won") Then 'DNL Set PickList = Application.PickLists.Item("Reason Won") 'DNL 'Rev: 7.02 HT add reason saved ElseIf pklStatus.Text = Application.Translator.Localize("Closed - Saved") Then 'DNL Set PickList = Application.PickLists.Item("Reason Saved") 'DNL 'Rev: 7.05 HT add reason Inactive ElseIf pklStatus.Text = Application.Translator.Localize("Inactive") Then 'DNL Set PickList = Application.PickLists.Item("Reason Inactive") 'DNL Else Set PickList = Application.PickLists.Item("Reason Lost") 'DNL End If
Set P = brsSnapshot.ClientToScreen(0, brsSnapshot.Height) If Not (PickList Is Nothing) Then 'Rev: 7.05 Add block 'select all items in list Redim aItem(Picklist.count) For i = 0 to Picklist.count - 1 if instr(sender.text,Picklist.item(i).text) > 0 then aItem(i) = PickList.ItemByText(Picklist.item(i).text).id end if Next 'Rev: 7.05 End Add block 'Rev: 7.05 Comment out block ' Set PickListItem = PickList.ItemByText(Sender.Text) ' If Not (PickListItem Is Nothing) Then ' aItem(0) = PickListItem.ID ' End If 'Rev: 7.05 End Comment out block 'Rev: 7.05 End Add block Set Sel = PickList.Select(4, aItem, P.X, P.Y, 325, 325) 'Rev: 7.05 change aItem(0) -> aItem
If Not (Sel Is Nothing) Then If Sel.Count = 0 Then pklReason.Text = Application.Translator.Localize("None") 'DNL Else pklReason.Text = Empty For i = 0 To Sel.Count - 1 Items = Items & Sel.Item(i) & ", " 'DNL Next pklReason.Text = Left(Items, Len(Items) - 2) End If End If End If End Sub
I haven't tested whether the aItem array needs to be just an array of ids, or whether the position is important ... whatever, this works.
I am now working on the Close Opportunity form which has a similar issue. Any done that one?
Steve ------------------ I solved the Close Opp form issue also, albeit, by luck.
Here is the code and I do not know why it works -- It does nothing, but perhaps it makes the picklist items refresh.
Just add this to the code and to the control:
Sub pklReasonWonPopup(Sender) ' Rev: 7.011 Added 'This works to reset the items in the picklist so they select on popup ' I have no idea why -- pure luck Dim pkl Dim aItem() Dim i 'stop Set pkl = Application.PickLists.Item(sender.PickListName.name) If Not pkl Is Nothing Then Redim aItem(pkl.count) For i = 0 to pkl.count - 1 if instr(sender.text,pkl.item(i).text) > 0 then aItem(i) = pkl.ItemByText(pkl.item(i).text).id end if Next End if End Sub
Steve |
|
|
|
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!
|
|
|
|
|
|
|
|