AnsweredAssumed Answered

How can I use a logic hook to add a relationship?

Question asked by lsackett on Apr 14, 2014
Latest reply on May 21, 2015 by lsackett
Hi all,

I'm still learning my way around logic hooks, and I've been trying to create one that simply adds a relationship between an entry in a custom module with a Task. I have a workflow that creates the task based on a new entry in the custom module - the workflow creates a relationship between the Task and Account, but not between the Task and the custom module.

I've already established the one-to-one relationship in the Studio, I just need to link the two entries together. The relationship name in Studio is shown as tasks_slead_sales_leads_1, using the default Tasks module with the custom module being slead_Sales_Leads (used for different information than the default Leads module). Both are already related to the Accounts module.

The Task ends up being named: "Qualify Lead - [account name]"
The custom Sales Lead is named: "Lead - [account name]"

I'm basically looking for some code that does the following:
if task name starts with "Qualify Lead - " (or if task name equals "Qualify Lead - [account name]")
add relationship with custom Sales Leads module named "Lead - [account name]"