akkigpt
New Member.
1213 views

How to create Java script to unload and load a specific .unl in HP service manager

Can anyone provide or help how to create a java script that can load and unload a specific unl file in HPSM.

0 Likes
9 Replies
Acclaimed Contributor.. Jacob Heubner Acclaimed Contributor..
Acclaimed Contributor..

Re: How to create Java script to unload and load a specific .unl in HP service manager

What's the goal?  You can schedule a load/unload using the normal database unload manager.  Why do you need this added to a Javascript?  What's the goal of the improvement?

0 Likes
akkigpt
New Member.

Re: How to create Java script to unload and load a specific .unl in HP service manager

Hi Jacob,

I want to perform this because My requirement is to automatically load and unload .unl file without using hpsm gui.

I want to execute load and unload using command line sm.exe.

The purpose of this is to automate the full deployment process of HP service manager backup and roll back as well.

0 Likes
Acclaimed Contributor.. Jacob Heubner Acclaimed Contributor..
Acclaimed Contributor..

Re: How to create Java script to unload and load a specific .unl in HP service manager

Right - I sort of got that part.  I figured you were asking because you wanted to load records.  My question is _why_?  If you're creating an integration between two HPSM systems, there's much easier, more robust, more established ways of doing it than writing something custom to load unload files.  I'm trying to imagine the scenario where you'd have someone using the unload manager to perform actions.  

The Text Import wizard - sure, I could see how you'd want to potentially give users access to that, or run that on some kind of schedule.  But even then, there's better ways of performing an integration to load records.

So the question isn't _what_ are you doing?  (loading records)  The question is, what is the scenario where this makes sense to do?  Why are you doing it?  Getting an understanding about that will allow us all to be more helpful than building something custom to load unload files using Javascript instead of the GUI.

0 Likes
akkigpt
New Member.

Re: How to create Java script to unload and load a specific .unl in HP service manager

Actually this automation is performed using a automation tool.

this automation tool need plugin to execute certain task on specified server or machine.

So i need to create plugin which can perform load , unload and purge data of specific .unl file.

As this automation  tool will communicate with HPSM via agent (automation tool agent which will be installed on HPSM server side)  and execute load ,unload, and purge.

Basically this task is to migrate one environment of HPSM to other using automation tool. on which daily or weekly deployment done on regular basis.

Please guide what are the possible ways to execute this.

0 Likes
Acclaimed Contributor.. Jacob Heubner Acclaimed Contributor..
Acclaimed Contributor..

Re: How to create Java script to unload and load a specific .unl in HP service manager

Sorry, still trying to wrap my head around the ask.

Tell me if I'm on the right track here -
So, you've got a development environment of HPSM where you're doing your coding and your development work; the normal stuff that gets asked for within an organization like 'make a field for this' or 'build a wizard for this' or 'when the IM ticket closes, make sure X, Y, and Z runs'.  You build code there and dump that code (on a semi-regular basis) to an unload file.  

Then, some other automated deployment system is supposed to take that code and deploy it in your production environment, applying the changes you've made in your code to the live environment without manual intervention.

Is that the general idea?

0 Likes
Highlighted
Micro Focus Expert
Micro Focus Expert

Re: How to create Java script to unload and load a specific .unl in HP service manager

Whoa! What happened to ITIL? Change Management, Change Management Board, Approval, Risk Assessment, user notification/training and etc etc. How do you implement a rollback if the unload changes has an issue?

I really hope this is not for a production environment and only between dev and test environments.

It's like looking at some folks using matches for the 1st time.

0 Likes
akkigpt
New Member.

Re: How to create Java script to unload and load a specific .unl in HP service manager

Jacob true you got the idea.

see it is like HPSM development team will provide an  package which contain two file

1.  prepare.unl and

2. release.unl 

that is to be loaded in pre-production environment.

now below are deployment steps :-

A. Load prepare.unl and then in unload script utility serach for prepare.unl ,unload it and give external path name as  prepare_backup.unl (this unloaded backup file will be used if rollback is required)

B.  Then load the release.unl 

C. If Rollback is required then in "unload script utility" search and unload/purge rollback.unl and gain load prepare_backup.unl that is created in step (A).

So  step A, B and C is to be automated using automation tool. But the automation tool can controll HPSM only through HPSM OS command line or scripts (java script or RAD function script built on HPSM client side )that can be called using command line.

0 Likes
Micro Focus Expert
Micro Focus Expert

Re: How to create Java script to unload and load a specific .unl in HP service manager

HI akkigpt,

to unload a file, you can follow the steps I mentioned in /t5/Service-Manager-Service-Center/how-to-unload-script-in-HPSM-using-command-prompt-or-program/td-p/6898230

 sm.exe script.execute NULL NULL test.script NULL -bg

To load a file, it's much simpler, you can run following command to load file

 

sm.exe file.load "C:\\PROGRA~1\\HP\\SERVIC~1.0\\HPSERV~1\\unload\\test.unl" NULL NULL winnt –bg

So to your use case, you need to:

 

1. load prepare.unl

sm.exe file.load "C:\\prepare.unl" NULL NULL winnt –bg

2. create a script which defines the files you'd like to unload and directories with name prepare_backup.script, and unload to prepare_backup.unl

 sm.exe script.execute NULL NULL prepare_backup.script NULL -bg

3. load release.unl

sm.exe file.load "C:\\release.unl" NULL NULL winnt –bg

4. for rollback

sm.exe file.load "C:\\prepare_backup.unl" NULL NULL winnt –bg

Hope it helps,

Ling-Yan

 

 

akkigpt
New Member.

Re: How to create Java script to unload and load a specific .unl in HP service manager

Thanks

sm.exe script.execute NULL NULL prepare_backup.script NULL -bg

 I want to purge data for rollback purpose , if a specific unl file required to rollback then data of unl has to be purged.

0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.