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" } ) ) )
Discussion posts and replies are publicly visible
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
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.
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.
I have a hard time imagining what you try to achieve. Can you describe the wider use case?
after starting a process model a url is getting generated in body that we can use to open the user input form in browser, that thing is working fine but its opening in tempo, i don't want that. I want to open it in new tab as a standard interface page.
is it possible or not?
The documentation here
says
To create a URL to a site, use returnTaskPathOnly=true and append the path only to the end of the site URL in the following format: <base_url>/suite/sites/<site_name>/task/<task_path>.
Thanks it worked for me.