The community will be in read-only from Tuesday 11:59pm (PST) to Wednesday 7:30am (PST)
The community will be in read-only from Tuesday 11:59pm (PST) to Wednesday 7:30am (PST)
Service Desk Practitioners Forum
cancel
Showing results for 
Search instead for 
Did you mean: 

Primary telephone number

Highlighted
Paweł Brzózka
Super Collector

Primary telephone number

Hi,

How can I delete all telephones form person? I mean I can delete all related telehone's number, but the field PrimaryTelephoneNumber in Person object still exist. I can't delete it. Any sugestions??
3 REPLIES
Paweł Brzózka
Super Collector

Re: Primary telephone number

I'am using HP Open View ServiceDesk 4.5 sp28 and WEB-API.
Paweł Brzózka
Super Collector

Re: Primary telephone number

I just find the sth like this:
http://forums11.itrc.hp.com/service/forums/questionanswer.do?threadId=542281

where the clue is:

"SD client copies the primary telephonenumber to another field in persons or organizations record which is available as readonly in the clients form:
ITSM_PERSONS.PER_PRIMARYTELNR
ITSM_ORGANIZATIONS.ORG_PRIMARYTELNR"
Paweł Brzózka
Super Collector

Re: Primary telephone number

I just do also a DB role in Administarive Console that clear (stay empyt) field primarytelephonenumber when the user's status changed.

But this DB role clear only primarytelephonenumber field. And the related telephone number I clear via the WEB-API:

IStatusPersonHome istpHome = SD_WEBAPI.getStatusPersonHome();
ILocalizableItem statuses[] = istpHome.searchOnText("Nieaktywny");
IStatusPerson status_osoby = null;
if ((statuses != null) && (statuses.length == 1)) status_osoby = ( IStatusPerson )statuses[0];
if (status_osoby == null) return -1;


IPersonHome phome = SD_WEBAPI.getPersonHome();
IPersonWhere pwhere = phome.createPersonWhere();
pwhere.addCriteriumOnStatus(status_osoby);
pwhere.addCriteriumOnPrimaryTelephoneNumber("*");
IPerson persons[] = phome.findPerson(pwhere);

if ((persons != null) && (persons.length > 0)){
for (IPerson person : persons){
try {
ITelephone telephones[] = person.getTelephone();
if ((telephones != null) && (telephones.length > 0)) {
for (ITelephone tel : telephones) {
tel.delete();
}
} }
} catch (Exception e) { loggerError.severe(e.getMessage()); }
}
}
//Add this to "OnDomLoad" event