Joshua T M Posted January 19, 2021 Posted January 19, 2021 Hi All, Since Build 2126 smGetRequests no longer returns custom fields, org name and ID or customer name and ID. Can you please confirm why this has occured and what we can do to resolve it? All that is now being returned is the below - "<?xml version=""1.0"" encoding=""utf-8""?> <methodCallResult status=""ok""> <params> <requests>{""row"":[]}</requests> <count>15</count> </params> <flowCodeDebugState> <executionId>298ea10c-d1ad-46ce-a646-2b91b709db1d</executionId> </flowCodeDebugState> </methodCallResult>" Secondly we are attempting to use entityBrowserRecords2 however the documentation does not show an effective example of how to present the parameters required.https://api.hornbill.com/_types/searchColumnType Can we get a plain text or XML example of how to construct one of these? The Open-HB, Add-HB functions mentioned in : Doesn't exist in the espapi_net project. Using the rules for the complex xml type, it should appear as: <searchColumnType column='h_container_id'>126</searchColumnType> However, every time I try to get a column expected/not expected or value does match input error depending upon the formats I try. Any assistance you can offer on the above would be helpful. Please let me know if you require any further information. SR inc - @Stuart Riddell
Victor Posted January 19, 2021 Posted January 19, 2021 @Joshua T M smGetRequests is not intended to be used in integrations. This API was solely designed to work with and for the request list view. As you suggested a much better API is entityBrowseRecords2. For the column type you need the "column" and "value" params. Here is an example of how you can use it for requests: <methodCall service="data" method="entityBrowseRecords2"> <params> <application>com.hornbill.servicemanager</application> <entity>Requests</entity> <matchScope>all</matchScope> <searchFilter> <column>h_pk_reference</column> <value>IN00XXXXXX</value> </searchFilter> </params> </methodCall> https://api.hornbill.com/data/?op=entityBrowseRecords2
Stuart Riddell Posted January 19, 2021 Posted January 19, 2021 Hi Victor, I understand what the final parameter XML should look like. The example below shows what I'm trying to achieve. However, there is nowhere in the documentation to show how it's done using the AddParam() function. <methodCall service="data" method="entityBrowseRecords2"> <params> <application>com.hornbill.servicemanager</application> <entity>Requests</entity> <matchScope>all</matchScope> <searchFilter> <column>h_container_id</column> <value>126</value> </searchFilter> </params> </methodCall> So how do I do it with the AddParam() command? What does the XXXXX need to look like? xmlmc = New HornbillAPI.XmlmcService(InstanceName, ServiceEntryPoint, DavEntryPoint, APIKey) xmlmc.AddParam("application", "com.hornbill.servicemanger") xmlmc.AddParam("entity", "Requests") xmlmc.AddParam("matchScope", "any") xmlmc.AddParam("searchFilter", XXXXXXXX) xmlmc.AddParam("maxResults", "10") ParamatersXML = xmlmc.GetParamsXML (I use this to inspect what the parameters look like before the Invoke) xmlmc.Invoke(Hornbill.Service.Data, "entityBrowseRecords2") I've tried various formats, plain text; XML, JSON etc but they end up getting XML parsed if they contain quotes etc. I've even tried multiple AddParam("searchFilter") just in case but no luck. smGetRequests was perfect. It was simple and returned the results that we needed very quickly. So I'd be grateful to see an example of how to produce the search filter, since we're going to have to use it in multiple places.
Victor Posted January 19, 2021 Posted January 19, 2021 @Stuart Riddell "searchFilter" is not a "param", it's an element, a collection of params. Here is a C# example: Esp.Transport the_transport = new Esp.Transport("", "xmlmc", "dav"); Esp.MethodCall mc = new Esp.MethodCall(the_transport); try { mc.addParam("application", "com.hornbill.servicemanger"); mc.addParam("entity", "Requests"); mc.addParam("matchScope", "any"); Esp.XmlWriter doc = new Esp.XmlWriter(); doc.openElement("searchFilter"); doc.textElement("column", "h_container_id"); doc.textElement("value", 126); doc.textElement("matchType", "all"); doc.closeElement("searchFilter"); mc.addParam("maxResults", 10); mc.invoke("data", "entityBrowseRecords2"); }
RichardD Posted October 16, 2023 Posted October 16, 2023 How would you add two searchFilter elements please? column: h_email_1 value: foo@bar.com matchType: exact and column: h_contact_status value: 0 matchType: exact I have seen some examples for other methods where a param like searchFilter is passed an array of objects with multiple elements as a JSON string but haven't managed to get that to work here. e.g. mc.addParam("searchFilter", "[ { \"column\": \"h_email_1\", \"value\": \"foo@bar.com\", \"column\": \"h_contact_status\": \"0\" }]");
RichardD Posted October 24, 2023 Posted October 24, 2023 To answer my own question (with a little help from Steve G, thanks again) in case someone else stumbles on this thread. The "searchFilter" is unbounded so it's as simple as... xmlmc.AddParam("searchFilter", new List<XmlmcParam>() { new XmlmcParam() { Name = "column", Value = "h_email" }, new XmlmcParam() { Name = "value", Value= email }, new XmlmcParam() { Name = "matchType", Value="exact" } }); xmlmc.AddParam("searchFilter", new List<XmlmcParam>() { new XmlmcParam() { Name = "column", Value = "h_account_status" }, new XmlmcParam() { Name = "value", Value="0" }, new XmlmcParam() { Name = "matchType", Value="exact" } });
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