7 Replies Latest reply on Apr 26, 2020 11:47 PM by Hugo Stadin

    Mapping Questions and Answers to a single field in DWP Catalog

    Arun Ajaykumar
      Share This:

      Hello everyone,

       

      We have developed a Service request in DWP catalog and the service request will create a work order fulfillment ticket. We have the requirement to map all the Question and answers (only the ones that are answered) to the “detail description” field. This is quite a cakewalk using SRDs however, we are struggling for the same in DWP catalog. The version we are using is Helix 20.2. We have tried to  map the field with the SB Context - Question and answers process variable field but in this case am getting full json script (PFA). Could someone help us how to convert the data in a readable format.

       

      Regards

      AA

        • 1. Re: Mapping Questions and Answers to a single field in DWP Catalog
          Eric Schmidt

          Hi Arun,

           

          You have to map the variables that you are storing the answers into the description. So instead of putting the SBC of "questions and answers" into the work order description you would do something like:

           

          "Items Required: " + Items required process variable

           

          Then when the information comes over in the work order that variable will be populated with the choices the customer has made. So again in the case of your above example the work order would show:

           

          Items Required: [Cleaning Sponge 1 PC, Coffee Beans]

           

          You would then repeat that process for all the process variables that you want to come over into the work order.

           

          https://docs.bmc.com/docs/digitalworkplaceadvanced/2002/end-to-end-example-of-waiting-for-a-remedy-itsm-response-908223607.html

           

          This is an older example but it might help you out.

          • 2. Re: Mapping Questions and Answers to a single field in DWP Catalog
            Hugo Stadin

            Hi,

             

            It's possible but you have to build a workflow for it.
            I've made an example you can try if you want. I couldn't find how/where to attach the workflow to this reply so I will explain how I built it.

             

             

            Variables

            Context: Service Broker Context (required input variable).

            Object: Local text variable

            Counter: local integer, default value 1.

            Questions and Answers: Output text variable

             

            Sub-Process

            Loop Type: Parallel

            Loop Data Input: Question and answers           (Context -> Questions and answers)

            Input Data Item: Object

             

            Question Label (Json Parser)

            Json: Question and Answers           (Context -> Questions and Answers)

            Path For Search: "$.[" + (Counter - 1) + "].label"

             

            Length Label (Length)

            Text: Question Label -> Output

             

            Remove junk Label (Substring)

            Text: Output                                     (Question Label -> Output)

            Start Position: 1

            End Position: Output - 1                (Length Label -> Output)

             

            Question Value (Json Parser)

            Json: Question and Answers           (Context -> Questions and Answers)

            Path For Search: "$.[" + (Counter - 1) + "].displayValue"

             

            Length Value (Length)

            Text: Output                        (Qustion Value -> Output)

             

            Remove junk Value (Substring)


            Text: Output                        (Question Value -> Output)

            Start Position: 1

            End Position: Output - 1      (Length Value-> Output)

             

            Length QnA & Counter+1 (Length)

            Text: Questions and Answers         (our output variable, not context)

            Output Map:

                 Name: Counter

                 Source: Counter + 1

             

            Append Question + Answer (Insert)

            Text: Questions and Answers                                                        (our output variable, not context)

            Insertion: Output + ": " + Output + STRIPHTML("<br>")               (First output = Remove junk label -> Output. Second output = Remove junk Value -> Output)
            Offset: Output                                                                               (Length QnA & Counter+1 -> Output)

            Output Map:

                 Name: Questions and Answers               (our output variable, not context)

                 Source: Output                                       (Append Question + Answer -> Output)

             

            After creating the workflow you can use it in any other workflow using "Call Activity".

             

            Hope it helps!

             

            /Hugo

            5 of 5 people found this helpful
            • 3. Re: Mapping Questions and Answers to a single field in DWP Catalog
              Carl Wilson

              Hi Hugo,

              nice work!

              Just for clarification, does this only push the Questions that were answered to the output?

               

              Cheers

              Carl

              • 4. Re: Mapping Questions and Answers to a single field in DWP Catalog
                Hugo Stadin

                Hi Carl,

                 

                Thank you!

                 

                Yes, from what I've seen the "Questions and Answers" context variable only contains answered questions.

                However, this also includes hidden questions, so you might want to add some workflow to exclude these.

                You can't see the difference of a visible or hidden question in Q&A context variable but you can achieve this by adding a specific tag or by adding "#hidden" (just an example) to the question label and excluding it using an "Exclusive Gateway".

                 

                This is a hidden question from Q&A Context variable.

                {

                        "key": "726f139b-2c95-e603-85db-1aa7a642f7df",

                        "label": "Testfield",

                        "value": "testvalue",

                        "tags": [],

                        "valueType": "TEXT",

                        "displayValue": ["testvalue"],

                        "assignedToProcessInput": false,

                        "confidential": false

                    }

                 

                BR,

                Hugo

                2 of 2 people found this helpful
                • 5. Re: Mapping Questions and Answers to a single field in DWP Catalog
                  Carl Wilson

                  Thank you Hugo for confirming, appreciated.

                  • 6. Re: Mapping Questions and Answers to a single field in DWP Catalog
                    Marek Ceizel

                    Hello Hugo Stadin,

                     

                    Nice shot. I like this.

                    We use another procedure which is a little bit less complicated and we use the object of the loop. You can check here:

                    DWP Catalog - Populate Questions and Answers (only answered)

                     

                    There are two important points.

                    - The insert doesn't work as described. If the variable in text is Null (and it is at the start) we got hard error because of that.

                    - There is some bug in SBContext processing. If you use Request Again on a Request and delete some answers even the empty Questions/Answers are delivered in context (those which were previously answered). This is relevant only for Text Fields questions.

                     

                     

                    thanks a lot

                    Marek

                    2 of 2 people found this helpful
                    • 7. Re: Mapping Questions and Answers to a single field in DWP Catalog
                      Hugo Stadin

                      Nice Marek,

                       

                      I knew my solution wasn't perfect but yours look way easier!

                       

                      BR,

                      Hugo