Good day! Is there any option to automatically update the ticket state when public log is updated? For example, a user updated the public log of a ticket that is in pending state, I want it to automatically moved to assign state.
Thank you!
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
If the ticket was updated through Mail, there is a mailbox configuration field to define the stimulus to apply on ticket update by email.
If the ticket was updated directly in the portal, then you need to code something like this, in an extension
Hi thank you for this, it is very helpful. Tho I have a follow up question. I want to know that the user who updated the public log is the caller. I have this code but it is now working because the GetKey() is not returning an int. Or i am not sure if that is the problem.
if($oPublicLog->GetModifiedEntry('html')!=''){$publicLogUpdates=$this->Get('public_log');if($publicLogUpdates!=null){$publicLogUpdates=$publicLogUpdates->GetAsArray();$lastPublicLogUpdate=reset($publicLogUpdates);$updateAuthorName=$lastPublicLogUpdate['user_login'];//getidofuserwholastpostedinpubliclog$updateAuthorUserID=$lastPublicLogUpdate['user_id'];//convertstringtoint$updateAuthorUserID=intval($updateAuthorUserID);//var_dump($updateAuthorUserID);$sTicketCallerId=$this->Get('caller_id');//var_dump($sTicketCallerId);$oUserAccount=newDBObjectSet(DBObjectSearch::fromOQL("SELECT UserLDAP WHERE contactid=$sTicketCallerId"));//var_dump($oUserAccount);if($oUserAccount->Count()>0){//getpersonidofuseraccount$oUserAccount=$oUserAccount->ToArray();$oUserAccount=reset($oUserAccount);$userAccountId=$oUserAccount->GetKey();var_dump($userAccountId);//var_dump($sTicketCallerId);//thrownewException("updated");if($updateAuthorUserID==$userAccountId){var_dump($updateAuthorUserID);//$this->ApplyStimulus('ev_assign');}}}}
Last edit: Rie Ann 2023-11-30
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I'd recommend to allow the code to see all data, otherwise, the method is executed with the rights of the current user, who is not allowed to see the User class.
$oUserAccount->AllowAllData();
But if you performed the test with an admin user, you can't see the issue.
In which case there must be another error
👍
1
Last edit: Vincent @ Combodo 2023-11-30
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi, thank you so much. This resolve the issue now. However, after successfully assigning, the TTR deadline is now missing. Is there any reason why it is not showing? It just stays blank, I don't think it inherits the value of the previous TTR. Thanks!
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Using OnUpdate, the TTR deadline Stopwatch does not work when updating the ticket from the UserPortal. With AfterUpdate, the TTR deadline is correctly displayed again after a status change from Pending to Assigned!
<methodid="AfterUpdate"_delta="define"><static>false</static><access>protected</access><type>Overload-DBObject</type><code><![CDATA[ protected function AfterUpdate() { parent::AfterUpdate(); if (ContextTag::Check('Portal:itop-portal') && ($this->Get('status') === 'pending')) { $oLog = $this->Get('public_log'); if ($oLog->GetModifiedEntry('html') != '') { $this->ApplyStimulus('ev_assign'); } } }]]></code></method>
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Good day! Is there any option to automatically update the ticket state when public log is updated? For example, a user updated the public log of a ticket that is in pending state, I want it to automatically moved to assign state.
Thank you!
Check out the "apply stimulus". You'll probably be looking for something like "ev_assign" or "ev_reassign".
If the ticket was updated through Mail, there is a mailbox configuration field to define the stimulus to apply on ticket update by email.
If the ticket was updated directly in the portal, then you need to code something like this, in an extension
Hi thank you for this, it is very helpful. Tho I have a follow up question. I want to know that the user who updated the public log is the caller. I have this code but it is now working because the GetKey() is not returning an int. Or i am not sure if that is the problem.
Last edit: Rie Ann 2023-11-30
I'd recommend to allow the code to see all data, otherwise, the method is executed with the rights of the current user, who is not allowed to see the User class.
But if you performed the test with an admin user, you can't see the issue.
In which case there must be another error
Last edit: Vincent @ Combodo 2023-11-30
Hi, thank you so much. This resolve the issue now. However, after successfully assigning, the TTR deadline is now missing. Is there any reason why it is not showing? It just stays blank, I don't think it inherits the value of the previous TTR. Thanks!
Hi, i'm also at this point with TTR. Can someone help or give a tip here? Best regards, Aydin
Using OnUpdate, the TTR deadline Stopwatch does not work when updating the ticket from the UserPortal. With AfterUpdate, the TTR deadline is correctly displayed again after a status change from Pending to Assigned!