11 Replies Latest reply on Apr 6, 2016 11:08 AM by Karthik

    Asset Tag auto generation

    Karthik Apprentice

      Hi!

       

      I need my service desk to generate asset tags automatically as and when I create new assets in CMDB. However, I am facing challenges and need advise.

       

      There's a logic behind asset tag generation. Every asset type has a shortcode, say for example Desktop has a shortcode "DTP", laptop has shortcode "LPT". These shortcodes are defined on Configuration Item Type Reference Object.

       

      Similarly, every company has a shortcode, say for example Ixtel has a shortcode "IXT", Idara has a shortcode "IDR". These shortcodes are again defined on the company object (under groups).

       

      Every asset record that is created will have company information as well.

       

      So, if the first desktop entry is created and company selected is Ixtel, it's asset tag should be populated as IXT-DTP-0001

      Now, if the second desktop entry is created and company selected is Idara, it's asset tag should be populated as IDR-DTP-0001

      If I create a third desktop entry and company is selected as Ixtel, it's asset tag should be populated as IXT-DTP-0002

       

      The same needs to apply for all the asset types as well.

       

      Any design ideas are welcome.

       

      Regards,

      Karthik

        • 1. Re: Asset Tag auto generation
          Karthik Apprentice

          Can somebody help me on this? Any help is much appreciated!!

          • 2. Re: Asset Tag auto generation
            ProServices

            Karthik,

             

                 Are you setting the company object on these config items?  If so this should just be a calculation that wouldn't be too hard.  The issue is going to be if these assets have already been imported and the number of the Asset Tag.  Is this already stored somewhere from your imports or has this asset data not been imported yet?

            • 3. Re: Asset Tag auto generation
              Karthik Apprentice

              Hi,

               

              The CI Management data has already been imported into respective CI Types. However can you give me some advice on the calculation that you were suggesting.

               

              And yes I am using company object on these CI items.

               

              Regards,

              Karthik

              • 4. Re: Asset Tag auto generation
                ProServices

                This is all I can provide so far.... I don't have a way to number(and add that in at the end of the asset tag) your assets without basing it off some data already imported on them.

                [CODE]import System

                static def GetAttributeValue(ConfigItem):

                Value = ''

                CompPrefix = 'Default'

                ClassPrefix = 'CI'

                if ConfigItem.Group != null and ConfigItem.Group.Title == 'Ixtel':

                  CompPrefix = 'IXT'

                elif ConfigItem.Group != null and ConfigItem.Group.Title == 'Idara':

                  CompPrefix = 'IDR'

                elif ConfigItem.Group != null and ConfigItem.Group.Title == 'Acme':

                  CompPrefix = 'ACM'

                if ConfigItem.Class.Title == 'Workstation':

                  ClassPrefix = 'DTP'

                elif ConfigItem.Class.Title == 'Laptop':

                  ClassPrefix = 'LAP'

                 

                Value = CompPrefix + '-' + ClassPrefix

                 

                return Value[/CODE]

                • 5. Re: Asset Tag auto generation
                  Karthik Apprentice

                  Hi

                   

                  I did get this far. However I am facing challenges on the numbering part. I can delete the data and import it back. However I still need to know how to get numbering part done especially knowing that I cannot create int32 attribute on the child config objects as it will start numbering 1,2,3 etc irrespective of the company selection.

                   

                  Regards,

                  Karthik

                  • 6. Re: Asset Tag auto generation
                    ProServices

                    Wouldn't that be okay since you'd just be using that identity int32 attribute for use in your calculation that would be coming up with the asset tag?

                    • 7. Re: Asset Tag auto generation
                      Karthik Apprentice

                      But that identity int32 attribute won't take company selection in context. If I use that logic my first record would be IXT-DTP-001, but my second record would be IDR-DTP-002. But we want it to be numbered as IDR-DTP-001 as the asset belongs to a different company.

                       

                      And the same needs to be applicable to all CI types as well.

                      • 8. Re: Asset Tag auto generation
                        Fabian Schmidt Expert

                        I didn't read everything in Detail for the moment, but what I can tell you from my experience with other customers.

                        The automatic numbering in you case is the most difficult bit, and I'm afraid the calculation funtionality is limited for such a feature.

                         

                        Some time ago I solved the issue by building an SQL query to get the highest allocated number + 1 and executed this SQL Statement within a calculation...

                        Attention on this: No support by LANDESK for such a usage of calculations!

                         

                        Are you able to gather the highest allocated number using SQL? If so I could give some additional assistance.

                        • 9. Re: Asset Tag auto generation
                          ProServices

                          You wouldn't need the int32 attribute to take the company or device type into account.  The int32 would only generate a 'reference number' and you would use that in your calculation above.

                          • 10. Re: Asset Tag auto generation
                            Karthik Apprentice

                            That reference number from int32 attribute won't meet the requirement.

                            • 11. Re: Asset Tag auto generation
                              Karthik Apprentice

                              Hi Fabian,

                               

                              I was think on these lines. However, I need assistance in building the SQL query.