Getting more fields in ProcForms

The ProcForms API endpoint returns a list of forms for a given process. The fields returned for each form are based on the View ID provided. If the ViewID is not provided, the user’s default view is used.

Views in RPM

Views in RPM are used to show a list of forms in a process. The user has the freedom to select the visible fields and the order they’re in.

actions-view1

Clicking the “Edit view” button shows all the configurations possible in views, including the fields to show (highlighted in red):

actions-view2

Getting the View ID

RPM provides a section where it lists all the available views and the necessary IDs in ProcForms. To get to it go to the “Setup” section, click on the API button on the sidebar.

actions-view3

In the API page, there’s a “List of view IDs” link on the sidebar:

actions-view4

This page contains a list of all available views on a process. The user can select the process in the picker on the top left. Each row shown is one of the available views:

actions-view5

Using this information

With this information, the ProcForms endpoint can be called to provide the necessary data:

POST http://localhost/rpm/Api2.svc/ProcForms HTTP/1.1
RpmApiKey: 59a9a351-612d-4233-b610-134a7bca88b6

{
    "ProcessID": 1,
    "ViewID": 905
}

The response of this request looks something like this:

{
    "Result": {
        "Process": "Work Permits",
        "ProcessID": 1,
        "View": "Work information",
        "Columns": [
            "Number",
            "Start Date",
            "Short Description",
            "Complete Description"
        ],
        "Forms": [
            {
                "FormID": 3,
                "Values": [
                    "0003",
                    "3/4/2015 12:00:00 AM",
                    "Pipeline inspection in section C",
                    "Small leaks have been reported recently in section C pipelines, the works shall do a visual inspection to find any other leaks or rusted junctions and sections where new leaks could happen.\r\n\r\nAlso should look for any possible sources for these leaks (other than rusting)."
                ]
            },
            {
                "FormID": 2,
                "Values": [
                    "0002",
                    "3/6/2015 12:00:00 AM",
                    "Weekly Workshop Cleanup",
                    "Follow workshop cleanup checklist"
                ]
            },
            {
                "FormID": 1,
                "Values": [
                    "0001",
                    "3/19/2015 12:00:00 AM",
                    "Pump replacement at location ZZRP-1024",
                    "Replace the sump pump for the downstream reservoir"
                ]
            }
        ]
    }
}

Sending the same request without providing the ViewID will generate different results:

POST http://localhost/rpm/Api2.svc/ProcForms HTTP/1.1
host: localhost
RpmApiKey: 59a9a351-612d-4233-b610-134a7bca88b6

{
    "ProcessID": 1
}

In this case, the results contain the fields included in the user’s default view:

{
    "Result": {
        "Process": "Work Permits",
        "ProcessID": 1,
        "View": "All",
        "Columns": [
            "Number",
            "Owner",
            "Action due for me",
            "Started",
            "Started by",
            "Modified",
            "Modified by",
            "Files"
        ],
        "Forms": [
            {
                "FormID": 3,
                "Values": [
                    "0003",
                    "RPM Support",
                    "False",
                    "3/2/2015 2:47:41 PM",
                    "RPM Support",
                    "3/2/2015 2:47:41 PM",
                    "RPM Support",
                    ""
                ]
            },
            {
                "FormID": 2,
                "Values": [
                    "0002",
                    "RPM Support",
                    "False",
                    "3/2/2015 2:44:47 PM",
                    "RPM Support",
                    "3/2/2015 2:44:47 PM",
                    "RPM Support",
                    ""
                ]
            },
            {
                "FormID": 1,
                "Values": [
                    "0001",
                    "RPM Support",
                    "False",
                    "3/2/2015 2:43:46 PM",
                    "RPM Support",
                    "3/2/2015 2:43:46 PM",
                    "RPM Support",
                    ""
                ]
            }
        ]
    }
}
Posted in API Usage Examples
%d bloggers like this: