Policy Automation for Service

Get Involved. Join the Conversation.

Topic

    qi yipeng
    How to pass the name of the policy model to the field of the...Answered
    Topic posted June 13, 2019 by qi yipengRed Ribbon: 250+ Points 
    27 Views, 4 Comments
    Title:
    How to pass the name of the policy model to the field of the custom object of the service cloud
    Summary:
    How to pass the name of the policy model to the field of the custom object of the service cloud
    Content:

    Can I map the name of the OPA policy model to the field of the custom object?

    Best Comment

    Brad Tuckett

    I've written up what I did in the attached Word document (using the StudentBenefits example) but the basic idea is:

    1. Create a new text attribute called "the interview name" and map it for output to the custom field you want.  Give it the name "int_name".

    2. On a screen, add the input control for "the interview name" and change the caption to match the name "int_name" (we could add a custom property if there’s multiple controls to deal with)

    3. Add a JS file (I called mine "int_name.js") with the following:
    
    OraclePolicyAutomation.AddExtension({
        fullCustomInput: function(control, interview) {
            if (control.getCaption() == "int_name") {
                return {
                    mount: function(el) {
                    },
                    update: function(el) {
                        control.setValue(interview.deploymentName);
                    },
                    unmount: function(el) {
                    }
                }
            }
        }
    });
    

    4. Run the interview.  When you move off the screen with the input (which is hidden since the mount/unmount does nothing) then you will see "the interview name" has the value of the deployment (switch to “Data” and filter by “int”)

     

    Comment

     

    • Brad Tuckett

      The policy model name is not available as part of the policy model, but the deployment name (the name given when the policy model was deployed) is available via interview extensions if you are using a web interview.  Once you have an attribute mapped to the field of the custom object, then you could add a custom input extension on the submit screen that sets that attribute to the deployment name (you don't need to show this to the user).

    • qi yipeng

      Can you give me an example, or do you have related documentation? I don't know how to implement the interview extensions you said.

      Thank you,

    • Brad Tuckett

      I've written up what I did in the attached Word document (using the StudentBenefits example) but the basic idea is:

      1. Create a new text attribute called "the interview name" and map it for output to the custom field you want.  Give it the name "int_name".

      2. On a screen, add the input control for "the interview name" and change the caption to match the name "int_name" (we could add a custom property if there’s multiple controls to deal with)

      3. Add a JS file (I called mine "int_name.js") with the following:
      
      OraclePolicyAutomation.AddExtension({
          fullCustomInput: function(control, interview) {
              if (control.getCaption() == "int_name") {
                  return {
                      mount: function(el) {
                      },
                      update: function(el) {
                          control.setValue(interview.deploymentName);
                      },
                      unmount: function(el) {
                      }
                  }
              }
          }
      });
      

      4. Run the interview.  When you move off the screen with the input (which is hidden since the mount/unmount does nothing) then you will see "the interview name" has the value of the deployment (switch to “Data” and filter by “int”)

       

    • qi yipeng

      Thank you for giving me a good suggestion.