Function: update_form - j5 - 28.0 - Reference - Hexagon

j5 Framework IndustraForm API Reference

Language
English
Product
j5
Search by Category
Reference
j5 Version
2019

update_form(sa_session, j5_session, actions)

Updates the IndustraForm based on the actions provided.

If the update is successful then a new form commit has been created. In this case, a new instance of FormDataSnapshot is returned containing the changes. If the IndustraForm has any linked fields, the source record is updated asynchronously.

This method should not be used with FormDataSnapshots that are passed into IndustraForm Action Button methods.

Sample usage:

def should_update_form(snapshot):

return snapshot.query(['Status'])[0] != 'Closed'

action = UpdateElementValues({ 'Status': 'Closed' })

while should_update_form(snapshot):

try:

snapshot = snapshot.update_form(sa_session, j5_session, action)

break

except ConcurrentModificationException:

snapshot = get_form(form_uuid, sa_session).get_form_data_snapshot()

Parameters

  • sa_session - The alchemy session

  • j5_session - A user or system session. The new commit will be associated with this username.

  • actions - A single instance or list of j5.IndustraForms.IndustraFormActions.IndustraFormAction.

Returns

  • FormDataSnapshot

Raises

  • ConcurrentModificationException - Occurs if the form data has changed since this instance of the FormDataSnapshot was created. This is expected to occur under normal circumstances and so the calling code must handle this exception appropriately (for example, by retrying after first checking that the operation is valid).

  • WebUIError - Occurs if the current user has insufficient rights to alter the form or the form is deleted. Note that the rights check does not include workflow enforcement e.g. making changes to disabled sections.

  • ValueError - Occurs if one of the provided actions was instantiated with invalid data.

It is not required to roll back the transaction when an exception occurs.