Marco Blom · Sep 14, 2018

How to set reference on property of class type


I have a working import routine, but I do get an error on properties based on another class

in this case [OrgType As ZenCrm.OrgType].

How do i set the correct reference?


0 319
Discussion (4)1
Log in or sign up to continue

You can do it either this way:

set OrgTypeId = $piece(line, ",", 2) // assuming, item 2 is an OID of ZenCrm.OrgType
if ##class(ZenCrm.OrgType).ExistsId(OrgTypeId) { set rec.OrgType = ##class(ZenCrm.OrgType).%OpenId(OrgTypeId,0) }

or this way:
do rec.OrgTypeSetObjectId($piece(line, ",", 2))

Thank you Julius, it works perfect!

I choose : do rec.OrgTypeSetObjectId($piece(line, ",", 2))

Thanks Eduard, useful information!