Home | Forums | Contact | Search | Syndication  
 
 [login] [create account]   Friday, November 22, 2024 
 
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!
 Architect Forums - SalesLogix .NET Extensions
Forum to discuss the use of .NET Extensions in SalesLogix version 7 and higher. View the code of conduct for posting guidelines.
Forums RSS Feed


 Back to Forum List | Back to SalesLogix .NET Extensions | New ThreadView:  Search:  
 Author  Thread: Returning an Object with existing properties via .NET Extensions to Saleslogix
Chris Fleetwood
Posts: 35
 
Returning an Object with existing properties via .NET Extensions to SaleslogixYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 23 Oct 12 3:26 PM
fiogf49gjkf0d

Hey All,


I have a custom .NET DLL called CCardProcLibCOM.dll (developed in VS 2005) that is currently being utilized within our production Saleslogix instance (version 7.5.2).  This DLL contains a class called SubmitCCTrans.  It exists as an external DLL sitting on each client PC accessing Saleslogix via the Network Client.  Currently, when changes are made to this DLL, we utilize some customized scripting that compares the date/time stamp of the DLL version on the client PC (which is located in the Saleslogix folder on the user profile/directory) against the date/time stamp of a centralized (source) version (i.e., the updated version) and, if the client version is older, overwrites that version of the DLL and any necessary dependencies (via XCOPY) from the source, then registers it using the regasm command.  This has been our mechanism for moving DLLs such as these "to production" and has worked fine


However, we recently upgraded our OS to Windows 7 (from Windows XP), and with that transition came a whole host of issues regarding admin privileges, which basically wreaked havoc with the existing scripting.  As a result, I am now looking at using the .NET Extensions functionality so that the DLLs can be released as Saleslogix bundles and be stored within the database itself, eliminating the need for the scripted installs and subsequently removing the Windows 7 issue.


Here is the issue.  I need to be able to instantiate the current DLL using the .NET Extensions in the same manner as when it was a native DLL sitting in the user profile.  This DLL has a number of properties that still need to be visible in Saleslogix.


Following the instructions found in this forum, I have added the following DLLs to my VS2005 project:



  • Sage.Saleslogix.NetExtensions.Framework.dll

  • Saleslogix.dll


I also added the following to the class in question:



  • Implements Sage.Saleslogix.NetExtensions.IRunnable  (since the DLL inherits from other classes)

  • Private _SlxApplication as Saleslogix.ISlxApplication


In addition, I added the following methods to the SubmitCCTrans class of my DLL:


    Public Sub Initialize(ByVal slxApplication As Sage.SalesLogix.NetExtensions.SalesLogix.ISlxApplication, ByVal licenseKeyManager As Sage.SalesLogix.NetExtensions.Licensing.ILicenseKeyManager) Implements Sage.SalesLogix.NetExtensions.IRunnable.Initialize


    End Sub


    Public Function Run(ByVal args() As Object) As Object Implements Sage.SalesLogix.NetExtensions.IRunnable.Run
    End Function 


The CCardProcLibCOM.dll library subsequently compiled without any issues.


 


I also added the following code in my calling subroutine in Saleslogix:



dim dNetExt
dNetext = Application.Managed.Create("CCardProcLibCOM", "CCardProcLibCOM.SubmitCCTrans")
set CCTrans = Application.Managed.Run(dNetExt, "")


The code throws an "Microsoft VBScript runtime error: Object required: 'Application.Managed.Run(...)'" error.


The dNetExt variable does contain a character string which looks like a GUID so (I believe) it sees the DLL.


The problem here is that somehow the object is not being passed back to Saleslogix.  I need for the object and its properties to be visible to Saleslogix, just as they were before when it was present as a native DLL.   It is a working DLL, so my goal is to do this without making major changes to the DLL, aside from adding the Initialize and Run methods, which appear to be required.


I imagine I have missed a few things in trying to accomplish this goal.  Any suggestions or insights on this would be greatly appreciated.


Thanks in advance,


 


Chris Fleetwood

