Workflow activity coding in IF statement in Problem Management

vass2
Mega Expert

Hi All,

I have to fix an issue in PM for which i was going through all BRs,CSs,UI actions, since we don't have any technical doc available.

But i am unable to find this since couple of days.

Here is issue:

A problem ticket when reaches Problem Review state , if Problem Manager rejects an approval it is opening some tasks which are already closed. My requirement is to open the latest closed task instead of more than one.

So the below 2 tasks are opening on rejection of an approval from PM. Not sure where it is triggering from. I want to take help of logs. How can i get these logs to investigate further.

Please let me know how to achieve this.

find_real_file.png

On rejection the state changes from Problem review to Pending change.

find_real_file.png

5 REPLIES 5

Slawek_Radziewi
Kilo Sage

Check Business Rules on Problem table and Problem Task table. They should be responsible for opening task based on condition.


vass2
Mega Expert

Hi slawomir,


I have finally found a workflow that is triggering. I am new to workflow activity coding. Need some help on this.


Scenario is Currently after all problem tasks are closed , the problem reaches to Problem review state


Now if Problem manager rejects in review state.


Following tasks are opening:


Task1: Problem Implementation task - Work around


Task2: Problem Implementation task - Recommendation



Now i need how to write the code in If statement such that which ever task is closed last , that task should only open instead of opening both.



Below is the sample workflow activity we have, I don't have visio to present it in decent way.


Any suggestions from you is highly appreciated



find_real_file.png


vass2
Mega Expert

Please have a clear picture again
find_real_file.png


You go to Activity IF and add script which will compare dates


I am not very good at scripting as well so I am sure there is easier way to do it...



var task1 = new GlideRecord('problem_task');


task1.addQuery('problem', current.sys_id);


task1.addQuery('short_description', 'task 1'); /you have to somehow find task1


task1.query();



var task2 = new GlideRecord('problem_task');


task2.addQuery('problem', current.sys_id);


task2.addQuery('short_description', 'task 2'); /you have to somehow find task2


task2.query();



if (task1.updated>task2.updated)


return 'yes';


else


return 'no';