getFormsByResource Function

This is a helper function to get a list of forms related to a resource.

The values will be determined by the following parameters:

  • Resource Type (Required)
  • Resource Name (Required)

πŸ“˜

Note:

Both parameters are required and cannot provide a blank value (""). Resource Type will only accept the following values -

  • Items
  • Customers
  • Equipment
  • Suppliers

For more detail on the parameters see the full list of descriptions here.

function (resourceType as text, resourceName as text)

Invoking the Functions

Here is an example of invoking them using Power Query or through the visual editor.

 getFormsByResource("Customers", "000MS_C_inst")

πŸ“˜

Note:

You can fill out the function parameters and click _Invoke _to create the table automatically. See example below.

getFormsByResource Result:

The following field columns will be outputted in a table.

#table({
  "id",
  "formName",
  "row"
}, {})

πŸ‘

Tip:

You can invoke the function on a list of values see examples below.

Invoking the Function on a List of Values

You can invoke function on a list of resources as well, you can get a full list from getResourceDetails, getResourceAttributes, or getResources_Summary. In this example, we will use the getResources_Summary to get all related forms.

  1. Navigate to the table and under Add Column > Click Invoke Custom Function
  1. Enter in value for the New column, select the Function query getFormsByResource, resourceType from the TypeName column and ResourceName from the ResourceName column.
  1. Click OK and the function will get invoked for each row with the TypeName and ResourceName values inputted as parameters in the function.
  1. Now you can expand the records in the Forms column and expand them into new rows
  1. Now you can see the related Forms to the resources. Each resource will duplicate in the rows for every form that it is related to; see example below.