My sincere apology for what should be a very simple question.
Scenario:
I am building a workflow and have a Custom Code module that returns a set of values as the output. I want to use those values further along in the workflow in another custom code module.
In the second module, I have connected the two values I need.
For the life of me, I am unable to determine how to correctly define them inside my custom code.
ChatGPT and copilot say
// Inside Module 2
const MyResultFromModule1 = input.MyMgmtCoID;
But, that generates an error “input” not defined
Hi @JeffBantz
Seams System treats - MyMgmtCoID is the name of the input you connected from Module 1 to Module 2
Assume Module 1 has an output named MyMgmtCoID, and Module 2 needs to access this value
// Inside Module 1
const myMgmtCoID = “123456”; // Example value
return {
MyMgmtCoID: myMgmtCoID
};
// Inside Module 2
const MyResultFromModule1 = input.MyMgmtCoID;
// Use the value from Module 1 in Module 2
console.log(“My Result from Module 1:”, MyResultFromModule1);
Above instance covers - Module 1 sets the value of MyMgmtCoID to “123456”, and Module 2 accesses this value using input.MyMgmtCoID.
When two modules are connected correctly in your workflow.
Module 2 should receive the output MyMgmtCoID from Module 1
Give a try and keep us posted
Hope this helps - Happy to help further!!
Thank you very much and have a great one!
Warm regards
I got the same answer when I asked ChatGPT - but the problem is that inside the Custom Code module in the HubSpot workflows, the error message when I try to use input.MyMgmtCoID is “input is not defined”
Working backwards from the code sample in the custom module, I was able to get it to come in by using const MgmtCoID = event.inputFields[‘MyMgmtCoID’];