Written by

Alenia B.V.
Question Marco Blom · Sep 14, 2018

How to set reference on property of class type

Hi,

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?

Thanks

Comments

Julius Kavay · Sep 14, 2018

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))

0
Marco Blom  Sep 15, 2018 to Julius Kavay

Thank you Julius, it works perfect!

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

0
Marco Blom  Sep 18, 2018 to Eduard Lebedyuk

Thanks Eduard, useful information!

0