5 Replies Latest reply on Feb 14, 2020 11:31 AM by Shreya Patel

    Numeric evaluation in workflow

    Ezra Wise
      Share This:

      Hello All,

       

      First, let me describe what I'm trying to accomplish and then I'll digress into how I've tried to solve for it and some of the challenges I've encountered...

       

      I would like to capture a dollar amount as an answer to a question in the questionnaire (e.g. Amount in USD).

       

      Next, based on this dollar amount I would like to execute one of three different approval processes in the workflow (e.g. If $ < X then goto Approval Process A, If $ >= X AND $ < Y goto Approval Process B, If $ >= Y goto Approval Process C)

       

      Last, I want to pass the $ Amount to a flex field in a Work Order that gets created once the approval(s) are complete.

       

       

      Now, here's what I've done/tried:

       

      The workflow uses an exclusion gate with 2 conditional paths and one default.

      I originally created a workflow variable AMOUNT cast as a decimal field and the numerical evaluation worked as expected.  However, I was unable to save the decimal field to a text field in the Work Order (e.g. 'WO Type Field 1') as it would always be blank.  I could not find a 'WO Type Field' of decimal in the WO template.  I also don't think that setting it to an integer field would work either as I expect it to also fail due to type mismatch or else lop off the 2 decimal points of precision (although I haven't actually tried this.)

       

      Next, I changed the workflow variable AMOUNT to a Text Field.  Although I can get the Amount to populate correctly in the Work Order, the numerical evaluation to determine which approval process to undertake is flaky.  Sometimes it works, sometimes it doesn't.  For example, if I enter "99,999.99" into the Amount question, it follows the path with the condition of 'AMOUNT >= "100,000.00" AND AMOUNT < "500,000.00"' - which I take to mean that numerical evaluation of strings probably isn't the best approach.

       

      I also considered casting the decimal AMOUNT to text (AMOUNT2, or something) so that I could use the former for numerical evaluation and the latter to populate the Work Order field, but I could not find a way to do that.

       

       

      Can someone suggest a better approach to accomplishing this task?

       

       

      Many thanks,

      --Ezra

        • 1. Re: Numeric evaluation in workflow
          Ezra Wise

          Figured it out.  I was able to set a Text process variable (Amount2) to a Decimal process variable (Amount1) using the Output map in a Build Input Set step.  I can use the decimal variable for conditional numerical evaluation successfully and use the text variable to pass to the Work Order using a text WO Type field.

          1 of 1 people found this helpful
          • 2. Re: Numeric evaluation in workflow
            Shreya Patel

            Can you help with the workflow you designed for this. We have similar type of use-case.

             

            Thanks,

            Shreya

            • 3. Re: Numeric evaluation in workflow
              Ezra Wise

              Sure thing - let me know if there are any specifics that you would like me to elaborate on...

               

              I created the questionnaire with a field "Amount", type = Decimal, which mapped to a Process Variable, also called "Amount".

               

              I created a workflow with an exclusion gate and 2 conditional branches; (1) checks if [Amount >= $100,000.00] AND [Amount < $500,000.00], and (2) checks if [Amount >= $500,000.00].  The third branch is the 'default' (does not match any other conditions) and catches everything where [Amount <$100,000.00].

               

              For each of these conditional branches I invoke the "Call Activity" element, set the Called Process to "Request Approval" and supply the corresponding approval process information.  I created custom approval processes for this particular task, but any existing approval process in AP:Administration will work.

              Reference info: Workflow to request approval - Documentation for BMC Digital Workplace Advanced 19.08 - BMC Documentation

               

              Once the approvals were obtained, the flow continues to create a Work Order record (Create Remedy Work Order element).  Before the Create Remedy Work Order step I include a Build Input Set step to set the parameters that I will pass to the Work Order.  Since I was using most of the WO Type fields (flex fields, the ones they give you play with when building old SR's in SRM or now with DWP-A) it required multiple Build Input Set steps (the element is limited to 10(?) fields).

              Reference info: Building a custom input map in a workflow - Documentation for BMC Digital Workplace Advanced 19.08 - BMC Documentation

               

              The input mapping within the step is where the parameter information is defined, but the output mapping goes unused unless you decide to use it (which I did!!)  I created an output mapping to include a new process variable (Amount2), type = text, and set Amount2 to Amount (the decimal variable).  I could then use Amount2 in a subsequent Build Input Set set as the variable set for a given WO Type Field parameter (since it was later in the field list I did not need any additional Build Input Set elements, however if it were earlier on - like needed for the first Build Input Set instance - I would just include an additional Build Input Set element and only set the Output Mapping information to include the necessary variables - you could probably also use many other elements' output mappings for this as long as they come before you need to use the variable).

              Reference info: Configuring an output map for an activity and using it in multiple activities - Documentation for BMC Digital Workplace …

               

              What this accomplished was effectively casting my Decimal value to a Text value, contained in 2 separate process variables - Amount and Amount2, respectively.  I was then able to work with Amount for any numerical evaluation operations correctly and still pass this information to the Work Order as a text field, Amount2.

               

              I hope this helps!

               

               

              Warm regards,

              --Ezra

              • 4. Re: Numeric evaluation in workflow
                Ezra Wise

                Workflow_redacted.png

                 

                This is some of the actual flow.  It goes on for quite a bit (to the right) but this is the gist of what I described above.  Apologies for the redaction - client confidentiality and all... 

                • 5. Re: Numeric evaluation in workflow
                  Shreya Patel

                  This absolutely helps. Thanks for all the details.