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.
|
|
|
|
Jumping to mainview.
Posted: 28 May 07 7:01 PM
|
I have a new mainview and want to use a linkedit to jump to the mainview on click. What is the equivalent to the SetCurrentAccountID, etc.? I can use ShowViewForRecord but this only lets me reference the form that is in the details section of the mainview, not the mainview itself.
Thanks, Scott |
|
|
|
Re: Jumping to mainview.
Posted: 29 May 07 2:53 AM
|
Scott, get your id from wherever:
strCurrentID = 'id of MV to open
If strCurrentID <> "" then Application.MainViews.AddEx "Family:MVName", 1, True, 1,strCurrentID , "" 'DNL e.g Application.MainViews.AddEx "EventManagement:Event Details", 1, True, 1,strCurrentID , "" 'DNL
The Family relates to the plugin family and MVName is the physical name of your mainview. |
|
|
|
Re: Jumping to mainview.
Posted: 29 May 07 12:57 PM
|
Hi Scott,
There are actually a few ways to do it. As Mike mentioned, you can use Application.MainViews.Add or Application.MainViews.AddEx. This is usually the preferred way since you have the most control over it (specifying the exact mainview to load, how to load it, whether to create a new one or reuse an existing open mainview etc)
You can also use:
Application.BasicFunctions.ShowDetails(TableName, RecordID) - Since there is no way to specify a specific MainView name, you will get the first one it finds if multiple MainViews exist for the same table. In your case, for a custom table, there isn't likely going to be more than one for the same table so should work fine. There's nothing wrong with using this way, I do all the time. Quick and easy.
Application.MainViews.GetViewForRecord(RecordID, TableName) As MainView - This one will create a MainView (or retrieve if already opened) for the table & record passed. You can then do whatever needed for displaying the mainview, accessing details or whatever. Same thing as ShowDetails, it will grab the first one it comes to if there is more than one MainView for the table.
-Ryan |
|
|
|
Re: Jumping to mainview.
Posted: 07 Jan 08 11:16 AM
|
I'm trying to do this from a form and launch the AccountDetail screen.
Application.MainViews.AddEx "System:RET_Account Detail", 1, True, 1,txtAccID.Text , ""
Should the value of txtAccID.Text be an ACCOUNTID? I'm getting a blank page. thanks. |
|
|
|
Re: Jumping to mainview.
Posted: 07 Jan 08 11:23 AM
|
IIRC you'll need to also set the CurrentID property of the MainView. However, without seeing the rest of the code, are you trying to just move to the account? Or launch your form in a window? |
|
|
|
Re: Jumping to mainview.
Posted: 15 Jan 08 2:07 PM
|
I'm still having trouble getting this to work..
strsql = "select ACCOUNTID, DESCRIPTION FROM OPPORTUNITY WHERE OPPORTUNITYID = '" & txtOppID.Text & "'" set rs = objConn.Execute(strSQL) txtAccID.Text = rs.Fields("ACCOUNTID").value
Application.MainViews.AddEx "System:RET_Account Detail", 1, True, 1,txtAccID.Text , "" Thanks. |
|
|
|
Re: Jumping to mainview.
Posted: 16 Jan 08 8:52 AM
|
Originally posted by Glenn Williams
I'm still having trouble getting this to work..
strsql = "select ACCOUNTID, DESCRIPTION FROM OPPORTUNITY WHERE OPPORTUNITYID = '" & txtOppID.Text & "'" set rs = objConn.Execute(strSQL) txtAccID.Text = rs.Fields("ACCOUNTID").value
Application.MainViews.AddEx "System:RET_Account Detail", 1, True, 1,txtAccID.Text , "" Thanks. |
|
Personally I would make the following changes, although they may not be totally necessary. With SalesLogix and variant variable declaration I like to make sure
dim strSQL, strID strsql = "select ACCOUNTID, DESCRIPTION FROM OPPORTUNITY WHERE OPPORTUNITYID = '" & txtOppID.Text & "'" set rs = objConn.Execute(strSQL) strID = rs.Fields("ACCOUNTID").value & "" 'Note the & "" , this not only allows you to avoid the null condition but insures the value is cast as a string if (strID <> "") then 'this should NEVER be null for an opportunity but better safe than sorry if it's blank it just takes you to the record not found screen, why put the user through that. Application.MainViews.AddEx "System:RET_Account Detail", 1, True, 1, strID, "" 'DNL end if
Other suggestions, if you are only retrieving a single value, the script SLX Database Support has a GetField function that is pretty convenient to use. Also, be sure your custom account detail screen is in the 'System' family (and not personal or account or something else) and make sure it is spelled correctly.
|
|
|
|
Re: Jumping to mainview.
Posted: 17 Jan 08 3:29 AM
|
Glen
This should do it:
Dim strAccID strAccID = GetField("ACCOUNTID","OPPORTUNITY,"OPPORTUNITYID = '" & txtOppID.Text & "'") If strAccID <> "" then Application.MainViews.AddEx "System:RET_Account Detail", 1, True, 1,strAccID, ""
This assumes that txtOppID does actually contain a valid opportunityID and also that your "RET_Account Detail" form does exist in the system family (not elsewhere) and it's primaryid is an accountid and nothing else.
|
|
|
|
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!
|
|
|
|
|