How can i pass multiple process parameter to the process model from the webapi

HI Appian,

I have to pass multiple cdt values as process parameter from a webapi how can i do that?

Please someone  help me for this. I have attached the sample code for your reference.PF_Request and PF_REQUESTITEMDETAIL is the table which i am passing as parameter from webapi to  process model as Process variables.

a!startProcess(
  processModel: cons!PF_Create_Request_WithChanges,
  processParameters: {
    PF_Request : a!fromJson(
      http!request.body
    ),
    PF_REQUESTITEMDETAIL:a!fromJson(
      http!request.body
    )
  },
  onSuccess: a!httpResponse(
    statusCode: 200,
    headers: {
      a!httpHeader(name: "Content-Type", value: "application/json")
    },
    body: a!toJson(
      fv!processInfo
    )
  ),
  onError: a!httpResponse(
    statusCode: 500,
    headers: {
      a!httpHeader(name: "Content-Type", value: "application/json")
    },
    body: a!toJson(
      {
        error: "There was an error starting the process"
      }
    )
  )
)

Thanks

Sunu Sam

  Discussion posts and replies are publicly visible

Parents
  • Web API expressions are just like other expressions in Appian in that they can utilize local variables! For example:

    a!localVariables(
        local!body: http!request.body,
        local!pfRequest: local!body.pfRequest,
        local!detail: local!body.requestDetail,
        a!startProcess(
          processModel: cons!PF_Create_Request_WithChanges,
          processParameters: {
            PF_Request : local!pfRequest,
            PF_REQUESTITEMDETAIL: local!detail
          },
          onSuccess: a!httpResponse(
            statusCode: 200,
            headers: {
              a!httpHeader(name: "Content-Type", value: "application/json")
            },
            body: a!toJson(
              fv!processInfo
            )
          ),
          onError: a!httpResponse(
            statusCode: 500,
            headers: {
              a!httpHeader(name: "Content-Type", value: "application/json")
            },
            body: a!toJson(
              {
                error: "There was an error starting the process"
              }
            )
          )
        )
    )
    

Reply
  • Web API expressions are just like other expressions in Appian in that they can utilize local variables! For example:

    a!localVariables(
        local!body: http!request.body,
        local!pfRequest: local!body.pfRequest,
        local!detail: local!body.requestDetail,
        a!startProcess(
          processModel: cons!PF_Create_Request_WithChanges,
          processParameters: {
            PF_Request : local!pfRequest,
            PF_REQUESTITEMDETAIL: local!detail
          },
          onSuccess: a!httpResponse(
            statusCode: 200,
            headers: {
              a!httpHeader(name: "Content-Type", value: "application/json")
            },
            body: a!toJson(
              fv!processInfo
            )
          ),
          onError: a!httpResponse(
            statusCode: 500,
            headers: {
              a!httpHeader(name: "Content-Type", value: "application/json")
            },
            body: a!toJson(
              {
                error: "There was an error starting the process"
              }
            )
          )
        )
    )
    

Children