Home | Forums | Contact | Search | Syndication  
 
 [login] [create account]   Friday, August 29, 2025 
 
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 Scripting & Customization
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.
Forums RSS Feed


 Back to Forum List | Back to SalesLogix Scripting & Customization | New ThreadView:  Search:  
 Author  Thread: Application.Managed.Run
Andrew Grandin
Posts: 272
 
Application.Managed.RunYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 16 Sep 09 3:28 AM
Is there any way to use Application.Managed.Run to pass 2 arguments to a .Net Extension? At the moment we have it working passing one argument while the other is hard-coded in the .Net code.
[Reply][Quote]
Andrew Grandin
Posts: 272
 
Re: Application.Managed.RunYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 16 Sep 09 4:31 AM
Hi All, not the best method but we have found an alternative. We have concatenated the two variables into 1. Passed that into the .Net Extension and then split it in .Net back to their individual variables. Not pretty but it works
[Reply][Quote]
john
Posts: 34
 
Re: Application.Managed.RunYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 16 Sep 09 5:42 AM
Personally, I do not use the Run method to actually do anything apart from return an instance of the .net class to SLX, which I then access as a normal COM object.

The below is just written from my head, so may be full of typo's etc, but I hope you get the general idea... Obviously this may not useful for this solution but may be useful for future use.

In .net extension:
using System;
using System.Runtime.InteropServices;
using Sage.SalesLogix.NetExtensions;
using Sage.SalesLogix.NetExtensions.SalesLogix;
using Sage.SalesLogix.NetExtensions.Licensing;
using Sage.SalesLogix.NetExtensions.Deployment;
using System.ComponentModel;

namespace SLXNetExtensionExample
{
[ComVisible(true), ProgId("SLXNetExtensionExample.SLXWrapper")]
public class SLXWrapper : Component, IRunnable
{
ISlxApplication _slxApp;

//Saleslogix .net extension methods
public void Initialize(ISlxApplication SlxApplication, ILicenseKeyManager LicenseKeyManager)
{
_slxApp = SlxApplication;
}

public object Run(object[] Args)
{
return this;
}

public Boolean DoSomething(String PassAs, Int32 ManyParameters, String AsYouLike)
{
//This is where I would actually "do some work"
return true;
}
}

Then in SLX script:
Public Sub CallNetExtension(v_sWhatever, v_iParameters, v_sYouNeed)
Dim extension
Dim guid
guid = Application.Managed.Create("SLXNetExtensionExample", "SLXNetExtensionExample.SLXWrapper")
Set extension = Application.Managed.Run(guid, Nothing)
'Do whatever
If extension.DoSomething(v_sWhatever, v_iParameters, v_sYouNeed) Then
'You get the idea
End If
Set extension = Nothing
Call Application.Managed.Destroy(guid)
End Sub
[Reply][Quote]
Walter Shpuntoff
Posts: 167
 
Re: Application.Managed.RunYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 17 Sep 09 5:05 AM
You can also use globals from the application object.
vb

Dim oSLX as Sage.SalesLogix.NetExtensions.SalesLogix.ISlxApplication

and then

oSLX.BasicFunctions.GlobalInfoFor(GlobalName)

Much cleaner.

ws
[Reply][Quote]
Trent Haynes
Posts: 32
 
Re: Application.Managed.RunYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 17 Sep 09 8:20 AM
I pass an array as the argument.

Here is a sample:

sub Call_PostSaleControl
Dim SLXExt
SLXExt = Application.Managed.Create("MySLXExtension", "MySLXExtension.PostSaleStatus")
Dim rVal
Dim args

redim args(3)
args(0) = Application.GlobalInfo.Item("OnInvoiceTeam")

if application.BasicFunctions.CurrentOpportunityID <> "" then
args(1) = Application.BasicFunctions.CurrentViewID
args(2) = "2"
args(3) = "0"
else
args(1) = Application.BasicFunctions.CurrentViewID
args(2) = "0"
end if

rVal = Application.Managed.Run(SLXExt, args)
end sub
[Reply][Quote]
Ryan Farley
Posts: 2265
slxdeveloper.com Site Administrator
Top 10 forum poster: 2265 posts
 
Re: Application.Managed.RunYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 17 Sep 09 6:39 PM
Quote:
Originally posted by Andrew Grandin

Is there any way to use Application.Managed.Run to pass 2 arguments to a .Net Extension? At the moment we have it working passing one argument while the other is hard-coded in the .Net code.


Trent is correct, pass in the args in an array (this is how it is designed to work in the first place - when you pass in a single value it actually turns into a one-item array by the time it makes it to the .NET class). Then in the Run method override in the .NET class, the Args parameter already is an array, matching up with the array values you supplied to Application.Managed.Run in the SLX script.
[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 © 2025 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): 8/29/2025 3:07:52 PM