hellohq-io / hellohq.docs

1 stars 0 forks source link

Custom Field only send after manual Save on Projekt Page #165

Closed gielians closed 2 months ago

gielians commented 5 months ago

Describe the bug We have added 4 custom Fields to our Projects, 3 of them are Gettable throu the API right after a Projekt is created in the Web GUI. the 4th one is only Gettable and Puttable after one goes to the Project Page and manually hits "edit" and "save".

To Reproduce Steps to reproduce the behavior: Add a new project Send Get request for Custom Fields (either expand projects or dedicated Get https://api.hqlabs.de/v1/Projects?$expand=CustomFields https://api.hqlabs.de/v1/Projects(3545)/CustomFields

Expected behavior (Response) A clear and concise description of what you expected to happen.

{
    "@odata.context": "http://api.hqlabs.de/v1/$metadata#CustomFields",
    "value": [
        {
            "Name": "Informationen",
            "Value": "",
            "Type": "TextMultiline",
            "Id": 18020,
            "CreatedBy": 0,
            "UpdatedBy": 0,
            "CreatedOn": null,
            "UpdatedOn": null
        },
        {
            "Name": "WeitereGitLabProjekte",
            "Value": "",
            "Type": "TextMultiline",
            "Id": 18043,
            "CreatedBy": 0,
            "UpdatedBy": 0,
            "CreatedOn": null,
            "UpdatedOn": null
        },
        {
            "Name": "GitLabProjektLink",
            "Value": "",
            "Type": "Link",
            "Id": 18044,
            "CreatedBy": 0,
            "UpdatedBy": 0,
            "CreatedOn": null,
            "UpdatedOn": null
        },
        {
            "Name": "Projektordner",
            "Value": "localexplorer:P:\\Aktiv\\131-SEF Kick-o-Mat _ Interlaken-142",
            "Type": "Link",
            "Id": 18045,
            "CreatedBy": 0,
            "UpdatedBy": 0,
            "CreatedOn": null,
            "UpdatedOn": null
        }
    ]
}

Actual Behavior (Response)

{
    "@odata.context": "http://api.hqlabs.de/v1/$metadata#CustomFields",
    "value": [
        {
            "Name": "Informationen",
            "Value": "Allgemeiner Service für item\nWird nach Aufwand abgerechnet",
            "Type": "TextMultiline",
            "Id": 18020,
            "CreatedBy": 0,
            "UpdatedBy": 0,
            "CreatedOn": null,
            "UpdatedOn": null
        },
        {
            "Name": "WeitereGitLabProjekte",
            "Value": "",
            "Type": "TextMultiline",
            "Id": 18043,
            "CreatedBy": 0,
            "UpdatedBy": 0,
            "CreatedOn": null,
            "UpdatedOn": null
        },
        {
            "Name": "GitLabProjektLink",
            "Value": " ",
            "Type": "Link",
            "Id": 18044,
            "CreatedBy": 0,
            "UpdatedBy": 0,
            "CreatedOn": null,
            "UpdatedOn": null
        }
    ]
}

Workaround for now got to every Project Page and hit "Edit" and "Save" (no need to actually edit anything)

Screenshots Config in Admin Panel image (Config is the same as the other "Link" Custom Field)

Environment (please complete the following information):

Additional context The 3 other Custom Fields work as intendet

monderino commented 5 months ago

Hi @gielians,

we will check the behavior. Please can you tell me your helloHQ url.

Best Sven

gielians commented 5 months ago

https://realtime-department.hellohq.io/

monderino commented 5 months ago

Hey @gielians,

Thank you. I will check it and let you know the result.

Best Sven

monderino commented 4 months ago

Hey @gielians,

I have investigated the behavior.
The cause lies in the data management. We save the data of the custom fields in a materialized view to make the data available more quickly. However, this materialized view is only updated if you also enter data in the custom field or if the entity to which the custom field is attached is updated. Unfortunately, adding the custom field does not cause the materialized view to update.

In the end, this means that if the custom field you expect is not included in the result. Then the field has no value.

Unfortunately, we cannot change this behavior.

I hope this will help you a bit to update your logic.

Best Sven

gielians commented 4 months ago

Hi Sven, thanks for the reply, so one more work around it is ;)

  1. https://api.hellohq.io/v1/CustomFieldDefinitions -> GetCustom Field Id by Name
  2. https://api.hellohq.io/v1/Projects(ProjectId)/CustomFields(CustomFieldId) -> Put Custom field

Works