Policy Automation for B2C Service

Get Involved. Join the Conversation.

Topic

    Scott Heidenreich
    pass a value into an OPA interview using the widget
    Topic posted November 2, 2018 by Scott HeidenreichBronze Trophy: 5,000+ Points 
    144 Views, 1 Comment
    Title:
    pass a value into an OPA interview using the widget
    Summary:
    How do I get a value into an OPA interview using the widget.
    Content:

    Hello,

    I have the OPA widget 3, v1.2 integrated into our customer portal.  A customer is required to log in to use an OPA interview, this all works fine.  I can easily configure a model to create a new incident and submit it.  I also can have an OPA model retrieve a specific incident, allow the user to update the incident and post the changes back to OSvC.

    However, what I'm trying to do now, is allow a customer to load an existing incident, make changes, and then post a new incident.

    There is no straight up way to configure an OPA model to do this that I've found.  So, what I want to try, is passing in the incident ID using the "seed_data" parameter, and have the incident ID assigned to an attribute that can then be used to query the existing incident into a child entity.  Then I can let the user update the incident and when their work is complete, copy from the child incident into the global incident and create a new incident upon submit, because the model is set up to create a new incident.

    However, I'm having trouble getting the widget to parse the incident ID I've included in the URL that launches the model and assign it to an attribute.

    For example:

    Incident ID = 123456

    URL looks like this: (my CP url)/app/OPAi_id/opa_deployment/Test%20creating%20new%20Incident%20from%20Existing/seedData/blue%3D%2717916%27

    Where OPAi_id is the php page in the customer portal that contains the widget, the name of the model is Test creating new Incident from Existing, and the incident ID is 17916.

    I've also tried the ?seedData= approach under the URL parameter documentation for OPA and that is also not getting through to the model.

    All I want to do is pass the 17916 value into the model and have the model assign the value to an attribute that has the name "blue".

    How do I get that to happen?

    Thank you.

    Scott

    Version:
    18B

    Comment

     

    • Matt Sevin

      To pass additional data into interview from the widget, you should be setting the seed-data parameter in the widget to whatever name/value pairs you want. (in JSON format).   However, you may need mappings for two different objects if trying to represent (and load) an existing incident (input mapped) and also create a new (to be saved - output mapped) incident.   OPA supports a create or modify mapping (modify if loaded, create if nothing loaded) but the load and copy to a new approach probably requires two different objects and mappings.