Skip to Content
author's profile photo Former Member
Former Member

How I know if a user define field exist?

Hi,

I need to add a user define field to the business partner table using the SDK. Before I add the field I would like to create a condition to know if the field exist.

I will appreciate any help

Thanks.

Add a comment
10|10000 characters needed characters exceeded

Related questions

2 Answers

  • Posted on Feb 21, 2005 at 04:24 AM

    Dear Rafael ...

    If you want to check whether there're any user fields you can use recordset to look for the name of field in CUFD table. Here with I enclose example to Look for Fields "ColorID" in "@MSI_COLOR" Table .

    ===============================================

    Private Function CheckUserFields() As Boolean

    oRecordset.DoQuery "select count(*) from CUFD where TableId='@MSI_COLOR' And AliasID='ColorID' "

    If oRecordset.Fields(0).Value > 0 Then

    CheckUserFields = True

    Else

    CheckUserFields = False

    End If

    End Function

    ======================================

    You can use that function ...

    If CheckUserFields = True then

    Else

    oSboApplication.messagebox "Field Colot Is Not Found in SAP B1 "

    End If

    Hopefully can helps

    Regards,

    Hamdi

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Feb 21, 2005 at 06:56 AM

    Hi,

    It can be done simpler. Make some operation with this field and catch the error event.

    For example:

    Dim res As SAPbobsCOM.Recordset

    res = diComp.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset)

    On Error GoTo AddField

    rs.DoQuery("SELECT TOP 1 U_UDF FROM MyTable")

    Exit Sub

    AddField:

    .

    .

    .

    Regards,

    Mark

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.