web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Microsoft Dynamics GP (Archived)

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

(0) ShareShare
ReportReport
Posted on by 18,335

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

I have the same question (0)
  • Manikandan Profile Picture
    2,845 on at

    Hi sandip,

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

  • David Musgrave MVP GPUG All Star Legend Moderator Profile Picture
    14,157 Most Valuable Professional on at

    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

  • sandipdjadhav Profile Picture
    18,335 on at

    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

  • sandipdjadhav Profile Picture
    18,335 on at

    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

  • David Musgrave MVP GPUG All Star Legend Moderator Profile Picture
    14,157 Most Valuable Professional on at

    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
    18,335 on at

    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 

  • sandipdjadhav Profile Picture
    18,335 on at

    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

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Women in Power Builds Momentum

Expanding mentorship, skilling, and AI innovation

Congratulations to the July Top 10 Community Leaders

These are the community rock stars!

Leaderboard > 🔒一 Microsoft Dynamics GP (Archived)

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans