1 Reply Latest reply on Jan 24, 2020 8:15 PM by Carl Wilson

    ARServerUser.createEntry does not return an id for Form 'BMC.CORE:BMC_Application'

    Stephan Gasterstaedt
      Share This:

      Hello BMC-Community ,

       

      today I faced a new issue that I do not really understand. I already created a lot of entries on different forms (such as Tasks, Incidents, Change, Worklogs, etc...) with the arsys library.

      Now I want to do the same for BMC_Applications. I know that this is a joint form composed from BMC.CORE:BMC_Application and AST:Attributes. So first step is to create the BMC.CORE:BMC_Application entry. But here is the problem:

       

      When I call my __create() function it ususally returns at the end the entry id of the created entry.

       

        protected String __create() throws RemedyAdapterException {

         try {

         Entry entry = new Entry();

       

         this.getValues().each{k, v ->

         if(v != null) {

        entry.put(this.getFieldId(k), v);

        }

        }

         println "entry: " + entry;

         String entryIdOut = this.mARServerUser.createEntry(this.mFormName, entry);

       

         return entryIdOut;

        } catch(Exception e) {

         throw new RemedyAdapterException("Error during create. " + e.getMessage());

        }

         return null;

        }

       

      But not this thime with the BMC.CORE:BMC_Application form. I am just getting back an empty string that is absolutely useless for me. I need the the id of the created instance so I can reference the created object and get out the created reconciliation id for referencing the AST:Attrubutes form.

       

      Can you please explain me why the entry id is missed and what I can do to obtain my created object. Is this a bug (because normally the id is returned)?

       

      PS: When I double check if the entry is created inside the database I am able to find the new entry.

      Greetings Stephan vom

      Vipcon GmbH (Member of fusion gbs)

        • 1. Re: ARServerUser.createEntry does not return an id for Form 'BMC.CORE:BMC_Application'
          Carl Wilson

          Hi Stephan,

          The CMDB/Asset forms are not the same as the ITSM application forms such as the "HPD:Help Desk" form, which are standard "regular" forms.

           

          The CMDB "regular" forms (as seen in the CDM) are  actually "join" forms consisting of a regular form joined with an underlying  regular "base" CMDB form e.g. BMC.CORE:BMC_BaseElement [the "base" CMDB form, where every CI will have an entry] with another regular form e.g. BMC.CORE:BMC_Application_ [note the underscore in the form  name, which is the underlying "regular" form for the associated class] to create the form "BMC.CORE:BMC_Application" - which in the end is the CMDB class "join" form you see in the consoles.

           

          The associated Asset form is then a self join (Cartesian) of the CMDB form, along with the AST:Attributes form, which creates the AST:xxxx forms.

           

          So, when creating entries you need to identify the "regular" forms involved in the process to create the entries to receive an associated Entry ID when using the API. 

          For the CMDB, the class regular forms have the "_"  appended to the form name.

           

          If you target the join form (without the underscore), you will not receive an ID although the entry maybe created.

          This is a byproduct of the way the API works as it cannot handle the "join" IDs (IDs from the 2 regular forms concatenated together).

           

          If you use the join form e.g. "BMC.CORE:BMC_Application" to create the entry, you would need to query back this form to obtain any information on the created entry e.g. using the Asset name or some other criteria.

           

          If you create the entry in the underlying "regular" form e.g. "BMC.CORE:BMC_Application_" then you would receive an associated ID back.

           

          Hope this helps.

           

          Cheers.

           

          Carl

          1 of 1 people found this helpful