I have a webAPI that creates record in Appian DB, I want to show custom error message for each field using an expression rule,where i can call this expression rule in API

HI Appian team,

I need help from you to show custom error message in a web api, i have asked the same question 4 months ago, in that i got a suggestion that to create an expression rule and validate the api using that ,but where i can use expression rule in an API, Please find the code attached to understand webapi code and expression rule i created. How can i call the expression rule within webapi to validate API for errors,Is anyone have done similar requirement ,if yes please post code snippet for us.

thanks

a!startProcess(
  processModel: cons!PF_Create_Request_WithChanges,
  processParameters: 
  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"
        }
      )
    )
)
if(
  rule!GLB_isBlank(
    ri!PF_Request.GBEID
  ),

a!toJson(
  {
    field: ri!PF_Request.GBEID,
    error: "Error in GBEID field"
  }
),
true()
)

Please find the above code for web api and expression rule please guide us.

please find the url below for my previous post.

https://community.appian.com/discussions/f/process/22021/how-to-show-the-specific-custom-error-message-for-an-appian-web-api-which-is-used-for-creating-records-in-appian

Thanks  & Regards

Sunu Sam

  Discussion posts and replies are publicly visible

Parents Reply Children
No Data