Policy Automation for B2C Service

Get Involved. Join the Conversation.

Topic

    Kurt Helfrich
    Interview information into incident as textAnswered
    Topic posted October 5, 2016 by Kurt HelfrichGold Trophy: 10,000+ Points 
    363 Views, 16 Comments
    Title:
    Interview information into incident as text
    Content:

    Noob warning: I'm doing my first OPA project.

    This is a simple project.  From the CP, a logged in contact fills out an interview to provide information in a bunch of mostly text fields and paste it into an incident.  It's a service request with some specific data that do not need to be made into yet more custom fields.

    The CP user may not be receiving the service or paying for the service, so I'm just collecting all the job site and billing info as text.

    I have looked at the information in the documentation and some other guides I found, but I don't see how I format and paste that text in.  Do I use OPA forms?  I don't want the interview data as an attachment; I want it as formatted text in the incident.

    Can someone steer me in the right direction?

    Version:
    Service Cloud May 2016

    Best Comment

    Fiona Guy

    Hi Kurt 

    Looks like you are missing the rule to actually infer the thread entity instance. There's information on how to write these rules under the topic Write rules that infer relationships and entities. Specifically see worked example 2. 

    So in your example you need something like:

    the threads (the job site text) exists if

    the incident subject is known

    Where:

    the job site text = the concatenation of ... (whatever you want your thread text to be. Make sure any attributes are already known - ie don't belong to the thread entity)

    Also note that you can't use html in the text string to format your text (although watch this space for improvements in this area). 

    I've separately emailed you a modified version which hopefully you can get working. Let us know how you go. 

    Fiona

    Comment

    • Davin Fifield

      I think something along these lines is what you want:

      1. In your OPA Data tab Mapping Settings, choose interview is for Contact, and create Incident when interview is submitted.

      2. Create an OPA entity in your OPA data model called "the thread", and map it to the Service Cloud Thread object

      3. Define the various inputs you want to prompt for in the interview, and put them onto OPA interview screens

      4. Write a rule that concatenates the inputs into the format you want in your incident thread text

      5. Map out the thread text attribute to the appropriate Service Cloud field

       

    • Kurt Helfrich

      Do you have an example?  I did the mapping, and there is a "the thread" entity.  OPA says 'Instances of Thread (via Threads.ThreadList" are saved from entity "the thread" when the interview is submitted.'  That leads me to believe that I have it mapped correctly, and it seems to know the correct type for the Thread fields.

      I am able to create incidents, even including the setting of custom field values, but the thread isn't getting populated.  Here's what I have in the OPA rules.  OPA says there are no errors.  If I change the content type, channel or entry type to the ID numbers rather than the LookupName values, I get errors.

      the thread content type="text/html"

      the thread channel = "Post"

      the thread entry type = "Customer"

      the thread text = the concatenation of "<p>Entry Type: " + the thread entry type + "</p><p>Job Site Information<br/>--------------------</p><p>Job Site Contact Name: " + the job site contact name + “</p>”

    • Kurt Helfrich

      Oracle, just FYI, I have the "Oracle Administrator Guide for Service Cloud", which does a good job talking about mapping, but it's infuriatingly void of fully worked-out examples where I can glean the tidbits that explain how to actually make things work.  I have the example projects, too, but there's not much there, either.

    • Harriet Franklin

      Hi Kurt,

      Are you also familiar with the OPA documentation located here:  https://cx.rightnow.com/app/answers/detail/a_id/5597?

      Thanks - Harriet

    • Kurt Helfrich

      Yes, I've been looking through the sources linked there.

      I did notice one thing.  In the StudentBenefits example, there are rules that do work to put a customer note in an incident.

      The thread type = “Customer”

       

      the threads (“Here is my thread text”) exists if

      the incident subject is known

      That arrangement won't work for me, because the text I want in the thread isn't a fixed value - that's the reason for the unwieldy concatenation above.  I've tried putting my mapped value, the thread text, which is mapped to the Text value of the Thread "via Threads.ThreadList of Incident", into the parentheses, but it's not recognized as an entity and doesn't work.

      I have to believe that there something simple that's not in any documentation I've found.  Any ideas?

    • Kurt Helfrich

      Answer 6158, "Oracle Policy Automation Cloud Service Tutorials", looks like another good source.  I'm still looking through some of those references for my answer.

    • Fiona Guy

      Hi Kurt 

      Looks like you are missing the rule to actually infer the thread entity instance. There's information on how to write these rules under the topic Write rules that infer relationships and entities. Specifically see worked example 2. 

      So in your example you need something like:

      the threads (the job site text) exists if

      the incident subject is known

      Where:

      the job site text = the concatenation of ... (whatever you want your thread text to be. Make sure any attributes are already known - ie don't belong to the thread entity)

      Also note that you can't use html in the text string to format your text (although watch this space for improvements in this area). 

      I've separately emailed you a modified version which hopefully you can get working. Let us know how you go. 

      Fiona

    • Fiona Guy

      Feedback on the examples and documentation has been noted and we are working towards adding some simple worked examples (including thread creation) in a future release. Thanks for the feedback :-)

    • Kurt Helfrich

      Thanks, Fiona!!!  The piece I needed was that the text "variable" couldn't be part of the entity.  That wasn't obvious (to me at least), and I didn't understand that from reading the documentation.  I'm re-reading it in the light of understanding a bit more about how entities are instantiated.  I thought you had to predefine or import every item, but I just typed in a previously undefined name for the concatenated text (like you did), and it was automatically created as an attribute with role Intermediate, and then the whole thing worked.

      This way of creating things is going to take some getting used to.  I've programmed in a lot of languages, and this is unlike all of them.

      Basically, as I see it, this statement, if true, creates an instance of a thread.  So the "exists" statement is a kind of "new Thread()" statement when the condition is true.

      the threads (the job site text) exists if

      the incident subject is known

      By the way, the HTML text worked just fine.  Note that I set the thread content type to "text/html".  I didn't even have to escape the < and > characters.  Both the <br/> and <p></p> tags worked as expected for formatting.  That's a standard part of the Connect API objects, and indeed, when I look in the Value Lists for the project, there are two values for the Thread.ContentType - "text/plain" and "text/html".

    • Fiona Guy

      No worries - glad you got it working, and a nice bonus that the HTML worked when setting thread content type to text/html - you taught me something too! 

      We will roll your feedback into the doco updates so hopefully it will be clearer for those coming after you. Thanks again for the feedback.

    • Harriet Franklin

      Thank Fiona! 

      Kurt, it's great feedback from customers like you that help make the product and documentation better!  I can't wait to see what you are implementing with OPA!

    • Blessing Matore

      Hi Fiona, any chance you can email me that modified version? 

    • Fiona Guy

      Hi Blessing

      I can't send you Kurt's policy model (although he could!) but I will try to get a generic example to you, probably via the online documentation so others can benefit. What exactly are you trying to do? Is it approximately the same scenario as Kurt's?

      Fiona

    • Blessing Matore

      I meant the generic example. Yes, I am having similar issues getting custom incident subject and thread from interview data. Tried replicating the students benefit example with no success. 

    • Kurt Helfrich

      First, in the Output mapping, I mapped the intermediate text attribute "incident subject" to the Incident object's Subject field.  That's how OPA knows to transfer the data to the OSvC connection.  If you are able to create incidents, but the Subject is empty, I think this would be the problem.

      Here is how I set the subject and create the incident:

      incident subject = "ON-LINE FIELD SERVICE REQUEST - " + job site company name

      ticket text = the concatenation of job site text + billing text + situation text + other information text

      the threads (ticket text) exists if

      incident subject is known