Menu ā–¾ ā–“

Attachments Upload Date is always blank

2022-09-12
2024-01-03
  • Karthik Reddy

    Karthik Reddy - 2022-09-12

    When attachments are uploaded to incident manually or through Mail to Ticket Automation, the upload date is always blank. Is this an issue or need to do any configurations.

    Please help.

    Regards,
    Karthik

     
  • Karthik Reddy

    Karthik Reddy - 2022-09-13

    Hi All,

    I have figured this issue and had to modify the M ail to Ticket Automation- Combodo mail synchro extension to set Attachment Created date field as now() and user_id as the email sender. Now I am able to see uploaded date and uploaded by successfully.

    Thanks

     
  • Vincent @ Combodo

    Hi Karthik,
    Can you share with the community how you fixed it, is it similar with my own vision of the possible fix?

    My understanding is that the bug is located in MailInboxBase::AddAttachment method.
    Setting of the "creation_date", "user_id" and "contact_id" are missing.
    There isn't always a "userid", as the sender of an email may not have an iTop User.
    The fix could be done as this method is available in XML, so can be customized/overwritten with an extension, but Combodo should fix it for all users.

    $oAttachment->Set('creation_date', time());
    $oCaller = $this->FindCaller($oEmail);
    if (is_object($oCaller)) { 
         $oAttachment->Set('contact_id', $oCaller->GetKey());
    }
    
     
    šŸ‘
    1
  • Karthik Reddy

    Karthik Reddy - 2022-09-14

    Hi Vincent,

    I fixed it in this file of the extension- datamodel.combodo-email-synchro.xml

    I used this way as Find Caller was returning Person object instead of User for setting User_id. And I used more than one email because of some testing we have multiple test accounts with same email address(not a proper solution) but query picks the first record. But in production this will not have an issue because each account will have unique email address.

    But I got your point on user_id, I need to check on that (what if sender not an itop user). Thanks and will let you know my findings on how it goes.

    $oAttachment->Set('creation_date', time());
                        $oCaller = null;
                        $sContactQuery = 'SELECT User WHERE email = :email';
                        $oSet = new DBObjectSet(DBObjectSearch::FromOQL($sContactQuery), array(), array('email' => $oEmail->sCallerEmail));
    
                        if($oSet->Count()>=1)
                        {                   
                            $oCaller = $oSet->Fetch();
                            }
                        $oAttachment->Set('user_id', $oCaller); 
    
     
  • Karthik Reddy

    Karthik Reddy - 2022-09-14

    Hi Vincent,

    You are right, if sender is not user we don't get the name under user column in attachments tab. Upon trying to change to set contact_id with your mentioned code. I am getting below error so looks like we may have to change attachment object as well as part of the fix.
    ERROR occurred during mail processing : Attempting to set the value on the read-only attribute Attachment::contactid

     
  • Vincent @ Combodo

    In the Attachment class, the contact_id is declared as an External field :-(
    So it explains your error message... and the limitation to specify the person who loaded the attachment, when that person has no User

              <field id="contact_id" xsi:type="AttributeExternalField">
                  <extkey_attcode>user_id</extkey_attcode>
                  <target_attcode>contactid</target_attcode>
                  <dependencies>
                      <attribute id="user_id"></attribute>
                  </dependencies>
              </field>
    
     
  • Pierre Goiffon

    Pierre Goiffon - 2022-09-21

    Combodo internal ref for this problem : N°4081

     
  • Guillaume Lajarige

    Hello,

    This was fixed in iTop 3.1.1-1 which is now available for download here :)

    Take care,
    Guillaume

     
    šŸ‘
    1

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.