Re: Open CM task with Javascript (1197 Views)
Reply
Frequent Advisor
Posts: 42
Registered: ‎02-29-2008
Message 1 of 7 (1,434 Views)

Open CM task with Javascript

Hi.

 

I have a requirement to open several tasks in CM process (SM 9.30)  based on different inter-related conditions.

 

1. How can I open a task via Javascript ... directly or indirectly, using RAD call?

2. How a task category can be included in to task opening script?

3. Which task fields are mandatory to fulfill CM process workflow?

4. Are there any other updates to be made during task opening?

 

Regards,

Marjan

Frequent Advisor
Posts: 56
Registered: ‎06-07-2011
Message 2 of 7 (1,424 Views)

Re: Open CM task with Javascript

SM can open serveral tasks automatically when a Change Phase opened.

 

You can find the feature in "Auto Open Task" tab and "Automatically Open Tasks (array based)" of Change Phase.

 

Good Luck!

 

Honored Contributor
Posts: 1,385
Registered: ‎04-19-2011
Message 3 of 7 (1,408 Views)

Re: Open CM task with Javascript

1. How can I open a task via Javascript ... directly or indirectly, using RAD call?

 

    You can open a task using javascript directly

 

2. How a task category can be included in to task opening script?

 

    You need to assign it in javascript while trying to add a new task

 

3. Which task fields are mandatory to fulfill CM process workflow?

 

     parent change id, status, Affected CI, Assignment group, category, impact, urgency, Title, description

 

     Except status all other mandatory fields can be pulled from parent change record.

 

4. Are there any other updates to be made during task opening?

 

    No as far as I am concerned.

Frequent Advisor
Posts: 42
Registered: ‎02-29-2008
Message 4 of 7 (1,389 Views)

Re: Open CM task with Javascript

Thx for answers.

 

I managed to open tasks using java script and populate suggested fields. It works OK. Additionally I discovered that for change process made with new process designer you also have to populate "changePlan" table which holds information about change and each task; when it is opened (openInPhase) and when it should be closed (closedByPhase). OOB does this but has several bugs and it does not work. I solved this with another JS ... it works.

 

Now I have new challenge; most of phases in CM process have automatic phase transition defined. This should be activated when all necessary tasks are closed or all necessary approvals were made. With approvals it works but when I close tasks that need to be closed in defined phase, the change process is not forwarded to next phase. Opening change record and simply saving it (all tasks for the phase should be closed) with no data changes triggers phase forwarding.

 

1. How to trigger automatic change phase forwarding (transition) without opening and saving change record?

 

2. Alternatively …  how to call “change.update.save”  (actual Save button) without opening change record?

Honored Contributor
Posts: 989
Registered: ‎02-22-2011
Message 5 of 7 (1,381 Views)

Re: Open CM task with Javascript

Make sure the JavaScript uses doAction("<some value>") instead of doUpdate() so the Change work-flow is executed. This could be all that is needed to include the desired functionality.

 

Examples:

record.doAction("save");

record.doAction("approve");

 

Reference:

http://h30499.www3.hp.com/t5/HP-Service-Manager-Service/What-are-the-differences-between-doUpdate-do...

 

Frequent Advisor
Posts: 42
Registered: ‎02-29-2008
Message 6 of 7 (1,367 Views)

Re: Open CM task with Javascript

Hi.

I have taken in account your suggestion and used "doAction" in JS. It worked normally except once (it could be a coincidence) when the client crashed and data has become corrupt (... update and "save" task record and based on task status perform referenced change "save" action ...).

 

On my opinion this scenario can also be performed manually (two users ... two simultaneous "save" actions).

Is there any possibility to delay second action (in this case change "save") or somehow to schedule change "save" action?

 

Regards. M.

 

 

Highlighted
Occasional Advisor
Posts: 11
Registered: ‎10-31-2011
Message 7 of 7 (1,197 Views)

Re: Open CM task with Javascript

[ Edited ]

<< somehow to schedule change "save" action?

 

you can try use next solution:

from trigger after update if match condition, you create scheduler object with class "linker",

which will call ioaction object with js code at the appointed time.

in ioaction you doSelect( your record) and then doAction("save")

 

But I'm afraid you can not use this solution, if you use Process Designer.

I try to do it for new KM and when I try to execute doAction("save") with change phase,

but recieve JS error 28 (RC_NOT_AUTHORIZED)

 

If I use this JS code from triggers, it's executed.

 

Can you clarify that Approval works with use Process Designer? which version?

I can't created Approval records. or Approval at all not works in PD or only not yet for KM.

At least in datadict for Approval, in Applications list Knowledge Management absent.

The opinions expressed above are the personal opinions of the authors, not of HP. By using this site, you accept the Terms of Use and Rules of Participation.