cancel
Showing results for 
Search instead for 
Did you mean: 

SAP CPQ 2.0: How to use ApiResponse = ApiResponseFactory.RedirectResponse(url) correct?

Alexander_0001
Participant
0 Kudos
688

Dear SAP Community,
I try to define a simple redirect in a SAP CPQ IronPython Script with ApiResponseFactory.RedirectResponse the following way to assign it to a button afterwards.

url = "https://www.example.com/"<br>ApiResponse = ApiResponseFactory.RedirectResponse (url)<br>

But it gives me the statement back: "name 'ApiResponseFactory' is not defined" in the environment of the Workbench and when I have implemented in context of an quote.

What do I miss here?

Look forward to your recommendations. 🙂

Its maybe a little bit offensive but do you guys have maybe an idea how to create a redirect to another web application via a button on the quote and linked custom action which carries the respective logic? 🙂

lukapilipovic patrick.latour3 tdhirendra3221 milovan.srejic michael.wilhelm yoganandamuthaiah

Accepted Solutions (1)

Accepted Solutions (1)

Alexander_0001
Participant
0 Kudos

Hi all,
there are two options to solve it. After hard coding it via an JavaScript into the FrontEnd I found a better way:
I added to the Custom Action script of the respective button the following code.

QuoteId = context.Quote.Id
parameter = QuoteHelper.Get(QuoteId).GetCustomField('QuoteParameter').Value
url= 'https://www.example.com/'+ parameter.ToString()
context.WorkflowContext.RedirectToURL = (url)

It triggers a redirect in the existing tab and it is possible to add parameters to the url.

Answers (1)

Answers (1)

yogananda
Product and Topic Expert
Product and Topic Expert
0 Kudos

alexander-maerz

can you write razor code for redirect in RD template itself ...

Alexander_0001
Participant
0 Kudos

Thank you very much for your response.
A hardcoded redirect button in the responsive template is something I would like to avoid.
There should be an other best practice solution for this to stay closer to the standard especially due to the fact that the RedirectResponse (url) method exist.

I have already considered to simply use .NET code to create a solution but for the python scripts relevant .NET Classes and Namespaces like razor are forbidden: