Converting values

Hello everyone,

Could you please help me with this case that makes me desperate?

I want to pass some values from one multi-choice field from PipeDrive to another multiple-choice field in Jira. The mapping is below.
“117”: “10249”,
“118”: “10250”,
“119”: “10251”,
“120”: “10252”,
“121”: “10253”

I am able to pass the data in the Jira accepted format below, but I can not translate the PD values (first column) to Jira acceptable values (second column).

“customfield_10165”: [
{
“id”: “”
},
{
“id”: “”
}

For that, I used this formula inside Jira module, but I think the get does not work at all since “entityTypeMapping” is basically the mapping table above:
{{map(1.c1379e69768dceb82b1a83e794cec036d0f01b30; “id”; get(7.entityTypeMapping; trim(“id”)))}}

I tried iterator + switch, but it only translates the first value found in the array.
I was trying to find any help online, using Perplexity and ChatGPT, but nothing really helped.

Any idea how to convert/translate all the values from the array? Is it possible at all?

Thank you so much!

Welcome to the Make community!

To do this, you can use the built-in function toArray

{{ toArray(collection) }}

For more information, the function’s documentation can be found in the Help Centre. You should also complete the tutorials in the Make Academy.

Hope this helps! Let me know if there are any further questions or issues.

@samliew

P.S.: Investing some effort into the Make Academy will save you lots of time and frustration using Make.

Hello Samliew, thanks for your prompt reply!

Does it mean that I should covert the mapping to array using “toArray(collection)” inside the get function?

I’m not sure how your scenario actually looks like.

For further assistance, please provide the following:

1. Relevant Screenshots

Could you please share screenshots of your full scenario? Also include screenshots of any error messages, module settings (fields), relevant filter settings (conditions), and module output bundles. We need to see what you’re working with to give you the best advice.

You can upload images here using the Upload icon in the text editor:

We would appreciate it if you could upload screenshots here instead of linking to them outside of the forum. This allows us to zoom in on the image when clicked, and prevent tracking cookies from third-party websites.

2. Scenario Blueprint

Please export the scenario blueprint. Providing your scenario blueprint file will allow others to quickly recreate and see how you have set up the mappings in each module, and also allows us take screenshots or provide module exports of any solutions we have for you in return - this would greatly benefit you in implementing our suggestions as you can simply paste module exports back into your scenario editor!

To export your scenario blueprint, click the three dots at the bottom of the editor then choose ‘Export Blueprint’.

You can upload the file here by clicking on this button:

3. Output Bundles of Modules

Please provide the output bundles of each of the relevant modules by running the scenario (you can also get this without re-running your scenario from the History tab).

Click on the white speech bubbles on the top-right of each module and select “Download input/output bundles”.

A. Upload as a Text File

Save each bundle contents in a plain text editor (without formatting) as a bundle.txt file.

You can upload the file here by clicking on this button:

B. Insert as Formatted Code Block

If you are unable to upload files on this forum, alternatively you can paste the formatted bundles.
These are the two ways to format text so that it won’t be modified by the forum:

  • Method 1: Type code block manually

    Add three backticks ``` before and after the content/bundle, like this:

    ```
    content goes here
    ```

  • Method 2. Highlight and click the format button in the editor

Providing the input/output bundles will allow others to replicate what is going on in the scenario, especially if there are complex data structures (nested arrays and collections) or if external services are involved.

Sharing these details will make it easier for others to assist you. Thanks!

@samliew

Hi Samliew,

the flow works fine, the only issue is really with the translation/conversion of the values coming from one system to another.

Pipedrive values sent are below (Output bundle):

 "c1379e69768dceb82b1a83e794cec036d0f01b30": [
            {
                "id": "117",
                "label": "option1"
            },
            {
                "id": "118",
                "label": "option2"
            },
            {
                "id": "119",
                "label": "option3"
            }
        ],

values coming to Jira (Input bundle):

     "customfield_10165": [
                "117",
                "118",
                "119"
            ]

while Jira expects these translated values instead:

     "customfield_10165": [
                "10249",
                "10250",
                "10251"
            ]

I am struggling with creating the translation/conversion.

blueprint_anonymised.json (160.0 KB)

Thank you for your help!

Hello @samliew,

Do you please have any idea how to get the translation of values working?

Thank you again!

I’ll need screenshots of each module too to further advise.

I think you can use an if function or switch module.

Hope this helps! Let me know if there are any further questions or issues.

@samliew

P.S.: Investing some effort into the Make Academy will save you lots of time and frustration using Make.

Hi @samliew,

Please see all the relevant modules and their fields below:



About the switch module, I tried iterator + switch, but it only translates the first value found in the array even if multiple of them are coming.

I was also thinking about using IF, but I do not know how to structure/map the expression.

Please let me know if you need anything more from my end.

Thank you again!

Looks like you should use a Parse JSON module instead if you want to convert JSON into a variable.

e.g.: (paste this into the field)

{
  "mappings": [
    { "id": 117, "value": "10249" },
    { "id": 118, "value": "10250" },
    { "id": 119, "value": "10251" },
    { "id": 120, "value": "10252" },
    { "id": 121, "value": "10253" }
  ]
}

Then you can do something like this:

e.g.: (paste this into the field)

{{ first(map(2.mappings; "value"; "id"; 1.entity_type_id )) }}

Hope this helps! Let me know if there are any further questions or issues.

@samliew

P.S.: Investing some effort into the Make Academy will save you lots of time and frustration using Make.

2 Likes

It is working now. For our purposes, I just removed first() and all is well. Thank you so much @samliew!

1 Like