[Reply][Quote]
Ryan Farley
Posts: 2265
slxdeveloper.com Site Administrator
Top 10 forum poster: 2265 posts
 
Re: Returning an Object with existing properties via .NET Extensions to SaleslogixYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 24 Oct 12 12:58 AM
fiogf49gjkf0d

What does the body of the Run method look like in your .NET DLL? What are you returning? Also, is the object being returned marked with the ComVisible attribute?

[Reply][Quote]
Lee Harris
Posts: 23
 
Re: Returning an Object with existing properties via .NET Extensions to SaleslogixYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 24 Oct 12 4:19 AM
fiogf49gjkf0d

Hi Chris,


First thing that jumps out at me is the "set" in the following line:


set CCTrans = Application.Managed.Run(dNetExt, "")


Try changing this to be "CCTrans = Application.Managed.Run(dNetExt, "")". I have experienced similar errors to the one you are describing and removing the "set" solved it for me.


 


It may also be worth checking the second variable in "dNetext = Application.Managed.Create("CCardProcLibCOM", "CCardProcLibCOM.SubmitCCTrans")".


If not already , then the "CCardProcLibCOM.SubmitCCTrans" as far as I know needs to be the full namespace of the Class "SubmitCCTrans".


 


Hope this helps.


 


Regards,


Lee Harris


QGate Software Limited

[Reply][Quote]
Mike Spragg
Posts: 1226
Top 10 forum poster: 1226 posts
 
Re: Returning an Object with existing properties via .NET Extensions to SaleslogixYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 24 Oct 12 4:35 AM
fiogf49gjkf0d

I was just replying the same - the Set should not be included. Dim it as a global (within the script) and then just use Application.Managed.Create to invoke the component.


e.g:


 



    CreditCheckHandler      = Application.Managed.Create("Empathe.SalesLogix.CreditCheck","empathe.SalesLogix.CreditCheck.SlxCreditCheck")



Remembering also that case sensitivity plays a part. 



namespace empathe.SalesLogix.CreditCheck

{


    #region Sample SalesLogix Code

    /***********************************************************************************************

    dim key

    dim result

    dim creditLimit


    key = Application.Managed.Create("Empathe.SalesLogix.CreditCheck","empathe.SalesLogix.CreditCheck.SlxCreditCheck")

    set result = Application.Managed.Run(key, Application.BasicFunctions.CurrentAccountID())


    if not result is nothing then

         creditLimit = result.CreditLimit

    end if


    Application.Managed.Destroy key

    */

    #endregion



