How to export fields from related modules

Corteza version: 2023.3.1

Is there a way to export fields from a related module to CSV or JSON?

For example, the CRM App has a module Accounts with a relation to the module Compaigns. I can add Compaigns to the Accounts record list view and it works fine. But when i click on export, only fields from the Accounts module are available. I cannot export anything from Compaigns.
Basically i thought that fields available in the list view, are also available for export.

I understand that this particular example refers to a 1-many relationship in Compaigns. But it seems that this is not possible in general, if the field type is Record selector.

The use case is to work with exported data in an external marketing application, which requires theses related fields. There are other use cases and examples, but this one describes the requirement very well.

I found this 14 month old post How to export to csv including linked records, which seems quite similar.

I also checked the roadmap , but found no mention.

We are evaluating a Corteza as a new CRM system and so far we like the entire stack (Go API Backend, dedicated frontend in Vue, Low-code approach, task-runner and message queue). But unfortunately if exports cannot have related data, then this really limits the functionallity, at least for us.

If this feature is currently not implemented, i would kindly ask:

  • Is there a workaround?
  • Is this something on the roadmap for an upcoming release?

Thank you for reading

Wolfgang

It’s odd that using the export from the UI results in a file where the related fields are blank. Just tested myself and I see what you see, related records aren’t showing up.

If you want a solution that involves automation then you can use the api and it’ll return all records to include the related fields

GET request on
http://yoururl/api/compose/namespace/330445123765016451/module/337426787956710811/record/

330445123765016451 = your namespace id
337426787956710811 = module id

Thank you for the API example. This would be a workaround.
However i am missing the bit to actually login to the the API ( i am somehow familiar with REST and JWT).

I have created a new Auth Client in the Admin Area with grant type = client_credential and assigned my user in Impersonate User.

Then i looked at Accessing Corteza and found:

curl -X POST $CORTEZA_URL/auth/oauth2/token \
     -d grant_type=client_credentials \
     -d scope=api \
     -u <client id>:<client secret>
curl -X POST $CORTEZA_URL/auth/oauth2/token \
     -d grant_type=client_credentials \
     -d scope=api \
     -u 229978909641277628:sMVVcYpXE6bOUm6gG0sJGKmDOzEgkYyhvKyrmcU9fGY8M4GhLd90lThZDxUUFLC9

However, I don’t know where to get the “client_id” and the “client_credentials”.

I also looked at the Rest-API definition, but did not see that endpoint.

So any hint or example of how to authenticate using curl would be helpful.

I ran into a similar challenge. I had to get the jwt from the container itself because I wasn’t able to get the client creds from the UI. I have a thread regarding it below.

Once you generate the jwt then the curl will work.

Here is an example request for getting records for a module

curl --location ‘http://mycortezaurl/api/compose/namespace/330499999955999451/module/337271999073999403/record/?limit=250’
–header ‘Accept: application/json’
–header ‘Authorization: Bearer eyJh_mytoken’

Daniel, thank you so much. I will give it a try and come back.

1 Like

I gave it a try and it works. For example, from accounts i get the campaignids like this:

 {
            "name": "CampaignId",
            "value": "338188092605267971"
          },
          {
            "name": "CampaignId",
            "value": "338836422196789251"
          },

However, i would like to get also related fields like the campaign name. I guess this requires a lookup to the compaigns module, or is there an API option to include details from related fields?

I have a similar need but I don’t think there is an out of the box way of showing a different field besides the recordID, like showing a name field instead.

I’m going to use the API to bring in the lookups first and basically swap out the ID’s with whatever field I really want, typically a Name field, to meet my requirements.

Yes i am going to do something similar. Would be great if the standard export would cover this.

1 Like