Python API - j5 - 28.0 - Reference - Hexagon PPM

j5 Framework IndustraForm API Reference


As mentioned above, IndustraForm entries are always created linked to a Logbook Form entry. They are displayed to the end users as a sub-tab on the detail view of that entry.

The in-process Python API provides functions to:

  1. Add a new IndustraForm entry linked to a record (j5.IndustraForms.api.create_new_logbook_linked_form). For example, in a Record Class Mixin before_session_insert method:

    from j5.IndustraForms.api import create_new_logbook_linked_form


    def before_session_insert(self, sa_session):

    #Find the 'example-form' entry in the sf_form_register table:

    sf_form_register = Alchemy.find_recordclass('sf_form_register')

    example_form = sa_session.query(sf_form_register).filter(

    sf_form_register.form_name == 'example_project.ExampleModule.example-form').first()

    #Create a new linked instance of the example-form





    return sqlalchemy.orm.EXT_CONTINUE

  2. Query for the IndustraForm entries that are currently linked to a record (j5.IndustraForms.api.get_logbook_linked_forms). For example, in an ACTION_BUTTON assigned_action callback method:

    from j5.IndustraForms.api import get_logbook_linked_forms


    def button_clicked(self, sa_session):

    form_pdf_attachments = []

    for form in get_logbook_linked_forms(logbook_record=self):

    pdf_data = form.to_pdf()

    if pdf_data is not None:

    form_pdf_attachments.append((pdf_data, u'%s.pdf'%(form.get_label()),



    The get_logbook_linked_forms function returns a list of j5.IndustraForms.api.IndustraForm objects. These allow the the programmer to:

    • Determine if the IndustraForm entry is complete - i.e. submitted and fully approved (is_complete).

    • Convert the IndustraForm entry to a PDF (to_pdf).

    • Query for the content of form elements (get_form_data_snapshot)

  3. Delete an IndustraForm entry that is linked to a record (j5.IndustraForms.api.delete_form).

In addition, a Logbook Mixin is provided that defines an industra_form_indicator field that displays the current status of linked IndustraForm entries to the user (j5.IndustraForms.LinkedFormsLogbookMixin).