6 Replies Latest reply on Apr 5, 2015 6:07 PM by dblansky

    calculation help - set boolean with calculation?


      I have several access items in my new user request that are boolean values.

      As part of the process, I am trying to set specific access items as true based on the new user's department.  Once the defaults are set, we can then review the selections & modify them as needed.


      I have a Window Calculation attribute set up & associated it with an automatic action on the request process.  The syntax checks out ok, but when I attempt to test, it throws an error:

      Error on line 4: The method or operation is not implemented.


      Here's a short snippet of the calculation:


      import System

      static def GetAttributeValue(Request):


        Request._AccessAdobeAcrobatPro = false


        if Request._ADDepartment._Title == "Information Technology":

        Request._AccesseAdobeAcrobatPro = true

        return Request._AccessAdobeAcrobatPro


      I have quite a few more access items & conditions based on department in the calculation, but this is the basic format.

        • 1. Re: calculation help - set boolean with calculation?
          elizabethcombrink Expert

          I presume you are trying to set the value of the field Request._AccessAdobeAcrobatPro to true or false?  Is this calculation on this field?


          You can't set the value like that in the calculation on itself - you create a variable (called Value) which you then pass as the result of the calculation.


          import System

          static def GetAttributeValue(Request):

          Value = false

          if Request._ADDepartment._Title == "Information Technology":

          Value = true

          return Value




          You could also of course set the value of your variable to be a Boolean attribute if you wanted to

          Value = Request._AccessAdobeAcrobatPro

          if Value == false:


          • 2. Re: calculation help - set boolean with calculation?

            Yes - I have about 45 access items that I need to do this for.  I was hoping to get it all done with a single calculation attribute to preset the defaults based on department.

            so returning a single value will mean I will need to have 45 separate attributes to do these calculations?  There's gotta be a better way...


            import System

            static def GetAttributeValue(Request):


              Request._AccessItem1 = false

              Request._AccessItem2 = false

              Request._AccessItem3 = false

              Request._AccessItem4 = false



              if Request._ADDepartment._Title == "Information Technology":

                   Request._AccessItem1 = true

              if Request._ADDepartment._Title == "Department 1":

                   Request._AccessItem2 = true

                   Request._AccessItem3 = true

              if Request._ADDepartment._Title == "Department 3":

                   Request._AccessItem4 = true

              return Request._AccessItem1, Request._AccessItem2, Request._AccessItem3, Request._AccessItem4

            • 3. Re: calculation help - set boolean with calculation?

              Like Elizabeth said, you were getting an error earlier because of this line.


                Request._AccessAdobeAcrobatPro = false


              you can't use that, in the calc window you're trying to return the value that specific attribute is supposed to be.


              In the case of pre-setting defaults, you should do that on the boolean value attributes themselves, not within a calculation.  Though if you want the default value to be dependent on the values entered on the form, you may need a calculation on each one.  Or you should look into profile Bundles.  This is something common I would do in when using an onboarding employee request to include a variable amount of services that would be requested automatically as a result of a specific profile being chosen when starting a new employee(email, laptop, certain software, mobile phone, etc...).  I feel like this is what you might be trying to do, but I'm not 100%.

              • 4. Re: calculation help - set boolean with calculation?

                I'll  need to look at this further to try and find a way to set these initially and still allow us to change the values as needed without resetting when the form reloads .


                Thanks guys!

                • 5. Re: calculation help - set boolean with calculation?
                  smiddleton Expert

                  You could try adding booleans to the _ADDepartment object 1 for each boolean you want to set.


                  Then use window copy rules to set the boolean the same as department.


                  Make sure the rules are not set to Always execute and you will then be able to edit them.

                  • 6. Re: calculation help - set boolean with calculation?

                    I ended up creating a window to set the checkboxes & am adding a decision to check the department & pass through the window with an action  containing the appropriate settings.


                    It will take some time to build out the separate windows, but is doing the job