Values aren't saving in the module - replace function in set multiple variables

I have tried 10 times to update these values, copy/pasted, manually typed-in, cloned the module in another scenario, tried a few things, for some reason they revert back to some random numbers I’ve never inputed. I keep inputting this in the replace function, and the system reverts back to what you see in the screenshot. Weird!

Rowan - 164830
Esther - 1577843822841300354
Bec - 1156042623685756565
Louise - 1364002560091883450
Rina - 167173
Luke - 1346247432257668143
Natalie - 143699

Hi Matteo,

Let’s see if we can break this down together, I understand how frustrating it can be sometimes :sweat_smile:

If I understand correctly, you want to set multiple variables, not just one, right?

Do all these people need to be in the same variable? If yes - ignore this question

If not - you should click for each variable on ‘Add item’.

Furthermore, it’s strange that your output is not doing what you want, but with this many replace functions nested into each other, a mistake is not far away (talking from experience here).

Can you by any chance, show a screenshot of your mapped variables (practitioner and starts_at) before they enter the scenario? I am curious what the type of the variables is, especially the practitioner one.

thanks for your reply! this is what I get in before:

    {
        "starts_at": "2025-11-11T23:30:00Z",
        "practitioner": {
            "links": {
                "self": "https://api.au1.cliniko.com/v1/practitioners/167173"
            }

I will have to replace the practitioner ID with their name so it shows in the report.

It’s strange because it just reformats by values, never happened before.

Hi Matteo, thank you for the Loom, that really explains a lot.

This is really strange behavior, in this way, you cannot test whether your function is right (I do believe it’s right)

This is something for the Make technical team I believe, as I also do not understand why your correct ID’s do not save.

@Misha-Inactive, can you take a look at this by any chance?

1 Like

Hello there @Matteo_Giordano :waving_hand:

So I spoke to our Engineering team about this issue and they told me this:

When working with very large numbers (like IDs) inside functions, they might get rounded when you save a module. The root of this issue is that the number exceeds the MAX_SAFE_INTEGER value in JS.
Don’t worry, majority of these IDs can be handled as strings, and you can ensure this by adding a letter to the start or end. Then you can use replace to remove the letter:
image
This will ensure the ID is preserved correctly when you save the function, as it will be of String type instead of Number.

Let me know if it does the trick for you! :smiley:

2 Likes

Thank you Vendy! Makes complete sense!

1 Like