Service Desk Practitioners Forum
cancel
Showing results for 
Search instead for 
Did you mean: 

How to set initiator into new work order?

Highlighted
Niolta
Occasional Advisor

How to set initiator into new work order?

Hello,

I try to create a new work order. I get Person using method searchOnIdentificationNumber(). What method let me add initiator (the Person) to new work order by his IdentificationNumber?
I try use setRequestor(), but get NullPointerException. Moreover, when I open existing work order and try to get Requestor using mehod getRequestor(), I also get NullPointerException. (on one's way question: what does mean method setApprovalInitiator() ?)
What role or rights need for my connection account?
Should I call any additional methods or do anything before?

Part of my code:
....
IWorkorderHome WOhome = session.getWorkorderHome();
IPersonHome personHome = session.getPersonHome();
IWorkorder wo = Wohome.openNewWorkorder();
IPerson initiator = null;
IPerson[] persons = personHome.searchOnIdentificationNumber("92134498");
if (persons.length == 1){ initiator = persons[0];}
.....
wo.setRequestor(initiator);
...
wo.save();
---------------------------------------------

Thanks in advance!
1 REPLY
Niolta
Occasional Advisor

Re: How to set initiator into new work order?

Can I create only work order without creating Servicecall or Change and without assigning work order with it?
//Add this to "OnDomLoad" event