cancel
Showing results for 
Search instead for 
Did you mean: 

Add-On status Failed

Former Member
0 Kudos

Hi, all,

I have a add-on to add menu items, it is startup automatically.

The menu items was added and works fine.

However, when I go to Add-On Manager, I found that the Add-On Status is "Failed".

Any ideas?

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

Are you using the ard file to register the addon? Does the MD5 signature tag in the ard file match your addon executable?

Is there any abnormal error message in B1 status bar?

Also please recheck the code in your addon, and make sure you are using the correct connection string which was given thru the argument of your addon when you are calling CSboGuiApi::Connect(string connStr), is there any exception thrown out?

Regards,

Jay.

Former Member
0 Kudos

thanks for your reply.

I use ard file to register and the signature is match.

There is no any error message in status bar.

If I start it manually, there is a "Add-On Timeout' prompt out.

But the program still started and working fine.

Just only the status is 'Failed'.

Nussi
Active Contributor
0 Kudos

Hi,

most people in this forum had this problem when they had a mistake in their

SetApplicatoin or

SetConnectionConntext

procedures.

correct it looks like this (c#)


    private void SetApplication() { 
        
        // *******************************************************************
        //  Use an SboGuiApi object to establish connection
        //  with the SAP Business One application and return an
        //  initialized appliction object
        // *******************************************************************
        
        SAPbouiCOM.SboGuiApi SboGuiApi = null; 
        string sConnectionString = null; 
        
        SboGuiApi = new SAPbouiCOM.SboGuiApi(); 
        
        //  by following the steps specified above, the following
        //  statment should be suficient for either development or run mode
        try
        {
            sConnectionString = System.Convert.ToString(Environment.GetCommandLineArgs().GetValue(1));
        }
        catch
        {
            System.Windows.Forms.MessageBox.Show("AddOn must start in SAP Business One");

            System.Environment.Exit(0);
        }

        //  connect to a running SBO Application        
        try
        {
            // If there's no active application the connection will fail
            SboGuiApi.Connect(sConnectionString);
        }
        catch
        { //  Connection failed
            System.Windows.Forms.MessageBox.Show("No SAP Business One Application was found");

            System.Environment.Exit(0);
        } 
        
        //  get an initialized application object

        globals.SBO_Application = SboGuiApi.GetApplication(-1); 
        
    }

    private int SetConnectionContext() 
    {
        int setConnectionContextReturn = 0;

        string sCookie = null;
        string sConnectionContext = null;

        // // First initialize the Company object
        globals.oCompany = new SAPbobsCOM.Company();

        // // Acquire the connection context cookie from the DI API.
        sCookie = globals.oCompany.GetContextCookie();

        // // Retrieve the connection context string from the UI API using the
        // // acquired cookie.
        sConnectionContext = globals.SBO_Application.Company.GetConnectionContext(sCookie);

        // // before setting the SBO Login Context make sure the company is not
        // // connected

        if (globals.oCompany.Connected == true)
        {
            globals.oCompany.Disconnect();
        }

        // // Set the connection context information to the DI API.
        setConnectionContextReturn = globals.oCompany.SetSboLoginContext(sConnectionContext);

        return setConnectionContextReturn;
    }

lg David

Former Member
0 Kudos

Hi, David,

thanks for your code.

I am using VB.NET,

here is my code, seems no different.

Private Sub SetApplication()

Dim SboGuiApi As SAPbouiCOM.SboGuiApi

Dim sConnectionString As String

SboGuiApi = New SAPbouiCOM.SboGuiApi

sConnectionString = "0030002C0030002C00530041005000420044005F00440061007400650076002C0050004C006F006D0056004900490056"

Try

SboGuiApi.Connect(sConnectionString)

Catch

System.Windows.Forms.MessageBox.Show("No SAP Business One Loaded")

End

End Try

SBO_Application = SboGuiApi.GetApplication()

End Sub

Private Function ConnectDIfromUI() As Boolean

Dim cookie As String

Dim constr As String

Dim retval As Integer

If (IsNothing(SBO_Company)) Then

SBO_Company = New SAPbobsCOM.CompanyClass

End If

cookie = SBO_Company.GetContextCookie

constr = SBO_Application.Company.GetConnectionContext(cookie)

If SBO_Company.Connected Then

SBO_Company.Disconnect()

End If

retval = SBO_Company.SetSboLoginContext(constr)

If (retval <> 0) Then

Trace.WriteLine("Connection Fail !!")

Else

retval = SBO_Company.Connect

End If

Return SBO_Company.Connected

End Function

Thanks

Nussi
Active Contributor
0 Kudos

Hi,

there's one important difference.

sConnectionString = System.Convert.ToString(Environment.GetCommandLineArgs().GetValue(1));

running the addon in business one the connectionstring is passed by SAP - its not the developer string

you use while developing !

lg David

Former Member
0 Kudos

the status is now 'Connected'.

thank you very much.

Answers (1)

Answers (1)

Former Member
0 Kudos

Hello,

Try to debug your addon in the code. Maybe this clears your problem.

HTH

Regards,

Teun