<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://customerfx.com/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Jason Buss&amp;#39; Blog : mainview objects, SalesLogix, scripting, Development, vbscript</title><link>http://customerfx.com/pages/customization/archive/tags/mainview+objects/SalesLogix/scripting/Development/vbscript/default.aspx</link><description>Tags: mainview objects, SalesLogix, scripting, Development, vbscript</description><dc:language>en</dc:language><generator>CommunityServer 2007 SP2 (Build: 20611.960)</generator><item><title>Building new Main Views in SalesLogix LAN - Part 2</title><link>http://customerfx.com/pages/customization/2009/04/15/building-new-main-views-in-saleslogix-lan-part-2.aspx</link><pubDate>Wed, 15 Apr 2009 12:00:00 GMT</pubDate><guid isPermaLink="false">e15581aa-2787-4c59-a940-524c09f5d256:40439</guid><dc:creator>Jason Buss</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://customerfx.com/pages/customization/rsscomments.aspx?PostID=40439</wfw:commentRss><comments>http://customerfx.com/pages/customization/2009/04/15/building-new-main-views-in-saleslogix-lan-part-2.aspx#comments</comments><description>&lt;p&gt;In my last Main Views article, I created the detail view as well as the mainview.&amp;nbsp; For this next part, I&amp;#39;ll go through creating an insert view, as well as toolbar and menu items for the new SLXProject entity.&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;&lt;u&gt;&lt;b&gt;Creating the Insert View:&lt;/b&gt;&lt;/u&gt;&lt;/p&gt;&lt;p&gt;The insert view for this new area will be created as a manage view, and the data will be written to the database using ADO.&amp;nbsp; We will start by creating a launch script for this view.&amp;nbsp; After creating a new active script in architect, I added the following code:&lt;/p&gt;&lt;p&gt;&lt;i&gt;Option Explicit&lt;br /&gt;&lt;br /&gt;Sub Main&lt;br /&gt;Dim objMv&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Application.BasicFunctions.DoInvoke &amp;quot;Form&amp;quot;, &amp;quot;System:Insert SLXProject&amp;quot;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Set objMv = Application.MainViews.Add(&amp;quot;System:Quote Details&amp;quot;, 1, True)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; With objMv&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; .Refresh&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; .Show&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; End With&lt;br /&gt;&lt;br /&gt;End Sub&lt;/i&gt;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;The Insert view itself is a simplified version of the detail view we already created.&amp;nbsp; Being a manage view, the controls on the insert view are not mapped to fields in the new SLXProject table.&lt;/p&gt;&lt;p&gt;&lt;a href="http://customerfx.com/blogs/customization/NewInsertView.JPG"&gt;&lt;img src="http://customerfx.com/blogs/customization/NewInsertView.JPG" border="0" width="530" height="371" alt="" /&gt;&lt;/a&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;I&amp;#39;ve also added code to two events on the insert view. &amp;nbsp;&lt;/p&gt;&lt;p&gt;The WhenOpen event is being used to set defualts on the form.&amp;nbsp; In this case, creating the ID for the new record, and defaulting the leader field to the currently logged in user:&lt;/p&gt;&lt;p&gt;&lt;i&gt;Sub AXFormOpen(Sender)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Form.CurrentID = Application.BasicFunctions.GetIDFor(&amp;quot;SLXProject&amp;quot;)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; lkeLeader.LookupID = Application.BasicFunctions.CurrentUserID&lt;br /&gt;End Sub&lt;/i&gt;&lt;/p&gt;&lt;p&gt;On the WhenClick Event of the OK button on the form, I am creating a new ADO recordset and saving the data entered on the form:&lt;/p&gt;&lt;p&gt;&lt;i&gt;Sub Button1Click(Sender)&lt;br /&gt;Dim objRS&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Set objRS = Application.CreateObject(&amp;quot;ADODB.Recordset&amp;quot;)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; With objRS&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Set .ActiveConnection = Application.GetNewConnection&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; .CursorLocation = adUseClient&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; .CursorType = adOpenStatic&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; .LockType = adLockOptimistic&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; .Open &amp;quot;select * from slxproject where 1=2&amp;quot;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; .AddNew&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; .Fields(&amp;quot;slxprojectid&amp;quot;).Value = Application.BasicFunctions.GetIDFor(&amp;quot;c_test&amp;quot;)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; .Fields(&amp;quot;accountid&amp;quot;).Value = CurrentID&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; .Fields(&amp;quot;createuser&amp;quot;).Value = Application.BasicFunctions.CurrentUserID&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; .Fields(&amp;quot;createdate&amp;quot;).Value = Now&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; .Fields(&amp;quot;modifyuser&amp;quot;).Value = Application.BasicFunctions.CurrentUserID&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; .Fields(&amp;quot;modifydate&amp;quot;).Value = Now&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; .Fields(&amp;quot;name&amp;quot;).Value = txtProjectName.Text&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; .Fields(&amp;quot;description&amp;quot;).Value = memDescription.Text&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; .Fields(&amp;quot;leader&amp;quot;).Value = lkeLeader.LookupID&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; .Fields(&amp;quot;isactive&amp;quot;).Value = &amp;quot;T&amp;quot;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; .Fields(&amp;quot;accountid&amp;quot;).Value = &amp;quot;&amp;quot;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; .Update&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; .Close&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; End With&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Set objRS = Nothing&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Form.ModalResult = mrOK&lt;br /&gt;End Sub&lt;/i&gt;&lt;/p&gt;&lt;p&gt;&lt;u&gt;&lt;b&gt;Creating Menu/Toolbars:&lt;/b&gt;&lt;/u&gt; &lt;br /&gt;&lt;/p&gt;&lt;p&gt;I also have created menu and toolbar plugins to view SLXProject data, as well as launching the insert view.&lt;/p&gt;&lt;p&gt;&lt;a href="http://customerfx.com/blogs/customization/NewMenuPlugin.JPG"&gt;&lt;img src="http://customerfx.com/blogs/customization/NewMenuPlugin.JPG" border="0" width="568" height="453" alt="" /&gt;&lt;/a&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;The menu plugin contains two menus.&amp;nbsp; The SLXProject NavMenu is referenced in the toolbar plugin below to allow for right-click functionality to insert a new record from the navbar. Both menus launch the Active script, which in turn loads the insert view.&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;a href="http://customerfx.com/blogs/customization/NewToolbarPlugin.JPG"&gt;&lt;img src="http://customerfx.com/blogs/customization/NewToolbarPlugin.JPG" border="0" width="566" height="466" alt="" /&gt;&lt;/a&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;(Note the popup menu property, referencing the SLXProject NavMenu.)&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;We&amp;#39;re not quite fully functional yet.&amp;nbsp; In the next article, I&amp;#39;ll go through finalizing the plugins we&amp;#39;ve created so far, and setting up groups and other suplimental views.&lt;/p&gt;&lt;p&gt;Thanks for reading! &amp;nbsp; &lt;br /&gt;&lt;/p&gt;&lt;img src="http://customerfx.com/aggbug.aspx?PostID=40439" width="1" height="1"&gt;</description><category domain="http://customerfx.com/pages/customization/archive/tags/Controls/default.aspx">Controls</category><category domain="http://customerfx.com/pages/customization/archive/tags/Customizations/default.aspx">Customizations</category><category domain="http://customerfx.com/pages/customization/archive/tags/SalesLogix/default.aspx">SalesLogix</category><category domain="http://customerfx.com/pages/customization/archive/tags/Development/default.aspx">Development</category><category domain="http://customerfx.com/pages/customization/archive/tags/mainview+objects/default.aspx">mainview objects</category><category domain="http://customerfx.com/pages/customization/archive/tags/How-To/default.aspx">How-To</category><category domain="http://customerfx.com/pages/customization/archive/tags/vbscript/default.aspx">vbscript</category><category domain="http://customerfx.com/pages/customization/archive/tags/ADO/default.aspx">ADO</category><category domain="http://customerfx.com/pages/customization/archive/tags/scripting/default.aspx">scripting</category></item></channel></rss>