0

Was tough to make a title that made sense.

So I am working with SalesLogix CRM and trying to navigate to a contact in said CRM. Saleslogix allows you to use almost like a url that looks like slx:CONTACT//C6UJ9A006S96

That line will direct the CRM to the contact with that ID.

My problem is when I try to navigate to that url I open a new SalesLogix instance instead of using the current one.

Saleslogix is a desktop based software just for your information.

The strange part for me is that if I use Windows' 'Run...' from the start menu and put in slx:CONTACT//C6UJ9A006S96 then it will use the already open application, same with a normal command prompt, however if I use an Admin command prompt it will open a new instance of SalesLogix. I checked the task manager and it doesn't matter if I open it using the admin command prompt or just the desktop window, it will say it is running under my current user and not system or anything weird so it seems the user isn't the problem.

My code is:

Process[] processes = Process.GetProcesses();
        foreach (Process p in processes)
        {
            if (p.ProcessName == "SalesLogix")
            {
                p.StartInfo.RedirectStandardOutput = true;
                p.StartInfo.UseShellExecute = false;

                p.StartInfo.FileName = @"C:\Program Files (x86)\SalesLogix\SalesLogix.exe";
                p.StartInfo.Arguments = "slx:CONTACT//C6UJ9A006S96";
                p.Start();
            }
        }

Any help would be appreciated and if I didn't explain my problem clearly enough I would be happy to clear up any confusion.

Resistance
  • 282
  • 6
  • 17
  • Have you tried using shell execute to run the URL directly? As in, don't execute the SalesLogix exe, just let the Windows protocol handler take care of it. As to your question about the user, actually it does make a difference. I'm unsure if this is the right terminology but running as admin runs a process under a different context, even though it appears to be running as the same user. – pcdev Jul 21 '17 at 13:12
  • If that works, you probably don't need all that code looping and setting values. Just try: `Process.Start("slx:CONTACT/C6UJ9A006S96");`. – Idle_Mind Jul 21 '17 at 14:02
  • @Idle_Mind That is exactly what I did – Resistance Jul 21 '17 at 14:07
  • @pcdev setting p.StartInfo.UseShellExecute = true; and p.StartInfo.FileName = "slx:CONTACT/C6UJ9A006S96"; did end up working! If you post your comment as an answer I will accept it – Resistance Jul 21 '17 at 14:07

2 Answers2

1

Try running the URL directly. As in, don't execute the SalesLogix exe, just pass the URI as the filename and let the Windows protocol handler take care of it.

pcdev
  • 2,852
  • 2
  • 23
  • 39
0

What i think you are doing here is taking the process that is already running, rewriting its parameters and starting it all new again. Did you try simply calling the new process with those parameters to see if it would attach to the existing system process ?

milorads
  • 51
  • 1
  • 11
  • I'm sorry, I am slightly confused by what you are saying – Resistance Jul 21 '17 at 13:14
  • Try not going through the existing processes (running ones). From what you are saying it looks like the app you are trying to run has a way of handling the new app call in the same running instance. Shortly: Process p = new Process(); p.StartInfo.RedirectStandardOutput = true; p.StartInfo.UseShellExecute = false; p.StartInfo.FileName = @"C:\Program Files \(x86)\SalesLogix\SalesLogix.exe"; p.StartInfo.Arguments = "slx:CONTACT//C6UJ9A006S96"; p.Start(); this way it will (hopefully)attach to the running process itself instead of rewriting the existing process and starting a new application – milorads Jul 21 '17 at 13:17