How to pass custom object as parameter in window.open javascript

192 views Asked by At

I'm trying to pass IDfSysObject as parameter in window.open() but I guess the IDfSysObject is getting converted to String and while retrieving, it is not letting me convert it back to IDfSysObject.

Here is my javascript code

function myFunction(objid, objname)
{
     
     window.open("view.jsp?uid="+objid+"&name="+objname,"","heightP0 ,widthP0");
    
    
}

here is how I'm trying to fetch it

Object obj = (Object)request.getParameter("uid");
sysObj = (IDfSysObject)obj;

I was hoping if there is anyway to send custom object as parameter? or if there is any way at all to pass this IDfSysObject to another jsp.

Thanks in advance.

1

There are 1 answers

0
KarolBe On

IDfSysObject does not serialize like this. You have to do as follows:

To get object Id of a sysobject:

IDfSysObject obj = ....
String objectId = obj.getObjectId().toString();

// now pass the objectId to the JS code, it is a string

to fetch a sys object having its id, you need IDfSession, which you get when you connect to the repository. Once you have it, it is simple:

IDfSysObject obj = session.getObject(new DfId(objectId));