How to generate links for quick approval?


#1

Hello,

I’m creating custom grid with a list of my requests/actions using GraphQL API.

I’d like to know how to generate link to quick actions (Yes,No,Modify) - just like in this topic:

Is it possible? It would be also nice to have additional field with boolean flag that I tells to show or not this links (like “CanCancel” field).

Regards


#2

Hi @hazey,

We do not support this as a standard feature unless you would like to do some custom development.
The easiest approach for your solution is to use a DropDownList which indicates Yes, No or Modify.

And in code behind, you can use the RowDataBound property in order to hide or display the desired columns.

Regards,
Eddy.


#3

Thanks @eddy.daouk for your reply.

I dived more deeply into that solution, and I’ve figured out that every ‘action’ button calls JavaScript function called

quickApprovalFunc

with specific parameters.
This function makes an http request to

api.asmx/CompleteWebFormActivityInstance

with speficic Form data (processInstanceId + activityInstanceId + workflowContext).

(my workflow context):

{
    "NewDataSet": {
        "parameter": [
            {
                "name": "APPROVAL_DECISION",
                "dataType": "TEXT",
                "direction": "OUT",
                "textValue": "YES"
            }
        ]
    }
}

I assume that I could use

completeAction

mutation method from GraphQL API instead of old WebService.
But what condition do I have to base on in order to enable/disable visibility of these buttons? Is this flag:

canComplete

enough?


#4

Hi @hazey,

Yes, you can use Action.canComplete to validate if the user has permissions to complete the action.

Regards,
Eddy.


#5

The field I was looking for is called hasQuickApproval.

Example request:

{
  viewer {
    requests {
      items {
        number
        actions {
          items {
            number
            canComplete
            activity {
              hasQuickApproval
            }
          }
        }
      }
    }
  }
}

Example response:

{
  "data": {
    "viewer": {
      "requests": {
        "items": [
          {
            "number": 1,
            "actions": {
              "items": [
                {
                  "number": 1,
                  "canComplete": false,
                  "activity": {
                    "hasQuickApproval": false
                  }
                },
                {
                  "number": 2,
                  "canComplete": true,
                  "activity": {
                    "hasQuickApproval": true
                  }
                }
              ]
            }
          }
        ]
      }
    }
  }
}

The proper condition to view these “Quick approval” buttons you have to combine:

canComplete == true && activity.hasQuickApproval == true

This topic can be closed.