Hello
Any way to place a default value in the form for the organization and caller attributes in tickets?
Regarding the organization, I see that you first have to select the organization so that it is set by default when a ticket is created. But I want to set an organization by default to speed up time. and once the default value is set, you can also open the list to choose a different option.
As for the caller, can you use a filter to take the current contact and put it in the caller form?
There's some really good documentation by Combodo. And some official examples; but there's a lot more in this repository too on how to accomplish certain things.
Never edit the existing files - always create an extension, so your changes are kept if you upgrade iTop.
I have a 3.1.1 iTOP version...I downloaded sample-add-attribute from the documentation above.(https://www.itophub.io/wiki/media?media=3_2_0:customization:sample-add-attribute.zip).
I assume this example should work. So I copied it to the "extensions" directory and ran https://itopurl.com/setup. Even with this example, however, it gives me an error:
Error loading module "sample-add-attribute": /itop_design/classes/class[Server] at line 4: could not be found - Loaded modules: dictionaries:1.0, core:1.0, application:1.0, authentic-cas:3.1. 1, authent-external:3.1.1, authent-local:3.1.1, combodo-backoffice-darkmoon-theme:3.1.1, combodo-cmdbchange-cleaner:1.0.5, combodo-email-synchro:3.7.2, combodo-password-expiration:1.0.1, itop-attachments:3.1.1, itop-backup:3.1.1, itop-config:3.1.1, itop-files-information:3.1.1, itop-portal-base: 3.1.1, itop-portal:3.1.1, itop-profiles-itil:3.1.1, itop-sla-computation:3.1.1, itop-standard-email-synchro:3.4.4, itop-structure:3.1. 1, itop-themes-compat:3.1.1, itop-tickets:3.1.1, itop-welcome-itil:3.1.1, sample-add-attribute:1.0.0
Is the example relevant and can I use it, or does it only work in old versions of iTOP? This example worked for me in older versions.
It says the same mistake like in my own extension with this XML definition.
The error you report is related to a missing dependency "itop-config-mgmt" defined the server class and "sample-add-attribute" modifies in XML the Server class which does not exist (yet)
When you create an extension modifying XML classes, then in the module.my-extension.php file you must change the "dependencies" array to list the itop standard modules which brings those classes, because they must be loaded before yours.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
You are right, the zip file is not very good, the dependencies are missing...
I will give it a look to create a new zip version using itop-design version="3.2"
Thanks for reporting this...
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Okay okay....and in my an extension is it need the dependencies?
'dependencies' => array(
'itop-tickets/2.4.0',
),
This dependency can be seen in original file datamodel.itop-request-mgmt-itil.xml for a class UserRequest. My goal is to change a default value in a class "UserRequest", in a field "impact" from "A department" to "A service".
Thank very much
Last edit: Ladislav Kudláček 2024-09-11
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hello
Any way to place a default value in the form for the organization and caller attributes in tickets?
Regarding the organization, I see that you first have to select the organization so that it is set by default when a ticket is created. But I want to set an organization by default to speed up time. and once the default value is set, you can also open the list to choose a different option.
As for the caller, can you use a filter to take the current contact and put it in the caller form?
Tthank you so much.
You could edit the datamodel to set those values by default. But it applies to everyone.
You can also do some magic with PHP - PrefillCreationForm .
Which data model do I have to edit to see the changes? I edited the datamodel.tickets.xml like this and it didn't work:
<field id="org_id" xsi:type="AttributeExternalKey">
<sql>org_id</sql>
<target_class>Organization</target_class>
<is_null_allowed>false</is_null_allowed>
<on_target_delete>DEL_AUTO</on_target_delete>
<default_value>1</default_value>
</field>
or
<field id="org_id" xsi:type="AttributeExternalKey">
<sql>org_id</sql>
<target_class>Organization</target_class>
<is_null_allowed>false</is_null_allowed>
<on_target_delete>DEL_AUTO</on_target_delete>
<default>
<value><![CDATA[SELECT Organization WHERE name = 'Organization1']]></value>
</default>
</field>
What would it be like for the current contact?
Do you have the documentation on how to do the PHP thing? I would appreciate it very much 😁
There's some really good documentation by Combodo. And some official examples; but there's a lot more in this repository too on how to accomplish certain things.
Never edit the existing files - always create an extension, so your changes are kept if you upgrade iTop.
Most useful resources are:
https://www.itophub.io/wiki/page?id=latest:customization:xml_reference
https://www.itophub.io/wiki/page?id=latest:customization:datamodel#content_of_a_module
https://www.itophub.io/wiki/page?id=latest:customization:portal_xml
And specifically for the prefilling (this allows a more dynamic approach; with the datamodel it would have to be the same values each time): https://www.itophub.io/wiki/page?id=latest:customization:form_prefill#prefill_creation_form
Hello,
I would like to change a default value in the class UserRequest in a field "impact".
I read the documentation on the site: https://www.itophub.io/wiki/page?id=3_2_0:customization:add-attribute-sample
I have a 3.1.1 iTOP version...I downloaded sample-add-attribute from the documentation above.(https://www.itophub.io/wiki/media?media=3_2_0:customization:sample-add-attribute.zip).
I assume this example should work. So I copied it to the "extensions" directory and ran https://itopurl.com/setup. Even with this example, however, it gives me an error:
Error loading module "sample-add-attribute": /itop_design/classes/class[Server] at line 4: could not be found - Loaded modules: dictionaries:1.0, core:1.0, application:1.0, authentic-cas:3.1. 1, authent-external:3.1.1, authent-local:3.1.1, combodo-backoffice-darkmoon-theme:3.1.1, combodo-cmdbchange-cleaner:1.0.5, combodo-email-synchro:3.7.2, combodo-password-expiration:1.0.1, itop-attachments:3.1.1, itop-backup:3.1.1, itop-config:3.1.1, itop-files-information:3.1.1, itop-portal-base: 3.1.1, itop-portal:3.1.1, itop-profiles-itil:3.1.1, itop-sla-computation:3.1.1, itop-standard-email-synchro:3.4.4, itop-structure:3.1. 1, itop-themes-compat:3.1.1, itop-tickets:3.1.1, itop-welcome-itil:3.1.1, sample-add-attribute:1.0.0
Is the example relevant and can I use it, or does it only work in old versions of iTOP? This example worked for me in older versions.
It says the same mistake like in my own extension with this XML definition.
I used the same header (version="3.1") like in original file (env-production/itop-request-mgmt-itil/datamodel.itop-request-mgmt-itil.xml).
Thank you
The error you report is related to a missing dependency "itop-config-mgmt" defined the server class and "sample-add-attribute" modifies in XML the Server class which does not exist (yet)
When you create an extension modifying XML classes, then in the module.my-extension.php file you must change the "dependencies" array to list the itop standard modules which brings those classes, because they must be loaded before yours.
You are right, the zip file is not very good, the dependencies are missing...
I will give it a look to create a new zip version using itop-design version="3.2"
Thanks for reporting this...
Okay okay....and in my an extension is it need the dependencies?
This dependency can be seen in original file datamodel.itop-request-mgmt-itil.xml for a class UserRequest. My goal is to change a default value in a class "UserRequest", in a field "impact" from "A department" to "A service".
Thank very much
Last edit: Ladislav Kudláček 2024-09-11
So I got to it again and fixed it.
Datamodel:
Module and dependencies
It could probably be simpler, but this works.
Last edit: Ladislav Kudláček 2024-09-17