1 2 Previous Next 16 Replies Latest reply on Aug 13, 2018 11:26 AM by JohnO

    Drop down menu copy question.

    JohnO Specialist

      Hi Everyone,

       

      Is it possible to use calculation that will copy the contents of a field onto a drop down menu(collection)?

       

      Sincerely,

      John

        • 1. Re: Drop down menu copy question.
          KRYS-GROUP Apprentice

          Hi John,

          If you want to select a value of a drop down menu from the content of an other field, you have to copy the object instead of the value like this

           

          import System

          static def GetAttributeValue(Call):

          // Get text value in MotifAppel

          MotifAppel = Call._KGMotifsdAppelcoteclient._KGMotifsdAppels._KGMotifsdAppels

          // Set value of drop down menu with the object

          return Call.GetNamedObject("CallManagement._KGMotifsdAppels", MotifAppel)

           

          But if you want to add additional value in a drop down menu I don't know if it is possible.

           

          Regards

          Laurent Dané

          1 of 1 people found this helpful
          • 2. Re: Drop down menu copy question.
            JohnO Specialist

            Hi KRYS-GROUP,

             

            I think I am getting there. The result is that the drop down menu is greyed out. Is there a way to prevent it from greying out (read only)?

            • 3. Re: Drop down menu copy question.
              Julian Wigman ITSMMVPGroup

              Hi JohnO , calculated attributes setup at object level are read-only by-design.  

               

              One thing you can do though is to set the value as a process calculation.

               

              To do this, create an action in process designer and check the “allow association with window” checkbox.  Drop that onto your process as an automatic action at a place in the process where you want this calculation to fire.  Now if you double-click this action in the designer it’ll bring up the main form; make sure your calculation target field is on there or if not then add permanently or temporarily (ie you can hide once the next design change is done) to the window via window manager.  Anyway once you can click the automatic action and see the calculation target field then it is just a case of right-clicking it and adding the calculation there (exact calc you have already built!).  Finally remove the calc from the attribute at object level.

               

              Now when that automatic action fires at runtime it will set the target dropdown value BUT leave the field read/write.

               

              If you are trying to lookup a dropdown value via a field holding a string value then this will sort it.  If the source and destination attributes are related to the same object then you could simply use a Business Object Copy Rule instead BTW.  If the above “process” method to set isn't possible you could maybe combine what you have now with a copy rule (but starting to get a tad messier); ie the field you are setting now becomes a hidden “ghost” field which is calculated but then this field is copied onto a visible duplicate of this field which is read/write via a copy rule (assuming the copy rule can be triggered).

               

              My take anyway. It all depends though on the use case for why you are trying to do this in the first place but it does sound like you are trying to set a calculated default value of some sort? In this type of scenario the calc gives you the ability to model complex decisions for choosing the right target value. There maybe better solutions to this though if you share the requirement including how the source vale is entered ( manually or via import or event for example), what attribute type it is (string, dropdown?) and as I say the use-case.

               

              Julian

              MarXtar Ltd

              1 of 1 people found this helpful
              • 4. Re: Drop down menu copy question.
                KRYS-GROUP Apprentice

                Hi John,

                 

                I my case as proposed by Julian, my calculation is in an automatic action box in a process. And data comes from import from a database using ServiceDesk tools.

                Best regards

                Laurent Dané

                KRYS-GROUP

                1 of 1 people found this helpful
                • 5. Re: Drop down menu copy question.
                  JohnO Specialist

                  JulianWigman, KRYS-GROUP You both are geniuses! I never thought about adding an automatic action item. I added it on the very first part of the process.

                  then added the calculation on the Asset Location field. KRYS-GROUP- Thanks for the screenshot!

                  KRYS-GROUP, JulianWigman Is there a way to affect the rest of the existing items already entered or imported? I noticed that the drop down only copies the location if I manually enter a new item.

                  • 6. Re: Drop down menu copy question.
                    Julian Wigman ITSMMVPGroup

                    JohnO Yes. Temporarily put that calc back on the target dropdown in Object Designer but set it to a “Scheduled” calc type.  Then create a Schedule Manager job that runs a query to pick all the items you want to update with an action to run your scheduled calculation.  Let the job run and then delete the schedule and remove the calc from Object Designer again.

                     

                    Julian

                    MarXtar Ltd

                    1 of 1 people found this helpful
                    • 7. Re: Drop down menu copy question.
                      JohnO Specialist

                      JulianWigman I will try that. Thank you! I owe you a beer or something! Keep you posted.

                      • 8. Re: Drop down menu copy question.
                        JohnO Specialist

                        JulianWigman is it also possible for the target field update automatically with a value instead of just appearing when someone clicks on SAVE or SAVE AND CLOSE?

                        • 9. Re: Drop down menu copy question.
                          Julian Wigman ITSMMVPGroup

                          JohnO what constitutes “automatically” in your mindset as something needs to trigger the calc to fire so what are you requiring?

                           

                          Julian

                          • 10. Re: Drop down menu copy question.
                            JohnO Specialist

                            Yes! Something to trigger the calc to fire. Something similar to the Update or Initialise on Copy Rule. The drop down only shows the location right after I click on SAVE or SAVE AND CLOSE. I was trying to find a way to fire the calculation which automatically selects the location right away. I hope I explained it right.

                            • 11. Re: Drop down menu copy question.
                              Julian Wigman ITSMMVPGroup

                              JohnO Hmm at what point is the source value populated and how? Is it a string field that someone types in? I can really help further without understand the use case you are trying to create.

                               

                              Julian

                              • 12. Re: Drop down menu copy question.
                                JohnO Specialist

                                Right now the calculation works. When I select a user, it auto populates the fields...

                                 

                                then when I click on SAVE it only populates the Asset Location drop down field. I was wondering if there is a way to automatically change the Asset Location drop down to auto select an Asset Owner.

                                 

                                • 13. Re: Drop down menu copy question.
                                  Julian Wigman ITSMMVPGroup

                                  JohnO So if “User Location” is a dropdown attribute on the User object as used for”Asset Owner”, you can do all of this without calculations an just a copy rule.

                                   

                                  Create a new copy rule, triggered on UPDATE, where the source is “Asset Owner \ User Location” and the target is “Asset Location”.  Select the checkbox so it always executes.

                                   

                                  Change the property of the “Asset Owner” field so that the property “Copy Related” = true.

                                   

                                  If you do that then whenever you select the Asset Owner the Asset Location should also set.

                                   

                                  Julian

                                  MarXtar Ltd

                                  1 of 1 people found this helpful
                                  • 14. Re: Drop down menu copy question.
                                    JohnO Specialist

                                    Julian, the User Location is not part of the User Object (Named "Asset Owner"). It is a separate attribute that pulls location info via calc. I was wondering if the "Asset Location" drop down can change if I select another "Asset Owner". Right now, the automatic action with calculation works fine but if I change the "Asset Owner" then click SAVE or SAVE AND CLOSE, it does not change the "Asset Location" For some reason it only does it one time.

                                    1 2 Previous Next