Skip to main content
February 3, 2025
Question

How to open view form through startprocess webapi

  • February 3, 2025
  • 8 replies
  • 0 views

Hello Devs,

I have created a webAPI of template type : "StartProcess". Now this webAPI is starting the process when triggered but I want to open a form as a result of it. How can I achieve that? 

Do I have to handle it inside body ? inside httpResponse of onSuccess? how to achieve that. Here is my current code for the webAPI:

a!startProcess(
processModel: cons!PFM_APPIANFORMTOLAUNCHROUTER_PM,
processParameters: {
formToLaunchLabel_txt: http!request.queryParameters.formToLaunchLabel_txt,
formToLaunchParameters_txt: http!request.queryParameters.formToLaunchParameters_txt,
processInstanceAppianId_int: http!request.queryParameters.processInstanceAppianId_int,
},
onSuccess: a!httpResponse(
statusCode: 200,
headers: {
a!httpHeader(
name: "Content-Type",
value: "application/json"
)
},
body: a!toJson(
{
taskID:getactivetaskidsforprocess(
fv!processInfo.pp.id
)
}
)
),
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"
}
)
)
)

8 replies

stefanhelzle0001
February 3, 2025

In the context of an API, what would "Open a form" mean?

But you could use the function urlfortask() to return a link a user could click on.

docs.appian.com/.../fnc_scripting_a_urlfortask.html

February 18, 2025

this approach is working fine but its opening the interface in tempo, i dont want it to be opened in tempo I want the WebAPI to generate url that should open the interface in new tab and further process the logic that is implemented in the process model.

stefanhelzle0001
February 18, 2025

I have a hard time imagining what you try to achieve. Can you describe the wider use case?

amaans4178
February 3, 2025

To open Appian tasks or forms, the user must visit the Appian site, As stefan mentioned, you can provide a link to the task or other resources. Howeven if you've created a Web API, I assume your goal is to complete the work within the external system itself, if thats the case you can use Embeded inetrface's functionality provided by Appian.