Best answer

Access Fields That Have Dynamic Names

  • 28 November 2023
  • 5 replies
  • 59 views

I’m using python code to get calendar appointments so that I can use the output fields in the next step. However, the output is making the date itself a dynamic field. 

So the responses when choosing from the drop-down will be like this for example:

11-29-2023

11-30-2023

12-1-2023

The problem with that is that since they will always be different, I can’t select them because the next time I run the zap, it’ll be new dates. So I’m not even sure how to concatenate them or really do anything at all with the data. Is there a workaround for this? For example using some sort of text merge field instead of the dropdown or doing something with the python code?

Here are some screenshots. Notice how the variables that can be selected and used in the next step are named with the date. So for example if I run this next week, it’ll be new dates, which means they won’t pull in.
 

 

 

 

icon

Best answer by Troy Tessalone 28 November 2023, 17:51

View original

5 replies

Userlevel 7
Badge +14

Hi @bfabiano 

Good question.

Have you tried asking ChatGPT for help with configuring the code?

You’ll want to have the selected dates assigned to named variables. (e.g. Date1, Date2, Date3, etc.)

That way you can map “Date1” which will always be named the same.

Thanks for your response @Troy Tessalone . Unless I’m misunderstanding I think you may be missing the root of the issue. 


Are you saying there is a way to assign the outputs from within the initial get request in Python? I did work with chatgpt to try and reformat the output as a string from within the python code, but I was getting errors saying that it needs to be returned in json. 

The problem is that they are not named Date1, Date2, Date3. They are always named whatever the date is. So for example next week when this zap runs again, that name is completely different. So they don’t pull in.

Userlevel 7
Badge +14

@bfabiano 

In the Code you would need to add logic to assign the first date to be the value of “Date1”, and so on.

Then you will have standardized variables to use in your next Zap steps.

e.g. if the first date returned is X, then Date1 = X, so when you map Date1 in a following Zap action step the value of the mapped variable becomes X.

This is helpful thanks. I was able to get a workable response from playing around with chatgpt where I essentially changed the output to one variable (availability), which should work for my use case. If I run into any other snags I’ll try this out next.

Thanks for the input!

Userlevel 7
Badge +11

That’s great news, @bfabiano! Thanks so much for sharing the alternative solution you found - the Community appreciates it! 😁🎉

Sounds like you’re all set for the moment but do let us know if you run into any further issues or questions at all. In the meantime, happy Zapping! ⚡

Reply