# Query : Adding custom attributes to flows.json (tab/subflow)

**URL:** <https://discourse.nodered.org/t/query-adding-custom-attributes-to-flows-json-tab-subflow/57988>\
**Category:** General\
**Created:** [8 February 2022 14:39 UTC](https://discourse.nodered.org/t/query-adding-custom-attributes-to-flows-json-tab-subflow/57988 "2022-02-08T14:39:30Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![SandeepA](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/sandeepa/32/63225_2.png) [@SandeepA](https://discourse.nodered.org/u/SandeepA)\
**Post date:** [8 February 2022 14:39 UTC](https://discourse.nodered.org/t/query-adding-custom-attributes-to-flows-json-tab-subflow/57988/1 "2022-02-08T14:39:30Z")

</div>

Hi ,

I have a query - If i add some custom attributes to a flow (via. processing flows.json) - attrbutes which i want to use for internal housekeeping ...

example :- All flows where type="tab" or type"subflow" - say - sourceInstanceName, owner.

This will be done via. processing the flows.json on instance 1 of NR1 and deploying to instance 2 of NR via. httpAdmin API.

Query is - so long the attributes are unique - which i know will not come from core - will they be maintained or some internal mechanism will remove them ?

Can these extra attributes cause some functional issues ?

I am not expecting to see these attributes in the editor.

We are trying to assess how to move flows from one env to other and maintain some trackability aspects.

---

<div class="post-metadata">

**Author:** ![knolleary](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/knolleary/32/3_2.png) [@knolleary](https://discourse.nodered.org/u/knolleary)\
**Post date:** [8 February 2022 15:53 UTC](https://discourse.nodered.org/t/query-adding-custom-attributes-to-flows-json-tab-subflow/57988/2 "2022-02-08T15:53:13Z")

</div>

The editor will only export properties it knows about. As soon as you hit deploy in the editor it will strip all of your custom attributes.

Being able to add custom attributes is something that has been in the backlog for a long time - but without any immediate need it has never been looked at in any detail.

---

<div class="post-metadata">

**Author:** ![SandeepA](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/sandeepa/32/63225_2.png) [@SandeepA](https://discourse.nodered.org/u/SandeepA)\
**Post date:** [8 February 2022 16:28 UTC](https://discourse.nodered.org/t/query-adding-custom-attributes-to-flows-json-tab-subflow/57988/3 "2022-02-08T16:28:22Z")

</div>

Thanks Nick.

Our use case is basically being able to trace the flows across environments - and automate some updates and trace what sits where.

So we would have added few attributes to the flows to do this traceability.  
Will wait for future.

---

<div class="post-metadata">

**Author:** ![SandeepA](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/sandeepa/32/63225_2.png) [@SandeepA](https://discourse.nodered.org/u/SandeepA)\
**Post date:** [10 February 2022 18:28 UTC](https://discourse.nodered.org/t/query-adding-custom-attributes-to-flows-json-tab-subflow/57988/4 "2022-02-10T18:28:45Z")

</div>

Hi Nick ,

In connection to this - is it possible for add for core a date attributes on tab and subflows to indicate when this was last modified - create date , last modified date ? So core itself updates . Also if work in user login mode - then last updated by.

Projects versioning etc. needs github integration. Plus as i have understood even then 1 project can be active at a time.

I want to explore an option when syncing environments programmatically to give user a signal that target is newer than source and then he may take a call.

Do let us know. Thanks.

---

<div class="post-metadata">

**Author:** ![UnborN](https://avatars.discourse-cdn.com/v4/letter/u/4491bb/32.png) [@UnborN](https://discourse.nodered.org/u/UnborN)\
**Post date:** [10 February 2022 21:07 UTC](https://discourse.nodered.org/t/query-adding-custom-attributes-to-flows-json-tab-subflow/57988/5 "2022-02-10T21:07:09Z")

</div>

> [@SandeepA](#):
>
> is it possible for add for core a date attributes on tab and subflows to indicate when this was last modified - create date , last modified date ?

here is a silly idea .. maybe you can utilize the `info` attribute of flows, subflows etc to add the additional custom attributes you want.

The info property is the one being populated when you edit the Description  
but you could use that possibly by comma separating your attributes ?  
(last modified, version etc)

**Example :**

![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/a/8/a8d023d30a275736c755f06d260ccb1a23feecc3.png)

**Shows up as :**

```auto
 {
        "id": "616c0e53159c5f07",
        "type": "tab",
        "label": "Flow 2",
        "disabled": false,
        "info": "2022-02-10 22:00:00,1.0.1",
        "env": []
    },
    {
        "id": "2e51e9c7341d0ebe",
        "type": "subflow:faef06365fc96dd3",
        "z": "616c0e53159c5f07",
        "name": "",
        "x": 700,
        "y": 400,
        "wires": [],
        "info": "2022-02-08 04:00:00,2.2.0"
    }

```

kinda hackish i know  
from what i understand you doing this programmatically which is beyond my league  
so i leave you to it

---

<div class="post-metadata">

**Author:** ![SandeepA](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/sandeepa/32/63225_2.png) [@SandeepA](https://discourse.nodered.org/u/SandeepA)\
**Post date:** [10 February 2022 21:12 UTC](https://discourse.nodered.org/t/query-adding-custom-attributes-to-flows-json-tab-subflow/57988/6 "2022-02-10T21:12:12Z")

</div>

I must say thats a hackish idea and a good one.

This means i need to remind every user to do this once he does change. I want the core to do it and then i can "read" it programmatically.

So for a flow/subflow - system itself indicates when it was created , last changed, by whom (if user login enabled) .

Then i can simply have a flow which can compare 2 envs and indicate which is more updated env and leave it to user to take the next call.

---

<div class="post-metadata">

**Author:** ![UnborN](https://avatars.discourse-cdn.com/v4/letter/u/4491bb/32.png) [@UnborN](https://discourse.nodered.org/u/UnborN)\
**Post date:** [10 February 2022 21:22 UTC](https://discourse.nodered.org/t/query-adding-custom-attributes-to-flows-json-tab-subflow/57988/7 "2022-02-10T21:22:08Z")

</div>

> [@SandeepA](#):
>
> This means i need to remind every user to do this once he does change

I was under the impression that you were POSTing/updating flows programmatically/remotly with httpAdmin API. if its the user updating its going to be a tedious process .. but its the only thing that i could think of that gives you the option to tag on as many different attributes you need.

**[EDIT]**  
The same could be done using Environment Variables (which is even cleaner),  
even if you dont use them internally in the flow, you could use them to store some attributes

![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/f/7/f79adbbae5312c767db9b753350bb78d2094052d.png)

![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/d/c/dcd8ece92fac9784aadd613aa77007aa81a4842e.png)

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [11 April 2022 21:22 UTC](https://discourse.nodered.org/t/query-adding-custom-attributes-to-flows-json-tab-subflow/57988/8 "2022-04-11T21:22:53Z")

</div>

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.
