Skip to main content

Notifications

Microsoft Dynamics GP (Archived)

Pass-thru sanscript via Continuum fails on simple test

Posted on by 1,582

I am trying to use Continuum for the first time but even the simplest test fails resulting in the message :

Unknown Identifier 'PM_Transaction_Entry'

What am I not seeing?

class Program
{
    static void Main(string[] args)
    {
        Dynamics.Application gpApp = (Dynamics.Application)Activator.CreateInstance(Type.GetTypeFromProgID("Dynamics.Application"));
        string errMessage = "";
        string codeString = "";

        codeString = "open form PM_Transaction_Entry; " + Environment.NewLine;

        int compilerError = gpApp.ExecuteSanscript(codeString, out errMessage);

        if (compilerError != 0)
            Console.WriteLine(errMessage);

        Console.WriteLine("END OF LINE");
        Console.ReadLine();
    }
}

*This post is locked for comments

  • chadbruels Profile Picture
    chadbruels 1,582 on at
    RE: Pass-thru sanscript via Continuum fails on simple test

    I'm sorry, Andrew. I abandoned this after my last message on the post. I never did look into the additional suggestions after that - namely whether I had Dexterity open or if there were copies of Dynamics.exe running in task manager that were ghosts.

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Pass-thru sanscript via Continuum fails on simple test

    I'm having the exact same problem. I cannot get it to work opening anything, it just throws an error saying "resource is not available". Did you get a proper resolution for this? I'm trying to use this as a way to pop a gp form from a browser window, i can register a protocol but it fails opening the window.

  • Suggested answer
    Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Pass-thru sanscript via Continuum fails on simple test

    Are you by chance running Dexterity during the cases when it doesn't work?  While the executable is "Dex.exe" it seems to be capture as a Dynamics.Application COM object.  If this is the case Continuum is trying to send the request there, and it of course doesn't have the PM_Transaction_Entry form.

  • JamesLyn Profile Picture
    JamesLyn 360 on at
    RE: Pass-thru sanscript via Continuum fails on simple test

    Sorry to hear about your troubles, I have been developing many applications using the SDK and haven't experienced this kind of problem.

    Did you get a chance to check if there are any orphaned Dynamics.exe still running after you closed GP? If VS can't find a Dynamics.exe to latch onto, that first line of code will create a new instance which will not be logged into any company since you did not pass it any credentials. Simply closing GP will not end these instances hence manually ending them from Task Manager.

    The other option is instead of running your app as a stand-alone application, build it as a class library and drop it into your gp Add-in folder. This should run your code in the same GP instance that you have logged in to.

  • Verified answer
    chadbruels Profile Picture
    chadbruels 1,582 on at
    RE: Pass-thru sanscript via Continuum fails on simple test

    I had to restart my machine and then it was working. I began adding more code for testing additional actions and it continued working...until it did not. Suddenly I was receiving the same error again. I closed both GP and Visual Studio and experimented with opening them in different orders but nothing worked. Only restarting the OS worked again.

    Conclusion : this API is unreliable for use in an enterprise setting. Should I be surprised?

  • Suggested answer
    Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Pass-thru sanscript via Continuum fails on simple test

    Chad, Are you using alternative form or modified form?  Try to specify the current product id like gpApp.CurrentProductId = X or gpApp.ProductId = X(X can be zero or other product id) before the open form command.  Hope this helps.

  • JamesLyn Profile Picture
    JamesLyn 360 on at
    RE: Pass-thru sanscript via Continuum fails on simple test

    Try closing out of GP, open Task Manager and end task any Dynamics.exe. Re-log into GP and try again. Maybe there are some unlogged Dynamics instances that you created running your app without being logged in.

  • JamesLyn Profile Picture
    JamesLyn 360 on at
    RE: Pass-thru sanscript via Continuum fails on simple test

    Your first line : Dynamics.Application gpApp = (Dynamics.Application)Activator.CreateInstance(Type.GetTypeFromProgID("Dynamics.Application"));

    That latches onto any open Dynamics.exe, so GP is required to be open and logged into the company you want.

  • chadbruels Profile Picture
    chadbruels 1,582 on at
    RE: Pass-thru sanscript via Continuum fails on simple test

    I am not using a modified form - I have also tried RM_Customer_Maintenance with the same result. I do have GP open and logged in - is that required by the way? Later in my testing I was wondering if running any pass thru scripts worked without GP open.

  • JamesLyn Profile Picture
    JamesLyn 360 on at
    RE: Pass-thru sanscript via Continuum fails on simple test

    Do you have GP instance open and logged in? I can get that error if I log/close out of GP. Assuming you have GP open, maybe your code is not latching onto the GP instance?

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Community AMA December 12th

Join us as we continue to demystify the Dynamics 365 Contact Center

New! Quick response templatesâš¡

Save time with the new custom templates!

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,188 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,030 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans