AGOL and Cityworks webhooks

535
4
11-29-2022 12:39 PM
AriLukas
Occasional Contributor

I'm not entirely sure if this belongs here but thought I would give it a try...

 

I have taken Esri's citizen problem reporter and used scripts to create service requests in Cityworks (CW). Within CW I have created one webhook that will update a status field on the hosted feature layer in AGOL when it is changed in CW. I am now attempting to create another webhook that will automatically push over any comments made in the Service Request in CW to a 'Notes' field in the AGOL feature layer. However, when I add a comment in CW I receive an error:

     {"error":{"code":400,"message":"Cannot perform operation. Invalid operation parameters.","details":["'features' parameter in invalid","Invalid JSON primitive: ."]}}

The webhook is written as such: 

features=[{attributes:{REPORTID:~~Requestid~~,
{OBJECTID:~~Text1~~,
NOTES:"~~Comments~~"}
}]&f=json

I am very new to webhooks,  so if anyone has any insight it would be greatly appreciated!

  

 

4 Replies
Oliver_Sandoval_e
New Contributor III

Hey @AriLukas , did you ever find out a solution?

0 Kudos
AriLukas
Occasional Contributor

Hey @Oliver_Sandoval_e 

I found more of a workaround as opposed to a solution. I spoke with folks from power engineers, who have intimate knowledge of Cityworks and who we contract to help our organization implement different aspects of CW and this is what we came up with...

The first issue we discovered that the comments that are added in the comments section of Service Requests are actually kept in a separate table and therefore need to be accessed differently. We tried several attempts to to link the comments table so when a comment was added it would automatically update the feature service on AGOL, but were unsuccessful. Due to there not being a webhook that would work when a Service Requests was simply updated we decided to use an existing field in the service request to use for comments meant for citizens that was linked to an Action Event for when service requests had  a status change (see screen shot below). In our case we used a field called ProbLocation which is designed for description of the location but in this case was not being used for that purpose. While this is not ideal, I was able to get comments to come over from CW to AGOL when a service request's status is updated. 

 

AriLukas_0-1673622198844.png

 

Hope this helps.

 

Ari

PatrickForrest1
New Contributor

Hi Ari,

I too am attempting to create SR's in Cityworks when a new case is created in CPR.  Would you have some time to discuss your progress with me?

 

Thanks,

Patrick F

0 Kudos
Oliver_Sandoval_e
New Contributor III

Nice, thanks Ari!

0 Kudos