GetFormsByResource

Summary

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 Function

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

 GetFormsByResource("Items", "Date Field Compliance Resource")
📘

Note:

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


GetFormsByResource Results

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. In this example, we will use the GetResources to get all related forms.

  1. Navigate to the table and under Add Column > Click Invoke Custom Function

  1. Enter in "Forms" for the New column name, select the Function query GetFormsByResources, Select a Resource Type, and under Resource Name, change the value from **Text **to Column Name.

Select ResourceName.


  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. Expand the records in the Forms column into new rows by clicking the expand icon (the double-headed arrow) in the column header of the Forms column.
  1. Each resource row is now duplicated for every form it is associated with, displaying the related form properties alongside each resource.