    public class SlxCreditCheck : IRunnable 


[Reply][Quote]
Chris Fleetwood
Posts: 35
 
Re: Returning an Object with existing properties via .NET Extensions to SaleslogixYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 24 Oct 12 8:31 AM
fiogf49gjkf0d

Hey Ryan,


The Run Method/Function is pretty much the way it looks in my original post.  I did try adding a couple of lines to create a new instance of the CCardProcLibCOM.SubmitCCtrans class and pass it back as the argument for the Run function but that didn't seem to work as I hoped.

[Reply][Quote]
Chris Fleetwood
Posts: 35
 
Re: Returning an Object with existing properties via .NET Extensions to SaleslogixYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 24 Oct 12 8:33 AM
fiogf49gjkf0d

Hey Ryan,


 


The Run Method/Function is pretty much the way it looks in my original post.  I did try adding a couple of lines to create a new instance of the CCardProcLibCOM.SubmitCCtrans class and pass it back as the argument for the Run function but that didn't seem to work as I hoped.


Also, the DLL is marked as ComVisible=True.  It was already marked that way as it is currently being used by Saleslogix as a native DLL.

[Reply][Quote]
Chris Fleetwood
Posts: 35
 
Re: Returning an Object with existing properties via .NET Extensions to SaleslogixYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 24 Oct 12 8:36 AM
fiogf49gjkf0d

Hey Lee,


My thinking was that I had to use the Set command since I am attempting to pass back an object.  I did try both ways (with and without the Set keyword) and the outcome was unsuccessful in either case.


 


CCardProcLibCOM.SubmitCCTrans is the fully qualified namespace name as it is already being used by Saleslogix as a native DLL and no major changes have been made to it (aside from the additional code for the .NET Extensions).

[Reply][Quote]
Chris Fleetwood
Posts: 35
 
Re: Returning an Object with existing properties via .NET Extensions to SaleslogixYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 24 Oct 12 8:38 AM
fiogf49gjkf0d

Mike,


Thanks for the suggestions.  I'll give them a try and let you know the outcome.


 


Regards,


 


Chris

[Reply][Quote]
Chris Fleetwood
Posts: 35
 
Re: Returning an Object with existing properties via .NET Extensions to SaleslogixYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 24 Oct 12 8:45 AM
fiogf49gjkf0d

Mike,


I'm confused.  You actually used the Set command just as I did for the Run command:


------------------------------------------------------------------------------------------------------------


set result = Application.Managed.Run(key, Application.BasicFunctions.CurrentAccountID())


------------------------------------------------------------------------------------------------------------


 


Don't you need the Set command in order to return an object?


 


Chris
 

[Reply][Quote]
Mike Spragg
Posts: 1226
Top 10 forum poster: 1226 posts
 
Re: Returning an Object with existing properties via .NET Extensions to SaleslogixYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 24 Oct 12 9:01 AM
fiogf49gjkf0d

Sorry, you're right - was looking at something different !

[Reply][Quote]
Chris Fleetwood
Posts: 35
 
Re: Returning an Object with existing properties via .NET Extensions to SaleslogixYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 24 Oct 12 12:38 PM
fiogf49gjkf0d

Hey Ryan,


Originally, I didn't think the Run function needed anything in it, as if it was a method that needed to be present (like Sub Main) but didn't actually have to do anything.  So on my initial try, I didn't have any code in it.  Then I thought that maybe I could create an instance of the class and pass it back to Saleslogix as an object.  Basically, I tried something on the order of this:


-------------------------------------------------------------------------------------------------------------------------------------------------------


    Public Function Run(ByVal args() As Object) As Object Implements Sage.SalesLogix.NetExtensions.IRunnable.Run


       dim cls as CCardProcLibCOM.SubmitCCTrans = New CCardProcLibCOM.SubmitCCTrans


       return cls


    End Function 


-------------------------------------------------------------------------------------------------------------------------------------------------------


The DLL compiled OK, but the Application.Managed.Run command still returned nothing when I added the new DLL version to Saleslogix and tested it.


 


Chris


asdf

[Reply][Quote]
Ryan Farley
Posts: 2265
slxdeveloper.com Site Administrator
Top 10 forum poster: 2265 posts
 
Re: Returning an Object with existing properties via .NET Extensions to SaleslogixYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 24 Oct 12 1:00 PM
fiogf49gjkf0d

You need to return something from the Run method. You say you're attempting to return an object to use in SLX, so you need to return it. If you're returning an object to the calling script, then you do need to use Set.

[Reply][Quote]
Chris Fleetwood
Posts: 35
 
Re: Returning an Object with existing properties via .NET Extensions to SaleslogixYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 24 Oct 12 2:03 PM
fiogf49gjkf0d

Quote:
Originally posted by Ryan Farley


You need to return something from the Run method. You say you're attempting to return an object to use in SLX, so you need to return it. If you're returning an object to the calling script, then you do need to use Set.



Ryan,


In that case, shouldn't the following (at least in theory) work?  I have tried this (with the Set command for the Application.Managed.Run statement as I mentioned earlier) with no success.


I'm sure I'm missing something, but at this point I'm not sure what that "something" is.


 


Chris


-------------------------------------------------------------------------------------------------------------------------------------------------------


    Public Function Run(ByVal args() As Object) As Object Implements Sage.SalesLogix.NetExtensions.IRunnable.Run


       dim cls as CCardProcLibCOM.SubmitCCTrans = New CCardProcLibCOM.SubmitCCTrans


       return cls


