• Instructions to Ask a Question

    For any assistance, please click the "Ask a Question" button and select the Pabbly product for which you require support.

    We offer seven comprehensive applications designed to help you efficiently manage and grow your business:

    Our support team endeavors to respond within 24 business hours (Monday to Friday, 10:00 AM to 6:00 PM IST). We appreciate your understanding and patience.

    🚀 Exclusive Lifetime Offers 🚀

    We invite you to take advantage of our special one-time payment plans, providing lifetime access to select applications:

    • 🔥 Pabbly Connect — Lifetime Access for $249View Offer
    • 🔥 Pabbly Subscription Billing — Lifetime Access for $249View Offer

    Make a one-time investment and enjoy the advantages of robust business management tools for years to come.

How to accept data in Run Python code from previous workflow steps

Your Task History ID
IjU3NmQwNTZhMDYzMjA0MzY1MjZmNTUzMSI_3D_pc
Isn't there an ability for users to configure their input data from previous steps of the workflow in the code step to run Python code?

I want to get the website entered by the user in the previous step and validate that if matches the specific format. If yes then do something. If no then do something.

Here is the code I have written.

import re

website = input_data["<data from previous step>"]

def validate_website(website):
url_pattern = r'^(https?://)?([a-zA-Z0-9-]+\.){1,}[a-zA-Z]{2,6}(/[a-zA-Z0-9-]*)*/?$'

if re.match(url_pattern, website):
return website
else:
return 'www.google.com'

The main problem lies with
website = input_data["<data from previous step>"]

I tried many different ways to get that as Pabbly documentation is unclear on setting input data.

But nothing is working.

Can you help?
 
P

Pabblymember11

Guest
Hey @adrevel.com

Can you tell us what data you want to validate in your workflow and the name of the application from here the data you want to pass?

Also, you can use applications like Email Verify on the workflow to check for the valid email address and can pick the applications' action step like Get Lead/Contact which can totally check for the availability on your desired application's database.

Furthermore, the Code action phase employs programming, necessitating advanced coding knowledge. Also, note that no technical assistance will be provided for code-related faults. For further details, we strongly advise you to check with the developer or an automation expert who can guide you accordingly and manage everything for you.
 
I agree and I have read that already.
I am not seeking assistance on any code-related fault here, I can handle it at my end as I have sound knowledge of Python Programming.

However, for every integration application, there is a way to get data from previous steps which I wasn't able to locate on either Google or Pabbly's documentation.

For example, in Zapier when I say I want to accept the data from previous steps, they clearly have the ability to set variables in their code step before writing a block and then in a code block, I just have to get that variable using input_data['variable_name'].

I don't intend to compare anything here, it was just an example to convey my point.

I want to validate the website and email that are coming from the Facebook ads lead. In many cases end users put any random values which are not even in the right format and I want to handle that in the workflow using Python code by setting hardcoded values if they enter the wrong data.
 
P

Pabblymember11

Guest
Hey @adrevel.com

Whatever variable you want to pass you can try passing it in the Dictnory or in JSON format to return the data in the response fields.

E.g. -

1685100803064.png
 

bnicholes

Member
@adrevel.com

Were you ever able to figure out how to input data from previous steps into your python code? I am not seeing a clear way of how to get this done. It seems like it should be simple and obvious, but I keep on getting a syntax error.

Thanks,
 
Top