PrevPrev Go to previous topic
NextNext Go to next topic
Last Post 08/16/2011 12:22 AM by  Scott Ward
Entity Custom Fields
 4 Replies
AddThis - Bookmarking and Sharing Button
Sort:
You are not authorized to post a reply.
Author Messages
Drew Goodwin
New Member
New Member
Posts:3
Points:5


--
08/12/2011 1:34 AM

    Hi,

    In our HelpMaster installation Sites have a number of custom fields defined. When I load a Site through the API and I access the Site.CustomFields collection I see none of them. If I try to set one of the custom fields using SetTextBoxValue(PKID of the custom field definition, custom field value), then I get an exception - which is understandable as I would imagine SetTextBoxValue() updates the in-memory value of an item in Site.CustomFields.

    Is there something else I need to do to have custom fields returned into the Site object? Or is this not implemented yet and I should go directly to the database?

    Kind regards,
    Drew

     

     

    Scott Ward
    HelpMaster development team
    Helpdesker
    Helpdesker
    Posts:25
    Points:29


    --
    08/15/2011 9:57 PM

    Hi Drew

    I’ve just tried accessing and setting Site Custom fields, and have not have any of the issue you mentioned.
     
    If my test code below doesn’t help you fix your issues can you please post some of your code, mainly the bit where you load the site, access the fields and save it again, And some understanding of what you are trying to achieve with the API could Help us.
     
    Also let us know what the exception is saying when you try to update the custom field,  make sure you are calling the correct Set__Value function, there are 4 control types and only one of the Set__Value methods will work for each control type.
     
     
    The code in Red denotes values specific to my test database only
     
     
    ' Start the Helpmaster API
    Dim strMSG As String
    HMPAPI = New HelpMasterProAPI.Connection ' Instantiate the HMP API
     
    ' This values represent the "staff" To log on to The API as.
    ' This value is used when things like logged by/ Actioned by are explicitly set.
    HMPAPI.LoggedOnUserLink = 5618
     
    ' Set the database connection string
    HMPAPI.DatabaseConnectionString = "Data Source=(local);Initial Catalog=HMP11Test;Integrated Security=SSPI;Application Name=HelpMaster API;"
    strMSG = HMPAPI.StartHelpMasterProAPI() ' Start the API
     
    ' Check for any errors during the startup process.
    ' Any errors will be returned in the string strMSG
    If strMSG <> "" Then
        MsgBox(strMSG)
        HMPAPI.EndHelpMasterProAPI()
        HMPAPI = Nothing
        Exit Sub
    End If
     
     
    ' Load The Site
    Dim mySite As New HelpMasterProAPI.Site
    mySite.Load(612)
     
    ' To List PKIDs of all custom values for Site
    Dim strText As String = ""
    For Each myCustomField As HelpMasterProAPI.CustomField In mySite.CustomFields
       strText += myCustomField.CustomFieldPKID & vbCrLf
    Next myCustomField
    MsgBox(strText)
     
    ' Update a Custom Value For a site
    ' This pkid 5 must be a pkid for a textbox custom field otherwise the appropriate Set__Value function must be called by the Control Type.
    mySite.CustomFields.SetTextBoxValue(5, "123456")
     
    ' Save the Updated Custom Value Back to the Site
    mySite.Save()
     
    mySite.TearDown()
    mySite = Nothing
     
     
    HelpMaster development team.
    Have you seen what's new in v13 yet?
    Drew Goodwin
    New Member
    New Member
    Posts:3
    Points:5


    --
    08/15/2011 11:03 PM

     Hi Scott,

    Thanks for your response. Unfortunately I have run your VB code and get the same result against our database that I was getting with my C# code. When I load up a site that has a number of text box, dropdown box, date and check box custom fields, I get most of the site data, site names, addresses, client links etc, but when I access the CustomFields collection I find it consistently 1 element long where the CustomFieldPKID = 1 and CustomFieldTextBoxValue = "".

    I have written some code that goes straight to the database and can successfully extract the values for these custom fields from tblCustomData_Values_Text for example, and I can also see the custom fields through the standard HMP client. Could there perhaps be an issue with the way the custom fields were created that makes them unavailable to the API now?

    FYI the HelpMasterProAPI version that I am using is 11.0.1.180 and the database I am running against is a v11.0 database that has been upgraded to v11.01.

    Kind regards,
    Drew

    Drew Goodwin
    New Member
    New Member
    Posts:3
    Points:5


    --
    08/15/2011 11:21 PM

     Scott,

    If I run a query like SELECT CustomDataValue FROM dbo.qryCustomData_Site_Text WHERE SitePKID = 1496 AND DefinitionPKID = (select PKID from dbo.qryCustomDataDefinition_Text WHERE EntityType = 2 AND Caption = 'CentreID') against the database I can retrieve the value saved against the site 1496 for custom field CentreID (a simple string of numbers in this instance) and if I open up the site in the HMP client I can see the same string on the Custom tab next to the CentreID label. As mentioned though if I run the following API code:

    ' Connection boiler plate elided
    Dim site As New HelpMasterProAPI.Site
    site.Load(1496)
    Dim strText As String = ""
    For Each myCustomField As HelpMasterProAPI.CustomField In mySite.CustomFields
       strText += myCustomField.CustomFieldPKID & vbCrLf
    Next myCustomField
    MsgBox(strText)
    ' Teardown elided

    I get the string "1" displayed in the message box.

    Kind regards,
    Drew

    Scott Ward
    HelpMaster development team
    Helpdesker
    Helpdesker
    Posts:25
    Points:29


    --
    08/16/2011 12:22 AM
    Hi Drew,
    This behaviour is quite strange, using our test database this all works correctly.

    I'm am logging a HelpMaster Job in to our system for this, so we can track down why this is happening for your database.
    You will recieve an Email with Job reference shortly.
    HelpMaster development team.
    Have you seen what's new in v13 yet?
    You are not authorized to post a reply.


    Configuration Management by Guy in Anything goes with 1 replies I looking people using Helpmaster for Configuration Management (CM) down to the Configuration Item (CI) level. How have you have built your CM tr...

    HelpMaster website update by Rod Weir in Announcements with 0 replies In preparation of the v17 release, the HelpMaster website has had a make-over. The new-look site provide additional information about the capabilit...

    Email tags not working. by David C in Email Manager with 1 replies Hi, I recently got the email service working and was poking around other areas (new to the software) and for some reason email template tags are not ...

    Knowledge Base improvements by Rod Weir in Wishlist with 0 replies We've recently received some requests to improve the knowledge base feature in HelpMaster via our support channel.  I'm re-posting some of the id...

    Triggered Events on Assets by Josh B in Priority Manager and Triggered Events with 2 replies I want to set up some automation for Assets but I need some help.  Rather than sending a support email through, I thought I'd share the developme...

    Automatically unsuspending jobs by Josh B in Priority Manager and Triggered Events with 2 replies Today I implemented some Priority Manager profiles to automate the unsuspending of jobs once a target date is reached.  Thought I'd share... ...

    Use PowerBI for HelpMaster dashboards by Rod Weir in Reports and reporting with 0 replies Microsoft PowerBI is a powerful dashboard tool that allows you to quickly create dashboards based on your helpdesk / service-desk data.  With an...

    Template catalogs by Rod Weir in HelpMaster development with 0 replies Another great new feature of v17 is "Template Catalogs".  Template catalogs are groupings of Job Templates and Knowledge Base articles.  E...

    Spotlight on workflow object - Log new job by Rod Weir in HelpMaster development with 4 replies The next version of HelpMaster has a radically improved workflow system with lots of new workflow objects.  One of the most powerful and useful i...

    Clients can now link to multiple sites by Rod Weir in HelpMaster development with 0 replies Another handy feature of HelpMaster v17 is the ability to link clients to multiple sites.  Previously clients could only be linked to 1 site only...

    RE: Configuration Management by Rod Weir in Anything goes Hi Guy, Once assets are in the system, they are generally linked to other entities (Clients, Sites, Knowledge Base articles, and even themselves).&...

    Configuration Management by Guy in Anything goes I looking people using Helpmaster for Configuration Management (CM) down to the Configuration Item (CI) level. How have you have built your CM tr...

    HelpMaster website update by Rod Weir in Announcements In preparation of the v17 release, the HelpMaster website has had a make-over. The new-look site provide additional information about the capabilit...

    RE: Spotlight on workflow object - Log new job by Rod Weir in HelpMaster development Hi Josh, Thanks again for the feedback and ideas. The new workflow designing has some of these things already.  Keyboard support has been i...

    RE: Spotlight on workflow object - Log new job by Josh B in HelpMaster development Couple more ideas for workflows. First, I want to point out that the pattern I have adopted is to have an message box present instructions then an act...

    RE: Email tags not working. by Rod Weir in Email Manager Hi David, Thanks for the information. Can you tell us what version of HelpMaster you're using, as well as what module is sending the email (Deskto...

    Email tags not working. by David C in Email Manager Hi, I recently got the email service working and was poking around other areas (new to the software) and for some reason email template tags are not ...

    RE: Spotlight on workflow object - Log new job by Rod Weir in HelpMaster development Hi Josh, Thanks for you post – some good ideas and feedback here as usual. Your idea of having a pre-job workflow is something we’ve alr...

    RE: Spotlight on workflow object - Log new job by Josh B in HelpMaster development Over the past couple of days I have been looking at workflows in v16.10.17.4 (without the changes mentioned above). We are attempting to map one of o...

    RE: How to improve SQL Server performance and thus HelpMaster's too. by Josh B in HelpMaster SQL Server database Thanks for the tip about business time. Makes total sense. Can you elaborate on anything we can do in terms of database maintenance, indexing or o...