    End Function 


-------------------------------------------------------------------------------------------------------------------------------------------------------


 

[Reply][Quote]
Mike Spragg
Posts: 1226
Top 10 forum poster: 1226 posts
 
Re: Returning an Object with existing properties via .NET Extensions to SaleslogixYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 24 Oct 12 2:45 PM
fiogf49gjkf0d

Dumb Question - Did you add your component to Architect & Release it ? 

[Reply][Quote]
Chris Fleetwood
Posts: 35
 
Re: Returning an Object with existing properties via .NET Extensions to SaleslogixYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 24 Oct 12 3:06 PM
fiogf49gjkf0d

Sure did.  I'm getting the "GUID" - like value returned from the Application.Managed.Create statement so I think it's released properly.  Unless I'm missing something there as well?

[Reply][Quote]
Mike Spragg
Posts: 1226
Top 10 forum poster: 1226 posts
 
Re: Returning an Object with existing properties via .NET Extensions to SaleslogixYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 24 Oct 12 3:08 PM
fiogf49gjkf0d

You added it [component] as a dll, then released you would release it to the team/everyone - is normally how you'd do it. The guid, as you say, is normally a sign it's working (but not guaranteed)

[Reply][Quote]
Chris Fleetwood
Posts: 35
 
Re: Returning an Object with existing properties via .NET Extensions to SaleslogixYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 29 Oct 12 9:16 AM
fiogf49gjkf0d

Quote:
Originally posted by Mike Spragg


You added it [component] as a dll, then released you would release it to the team/everyone - is normally how you'd do it. The guid, as you say, is normally a sign it's working (but not guaranteed)



I did release it to Everyone.  I also un-released and then re-released it again (To Everyone, not Everyone - View Only)and tried another test; incidentally, ComVisible shows as true for the DLL under the View (Release) function. 


The result is the same:  A guid is returned from the Application.Managed.Create() call, but the same "Microsoft VBScript runtime error: Object required: 'Application.Managed.Run(...)'" error is returned from the Application.Managed.Run() call.


I believe I'm at an impasse now.  Ideas, anyone?

[Reply][Quote]
Chris Fleetwood
Posts: 35
 
Re: Returning an Object with existing properties via .NET Extensions to SaleslogixYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 29 Oct 12 9:33 AM
fiogf49gjkf0d

I probably should have been clearer about what I am trying to accomplish.


The .NET DLL that I am working with comprises a class that has a significant number of existing properties and is already used in Saleslogix as an external component.  The only "net" change (excuse the very weak pun) I want to make here is to be able to install changes via a Saleslogix bundle instead of using an external script to perform the install.  Aside from that, I want the CCardProcLibCOM.SubmitCCTrans class defined in the DLL to be able to be instantiated by Saleslogix as it is now, with minimal changes to the DLL itself and to the calling routine in Saleslogix.  In other words, to do what the CreateObject routine does currently.


Since the properties are defined on the class in the DLL, shouldn't the .NET extension functionality, if correctly implemented, allow Saleslogix to see those properties?  My thinking was that the Application.Managed.Run command could pass back an instance of the class defined in the DLL.


Perhaps my thinking is off here.

[Reply][Quote]
Chris Fleetwood
Posts: 35
 
Re: Returning an Object with existing properties via .NET Extensions to SaleslogixYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 30 Oct 12 3:17 PM
fiogf49gjkf0d

Ideas, anyone?


I'm beginning to think my original configuration (the external DLL) is a better approach, since it already works.  The real obstacle is re-engineering the install script to deal with Windows 7.

[Reply][Quote]
 Page 1 of 1 
  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!
 

 
 slxdeveloper.com is brought to you courtesy of Ryan Farley & Customer FX Corporation.
 This site, and all contents herein, are Copyright © 2024 Customer FX Corporation. The information and opinions expressed here are not endorsed by Sage Software.

code of conduct | Subscribe to the slxdeveloper.com Latest Article RSS feed
   
 
page cache (param): 11/22/2024 10:23:03 AM