Hi, I'm still tryna make my integration correctly and now I'm stuck with the question : who is $current_contact$, when I create a comment via REST API.
I want to send all the comments to my handler, where I want to send comments created by Agents to one app and comments created by users(via API) - to another...
It's possible?
There is my request, where I set the user_id of the comment :
Thanks for the answer!
Yeah, but this means I have to create a bunch of users, whom is allowed REST API profile.
And even if I make it, I get the error :
{
"code": 1,
"message": "Error: Portal user is not allowed"
}
So, that's only for privileged users in the system, not for portal users....
Maybe there is an another way to reach out - who is the author of the comment, in payload?
How can I get the author of the comment?
$this->head(public_log) returns only text...
Or only with some "JOIN Condition" in trigger OQL?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
As a work-around: you could add an extra (hidden) field in the class. During your core/update, you also set this field (e.g. to your user ID 3).
As a second step, add the same logic when the ticket is manually updated by an agent in the console - so it's set before it's saved to the database and the trigger is executed. It's possible to list the changes; if it's already set (e.g. this method would also be executed during your API call), it should be ignored. Otherwise it will also be reset to your iTop API user ID rather than the agent ID.
Then in the notification; rely on this field rather than current contact?
👍
1
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
OK, Thank you...Seems like it's the only way to make it. I'll try this one.
I'll set the field = 3, when comment is added and let it empty, when agent will add the comment.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi, I'm still tryna make my integration correctly and now I'm stuck with the question : who is $current_contact$, when I create a comment via REST API.
I want to send all the comments to my handler, where I want to send comments created by Agents to one app and comments created by users(via API) - to another...
It's possible?
There is my request, where I set the user_id of the comment :
In response, I can see, that the owner of the comment is the correct user :
And in web interface - it's showed as a UserId=3 comment.
But, when I set up a webhook with the following payload :
On my handler I see, that the Current_Contact is still my User.Id =1, instead of 3 :
Can someone give me some advice, please?
I'd assume current contact would also be the API user (the one you authenticated with). So that's likely your admin account.
In the webhook, the current contact is then still the API user.
Thanks for the answer!
Yeah, but this means I have to create a bunch of users, whom is allowed REST API profile.
And even if I make it, I get the error :
So, that's only for privileged users in the system, not for portal users....
Maybe there is an another way to reach out - who is the author of the comment, in payload?
How can I get the author of the comment?
$this->head(public_log) returns only text...
Or only with some "JOIN Condition" in trigger OQL?
As a work-around: you could add an extra (hidden) field in the class. During your core/update, you also set this field (e.g. to your user ID 3).
As a second step, add the same logic when the ticket is manually updated by an agent in the console - so it's set before it's saved to the database and the trigger is executed. It's possible to list the changes; if it's already set (e.g. this method would also be executed during your API call), it should be ignored. Otherwise it will also be reset to your iTop API user ID rather than the agent ID.
Then in the notification; rely on this field rather than current contact?
OK, Thank you...Seems like it's the only way to make it. I'll try this one.
I'll set the field = 3, when comment is added and let it empty, when agent will add the comment.