Forum Discussion

Kradican's avatar
Kradican
Ideator II
2 years ago
Solved

Update class_structure with AML?

Hi Everyone, I'm trying to add new classes to the class_structure of the Part ItemType with AML, but the results are giving me an empty class_structure.  What I tried is something like  <AML> ...
  • asebastian's avatar
    2 years ago

    Hi Kevin,

    It appears that the class_structure property on ItemType is a Text field. Here's what it looks like for the Part ItemType:

    I believe your issue is that you're treating the XML within the class structure as an extension of your AML, when in reality it's basically a long string within your class_structure property. I've created a basic ItemType with a modified class structure and exported it via the export tool. Here's how it looks: 

    [embed:dc8ab71f-3b98-42d9-b0f6-e21e02a0f8e2:723f06fc-f086-42ee-a615-dff621a0bc69:type=xml&text=%3CAML%3E%0A%20%3CItem%20type%3D%22ItemType%22%20id%3D%2249E6DF25B40944D2895243AB3C3D5D76%22%20action%3D%22add%22%3E%0A%20%20%3Callow_private_permission%3E1%3C%2Fallow_private_permission%3E%0A%20%20%3Cauto_search%3E0%3C%2Fauto_search%3E%0A%20%20%3Cclass_structure%3E%3C%21%5BCDATA%5B%3Cclass%20id%3D%2249E6DF25B40944D2895243AB3C3D5D76%22%3E%3Cclass%20id%3D%2279BD8D2734BA49569A685ECC60ECE851%22%20name%3D%22test1%22%3E%3Cclass%20id%3D%229FD75844F9A0438B891773350723A515%22%20name%3D%22Test3%22%20%2F%3E%3C%2Fclass%3E%3Cclass%20id%3D%229F0A06FA15E344C19CD7AAD0EC9F2F46%22%20name%3D%22test3%22%20%2F%3E%3C%2Fclass%3E%5D%5D%3E%3C%2Fclass_structure%3E%0A%20%20%3Cenforce_discovery%3E1%3C%2Fenforce_discovery%3E%0A%20%20%3Chide_where_used%3E0%3C%2Fhide_where_used%3E%0A%20%20%3Cimplementation_type%3Etable%3C%2Fimplementation_type%3E%0A%20%20%3Cinstance_data%3ETEST%3C%2Finstance_data%3E%0A%20%20%3Cis_dependent%3E0%3C%2Fis_dependent%3E%0A%20%20%3Cis_relationship%3E0%3C%2Fis_relationship%3E%0A%20%20%3Cis_versionable%3E0%3C%2Fis_versionable%3E%0A%20%20%3Clabel%20xml%3Alang%3D%22en%22%3Etest%3C%2Flabel%3E%0A%20%20%3Clabel_plural%20xml%3Alang%3D%22en%22%3Etest%3C%2Flabel_plural%3E%0A%20%20%3Crevisions%20keyed_name%3D%22Default%22%20type%3D%22Revision%22%3E7FE395DD8B9F4E1090756A34B733D75E%3C%2Frevisions%3E%0A%20%20%3Cshow_parameters_tab%3E1%3C%2Fshow_parameters_tab%3E%0A%20%20%3Cstructure_view%3Etabs%20off%3C%2Fstructure_view%3E%0A%20%20%3Cunlock_on_logout%3E0%3C%2Funlock_on_logout%3E%0A%20%20%3Cuse_src_access%3E0%3C%2Fuse_src_access%3E%0A%20%20%3Cname%3Etest%3C%2Fname%3E%0A%20%20%3CRelationships%3E%0A%20%20%20%3CItem%20type%3D%22View%22%20id%3D%225873C8FBA2664651AA4E7F728EBE10E1%22%20action%3D%22add%22%3E%0A%20%20%20%20%3Cclient%3Ejs%3C%2Fclient%3E%0A%20%20%20%20%3Crelated_id%20keyed_name%3D%22test%22%20type%3D%22Form%22%3E99DCC4E32DEF4D27A5A6A7C15D48566A%3C%2Frelated_id%3E%0A%20%20%20%20%3Crole%20keyed_name%3D%22World%22%20type%3D%22Identity%22%3E%0A%20%20%20%20%20%3CItem%20type%3D%22Identity%22%20action%3D%22get%22%20select%3D%22id%22%3E%0A%20%20%20%20%20%20%3Cname%3EWorld%3C%2Fname%3E%0A%20%20%20%20%20%3C%2FItem%3E%0A%20%20%20%20%3C%2Frole%3E%0A%20%20%20%20%3Cshow_ssvc%3E0%3C%2Fshow_ssvc%3E%0A%20%20%20%20%3Csort_order%3E128%3C%2Fsort_order%3E%0A%20%20%20%20%3Csource_id%20keyed_name%3D%22test%22%20type%3D%22ItemType%22%20name%3D%22test%22%3E49E6DF25B40944D2895243AB3C3D5D76%3C%2Fsource_id%3E%0A%20%20%20%20%3Ctype%3Edefault%3C%2Ftype%3E%0A%20%20%20%3C%2FItem%3E%0A%20%20%3C%2FRelationships%3E%0A%20%3C%2FItem%3E%0A%3C%2FAML%3E]

    It looks like the contents of the <Class_structure> tag are wrapped in a CDATA wrapper. your code should look like 

    <class_structure><![CDATA[ your class structure here ]]</class_structure>

    I'm curious why you're using AML for something like this? Generally going into the instance for a change like this would make more sense, where you can then export it and reimport if necessary.

    AJ