I want to customize the /combodo-mail-to-ticket-automation/itop-standard-email-synchro/datamodel.itop-standard-email-synchro.xml file so that the location_id field is written to the ticket.
I inserted the line, but it does not work.
if (MetaModel :: IsValidAttCode (get_class ($ oTicket), 'caller_id'))
{
$ oTicket-> Set ('caller_id', $ oCaller-> GetKey ());
$ oTicket-> Set ('location_id', 'SELECT Location AS l JOIN Person AS p ON p.location_id = l.id WHERE p.email =: email');
}
Please help me!
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Is that location supposed to be modified later?
If the location is always the one from the caller id, then an AttributeExternalField would do the job.
Othewise, your code cannot work at least because SELECT returns an object and Set expect a field
Check the iTop code for better examples
Last edit: Vincent @ Combodo 2018-08-08
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I want to customize the /combodo-mail-to-ticket-automation/itop-standard-email-synchro/datamodel.itop-standard-email-synchro.xml file so that the location_id field is written to the ticket.
I inserted the line, but it does not work.
if (MetaModel :: IsValidAttCode (get_class ($ oTicket), 'caller_id'))
{
$ oTicket-> Set ('caller_id', $ oCaller-> GetKey ());
$ oTicket-> Set ('location_id', 'SELECT Location AS l JOIN Person AS p ON p.location_id = l.id WHERE p.email =: email');
}
Please help me!
Is that location supposed to be modified later?
If the location is always the one from the caller id, then an AttributeExternalField would do the job.
Othewise, your code cannot work at least because SELECT returns an object and Set expect a field
Check the iTop code for better examples
Last edit: Vincent @ Combodo 2018-08-08
What would the code look like to return the caller's location?
Try this example, in which I add the caller's telephone number.
https://github.com/jbostoen/iTop-custom-extensions/tree/master/web/extensions/jb-class-request-mgmt-itil-ext-field-phone
Should work for location too if you adapt it.