Skip to main content

Notifications

Microsoft Dynamics GP (Archived)

Open Dynamics GP Screen from C#. Code is not working on GP2015, it was working on GP 2010

Posted on by 18,265

Below code is working on GP2010 but not in GP2015. Don't know whats wrong. 

string dexErrorMsg, dexCmd;
int dexErrorCode;
Dynamics.Application objGPApp = new Dynamics.Application();

dexcmd = "";
dexcmd += "open form RM_Customer_Maintenance;";

objGPApp.CurrentProductID = 0;
objGPApp.CurrentProduct = objGPApp.CurrentProduct + "";
dexErrorCode = objGPApp.ExecuteSanscript(dexCmd, out dexErrorMsg);

if (dexErrorCode != 0)
{
MessageBox.Show(dexErrorMsg);
}

Original Post: https://community.dynamics.com/gp/f/32/t/39562

Mariano any help on this again?

Thanks Much

Sandip Jadhav

*This post is locked for comments

  • sandipdjadhav Profile Picture
    sandipdjadhav 18,265 on at
    RE: Open Dynamics GP Screen from C#. Code is not working on GP2015, it was working on GP 2010

    David,

    I have gone through Continuum documentation and created below VB.Net Code and it works fine. C# code is still not working.

    This code to open Manufacturing Component Transaction screen. I need to schedule it every 10 second to open this screen. in AddIn folder Posting button push event is called which post transactions.

    But it open one time and second time I get following error

    backgroundProcess.PNG

    And

    If I re ran my .Net Application it get following error-

    backgroundProcess.PNG

    How can I avoid it? I think I need to close screen once posting is done. Can you please guide on same.

    Below is code for your reference.-

       Private Sub OpenGPMFGComponentScreen()

           Try

               Dim Err_Num As Integer

               Dim ErrorMsg As String

               GPApp.CurrentProductID = 346

               Err_Num = GPApp.ExecuteSanscript( _

               "open form MOP_Component_Trx_Entry;", ErrorMsg)

               If Err_Num <> 0 Then

                   'A compiler error occurred. Display the error.

                   MsgBox(ErrorMsg)

               End If

           Catch ex As Exception

               MessageBox.Show(ex.ToString())

           Finally

           End Try

       End Sub

  • sandipdjadhav Profile Picture
    sandipdjadhav 18,265 on at
    RE: Open Dynamics GP Screen from C#. Code is not working on GP2015, it was working on GP 2010

    David, 

    Much appreciate for your prompt reply. How can I check if Dexterity session is running?

    Your earliest reply is highly appreciable.


    Thanks much
    Sandip 

  • David Musgrave MVP GPUG All Star Legend Moderator Profile Picture
    David Musgrave MVP ... 13,909 Most Valuable Professional on at
    RE: Open Dynamics GP Screen from C#. Code is not working on GP2015, it was working on GP 2010

    Do you have a Dexterity session open, or any other Dexterity based application including stand alone applications?

    Because this would get a connection and would not have the RM_Customer_Maintenance form and so give you that error.

    For your code to work, there must be ONLY one Dexterity/Dynamics application loaded.

    David

  • sandipdjadhav Profile Picture
    sandipdjadhav 18,265 on at
    RE: Open Dynamics GP Screen from C#. Code is not working on GP2015, it was working on GP 2010

    Hi David/Manikandan,

    I have reinstall Dynamics GP and  my code stopped working. I am getting error "Unknown Identifier 'RM_Customer_Maintenance'."

    I have checked only one instance of Dynamics GP is running.

    I don't know whats wrong how can I troubleshoot this error? Is code is not stable?

    Any help on this will be highly appreciable.

    Thanks much

    Sandip

  • sandipdjadhav Profile Picture
    sandipdjadhav 18,265 on at
    RE: Open Dynamics GP Screen from C#. Code is not working on GP2015, it was working on GP 2010

    Hello,

    Sorry for delay in reply.  There were threeGP Instance was running that was reason getting all kind of errors. After removing extra instance my code was working.

    Thanks much everybody for your help.

    Tks

    Sandip

  • David Musgrave MVP GPUG All Star Legend Moderator Profile Picture
    David Musgrave MVP ... 13,909 Most Valuable Professional on at
    RE: Open Dynamics GP Screen from C#. Code is not working on GP2015, it was working on GP 2010

    Do you have more than one Dynamics/Dexterity/DPS application running?

    When using the Dynamics.Application() object it will connect to the first instance only.

    Make sure you only have one instance running.

    David

  • Manikandan Profile Picture
    Manikandan 2,845 on at
    RE: Open Dynamics GP Screen from C#. Code is not working on GP2015, it was working on GP 2010

    Hi sandip,

    What is the error message you are getting? What is the triggering point of this script?

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

November Spotlight Star - Khushbu Rajvi

Congratulations to a top community star!

Forum Structure Changes Complete!

🔔 Be sure to subscribe to the new forums you are interested in to stay up to date! 🔔

Dynamics 365 Community Platform update – Oct 28

Welcome to the next edition of the Community Platform Update. This is a status …

Leaderboard

#1
André Arnaud de Calavon Profile Picture

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

#2
Martin Dráb Profile Picture

Martin Dráb 229,918 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans