A new Flexera Community experience is coming on November 25th. Click here for more information.

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Web Method Controlled Question Answers

We have a question we're using on our catalog items that we wanted to dynamically control the answers available. We created a web method that takes a variable, in this case the publisher, to provide available answers back. When testing it, the web method works when you give it the text it's looking for. When taking it a step farther and testing it at checkout it doesn't appear that the question is passing the custom variable to the web service.

Can you use custom variables in web service parameters at the question level?

 

webMethod.png

(6) Replies

Code has to be added to the App Broker product anywhere that custom variables are to be resolved into their corresponding values.  My guess is that this is not one of the areas where such code was added, but that's purely a guess.  Hopefully, @CharlesW can confirm this, and if this is indeed the case, then I would suggest logging an "Idea" for it.

Anything expressed here is my own view and not necessarily that of my employer, Flexera. If my reply answers a question you have raised, please click "ACCEPT AS SOLUTION".

I ran a quick test, and I can confirm that custom variables are not resolved/available during the checkout process. It looks like they would only be available once the request is submitted. The majority of the variables are resolved using the request ID. The only variables that would be resolved correctly during checkout would be those starting with "##Visitor_". What is the custom variable set to? Is there any way that you could lookup the value though a DB query, performed in your web service?

The custom variable is set to a Publisher name. We have a need to change the available answers for a specific question based on given publishers. We were hoping to avoid having to create different questions templates for one set of publishers vs another set and do it all through a dynamic web call.

I'm trying to come up with a way to work around this limitation.. I'll let you know. 

Sorry, I can't find a good way around this. I created some code in a web service to lookup the value for the unresolved custom variable that gets passed through to the web service. This worked fine.. Unfortunately, I realized that this would not work, as the web service itself only has a single variable defined. In order to get this to work, you'd need to have a separate web service command defined for each catalog item, and each accepting a different custom variable specific to the catalog item. Ultimately this defeats the purpose of using a custom variables in the first place. 

Long story short, from the web service being invoked by the question, there is no way of identifying what catalog item is in the cart during checkout; therefore, there is no way to lookup a value in the DB which would be specifc to a catalog item being checked out.

Actually, you might be able to leverage the session variable _apcart in your web service.  It contains a JSON array of items in the cart.  You might be able to take the catalog ID and do a DB lookup to get the publisher custom variable.  However, I'm not sure how well this approach would work if you have multiple items in the cart, because I don't know how you'd figure out which catalog item the question pertains to.  Whether you figure out a way to make this work or not, I would suggest submitting an Idea to make custom variables available during checkout.  It could help others.

Anything expressed here is my own view and not necessarily that of my employer, Flexera. If my reply answers a question you have raised, please click "ACCEPT AS SOLUTION".