• Instructions to Ask a Question

    Click on the "Ask a Question" button and select the application for which you would like to ask questions.

    We have 5 different products namely - Pabbly Connect, Pabbly Subscription Billing, Pabbly Email Marketing, Pabbly Form Builder, Pabbly Email Verification.

    The turnaround time is 24 hrs (Business Hours - 10.00 AM to 6.00 PM IST, Except Saturday and Sunday). So your kind patience will be highly appreciated!

    🚀🚀Exclusive Discount Offer

    Just in case you're looking for any ongoing offers on Pabbly, you can check the one-time offers listed below. You just need to pay once and use the application forever -
     

    🔥 Pabbly Connect One Time Plan for $249 (🏆Lifetime Access) -  View offer 

    🔥 Pabbly Subscription Billing One Time Plan for $249 (🏆Lifetime Access) - View offer

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?
 

Supreme

Well-known member
Staff member
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.
 

Supreme

Well-known member
Staff member
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