Ben Paddick Posted November 6, 2019 Share Posted November 6, 2019 I have a scenario where I would like to post text data capture from a client into a Service Request through the API. At present I would like to use either 1) A request custom attribute to store the data Not sure of what Hornbill Service Manager Requests function is best to do this. or 2) A request activity stream entry with a specific type I have successfully done this using "https://api.hornbill.com/apps/com.hornbill.servicemanager/Requests?op=updateReqTimeline" However, once the data is posted I then want to be able to search / find the values via the API For both scenarios above I am not sure of the correct Requests function to do this. Any assistance would be greatly appreciated. Kind Regards Ben Link to comment Share on other sites More sharing options...
Guest Ehsan Posted November 12, 2019 Share Posted November 12, 2019 Hi @Ben Paddick, You can use the Custom columns in a Request to store additional data/information. The options are: h_custom_a, h_custom_b, h_custom_c, h_custom_d, h_custom_e, h_custom_f, h_custom_g, h_custom_h, h_custom_i, h_custom_j, h_custom_k, h_custom_l, h_custom_m, h_custom_n, h_custom_o, h_custom_p, h_custom_q, h_custom_r, h_custom_s, h_custom_t, h_custom_21, h_custom_22, h_custom_23, h_custom_24, h_custom_25, h_custom_26, h_custom_27, h_custom_28, h_custom_29 and h_custom_30. You can update any of or all of the Custom columns via customFields parameter in Requests::update API. https://api.hornbill.com/apps/com.hornbill.servicemanager/Requests?op=update "customFields" requires you to supply a JSON object in form of a string. For example, to update h_custom_a and h_custom_b attributes in a Request, you'll need to build a string as below... {"h_custom_a": "someValueA", "h_custom_b": "someValueB"} If desired, you could then display the Custom attributes within the Details section of Requests. Through the Form Designer (Expand Details section > Click on "Design" button - Ensure that Form Designer role is assigned to your user otherwise you'll not be able to design forms), you can add any of the Custom attributes to the Details section. I would recommend this approach. Hope this helps. Ehsan Link to comment Share on other sites More sharing options...
Ben Paddick Posted November 27, 2019 Author Share Posted November 27, 2019 Ehsan Thanks you so much for these pointers. I will give it a go now. Ben Link to comment Share on other sites More sharing options...
Ben Paddick Posted November 29, 2019 Author Share Posted November 29, 2019 So I have tested the API "update" method Ehsan has kindly suggested. The method accepts the request parameters but does not update the actual details of the SR. I have tried using " requestId" with combination of the following optional parameters "h_summary", "h_description", " h_external_ref_number" and "customFields". Looks like a bug to me as the other request update API mehtods like Hi updateReqTimeline work fine. Maybe an expert like @Steve G can shed some light? Link to comment Share on other sites More sharing options...
Ben Paddick Posted December 3, 2019 Author Share Posted December 3, 2019 Anyone know why I am not able to use the update method to post data? There is no error but no data is saved on request after post. Thanks Link to comment Share on other sites More sharing options...
Ben Paddick Posted January 6, 2020 Author Share Posted January 6, 2020 Hi Hornbill Integration team! @Ehsan @Steve G I am still struggling with the above issue. I am not able to update using op=update. The API staus is ok so it looks to have submitted. Any ideas? Is this working for others? Are there any special permissions? I can update the fields via the GUI using my account. Thanks Ben Link to comment Share on other sites More sharing options...
Guest Ehsan Posted January 6, 2020 Share Posted January 6, 2020 Hi @Ben Paddick, Requests::update API returns 2 Output Parameters, in the event of an error. Are you able to confirm the values that are returned by the API? In order to update a Request, you'll need to have visibility to it. Are you performing this action as an admin or someone who would have rights to access the Request? Could you provide us with an example of the value you're passing to customField input parameter? Link to comment Share on other sites More sharing options...
Ben Paddick Posted January 6, 2020 Author Share Posted January 6, 2020 Hi @Ehsan Thank you for getting back to me. FYI - I am using the Power Shell module to interact with the API. If I test with trying to update "h_external_ref_number" and/or "h_description" I do not get any errors back. These are the values: $xmlmcOutput.status = "ok" $xmlmcOutput.error = NULL $xmlmcOutput.exceptionName = NULL $xmlmcOutput.exceptionDescription = NULL I have cut the script right back to just the following f Add-Param "requestId" "SR00167255" #Add-Param "h_summary" "Summary blah blah again" Add-Param "h_description" "description blah blah again" Add-Param "h_external_ref_number" "1234567" #Add-Param "customFields" "{"h_custom_p": "someValueA"}" # Invoke XMLMC call - Get all Service Request that match search query, output returned as PSObject $xmlmcOutput = Invoke-XMLMC "apps/com.hornbill.servicemanager/Requests" "update" # Read output status if($xmlmcOutput.status -eq "ok") { # "No error returned - here are outputs" "API Call Status : " + $xmlmcOutput.status "APIError Returned : " + $xmlmcOutput.error "API Excption Name : " + $xmlmcOutput.exceptionName "API Excption Description : " + $xmlmcOutput.exceptionDescription } else { "An error was returned - here are outputs" "API Call Status : " + $xmlmcOutput.status "APIError Returned : " + $xmlmcOutput.error "API Excption Name : " + $xmlmcOutput.exceptionName "API Excption Description : " + $xmlmcOutput.exceptionDescription } I am running the connection to the API using an API key for my account. I believe this should therefore have the same permissions as what I do via the GUI? Any further ideas? Does this work for you within your instance? Many thanks Ben Link to comment Share on other sites More sharing options...
Guest Ehsan Posted January 6, 2020 Share Posted January 6, 2020 @Ben Paddick, Set the value of customFields to "{}". Is Description and External Reference Number then updated when invoking the API again? Link to comment Share on other sites More sharing options...
Ben Paddick Posted January 6, 2020 Author Share Posted January 6, 2020 @Ehsan That worked!!! So it seems "customFields" a required field even if just {}? Link to comment Share on other sites More sharing options...
Guest Ehsan Posted January 6, 2020 Share Posted January 6, 2020 @Ben Paddick, Great. I'll update the operation to not require a value to be passed to customFields, as per the API documentation. I'm wondering why exceptionName Output Parameter was not set I suppose the error has did appear in the EspServerService log. Ehsan Link to comment Share on other sites More sharing options...
Ben Paddick Posted January 6, 2020 Author Share Posted January 6, 2020 @Ehsan thanks again for all your help. We are now able to continue developing our solution! Link to comment Share on other sites More sharing options...
Guest Ehsan Posted January 6, 2020 Share Posted January 6, 2020 @Ben Paddick Great . I've also updated Requests::update API to not require customFields parameter to be set, this will be available in the next Service Manager update. Ehsan Link to comment Share on other sites More sharing options...
Guest Paul Alexander Posted February 26, 2021 Share Posted February 26, 2021 Hi @Ehsan Could you please take a look here? We're trying to use the same 'update' API call as Ben was but we ARE trying to update the custom fields (he wasn't!). Any pointers would be great please! Link to comment Share on other sites More sharing options...
Guest Ehsan Posted March 2, 2021 Share Posted March 2, 2021 Hi @Paul Alexander, Sorry about the late reply. I can see you have found a way to address the issue. Ehsan Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now