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

Generic Relation

Highlighted
Michaela P.
Collector

Generic Relation

Hi,

I'm having a problem with creating generic relations via web-api. I've already tried just about everything and still can't get the right solution... Still keep getting an error message - "simpleOpen() cannot be called with a null entityInfo parameter". Perhaps somebody here could help me?

And now part of my code:

ci ... holds a concrete instance of IConfigurationItem

change... holds a concrete instance of IChange

grt ... holds a concrete instance of IGenericRelationType (the type is consistent with relating CI to Change)

.....

IGenericRelation gr = gr_home.openNewGenericRelation();

gr.setFrom(change);

gr.setTo(ci);

gr.setType(grt);

try {

gr.save();

} catch (Exception e) {

System.out.println("error while creating generic relation occured: " + e.getMessage());

};

.....

Everything goes fine up to the moment when I try to save the newly created relation. Message of the exception: "simpleOpen() cannot be called with a null entityInfo parameter".

Thank you very much in advance,
Michaela
3 REPLIES
Michaela P.
Collector

Re: Generic Relation

Nobody experienced error while trying to use web-api to create generic relations?

Or did anybody anyhow import automatically (and in bigger amount) generic relations? Right now, it seems to me that it's not possible. sd_exchange doesn't work with generic relations either. Did you find any way to import generic relations? Other than insert directly into the database....

Thanks a lot
Michaela
Vasily Kamenev
Honored Contributor

Re: Generic Relation

Hi Michaela.
I had the same error. The problem in order of declation: need use setType before all, so your code must be as:

gr.setType(grt);
gr.setFrom(change);
gr.setTo(ci);

gr.save();

Vasily
Michaela P.
Collector

Re: Generic Relation

Thanks Vasily,

I luckily found that out as well in the meanwhile.... it was a nightmare for me for several days.

Michaela
//Add this to "OnDomLoad" event