Create Function
Go to Setup and open Functions.
![Screen Shot 2021-06-01 at 23.39.43.png 2632](https://files.readme.io/5f41a22-Screen_Shot_2021-06-01_at_23.39.43.png)
Open Functions
On the Functions page click New Function and you should see the following interface to set it up.
![Screen Shot 2021-06-01 at 23.46.03.png 3244](https://files.readme.io/74abafd-Screen_Shot_2021-06-01_at_23.46.03.png)
Add a Name such as DigitalGenius. Next click on the pencil to add some arguments to the function.
![Screen Shot 2021-06-01 at 23.47.51.png 2656](https://files.readme.io/b3f7811-Screen_Shot_2021-06-01_at_23.47.51.png)
Add the following arguments.
![Screen Shot 2021-06-01 at 23.37.43.png 1524](https://files.readme.io/64e3f14-Screen_Shot_2021-06-01_at_23.37.43.png)
After adding the arguments add the following to the script text, but replace FLOW_ID with the ID of your main flow.
// Create a map that holds the values of the new contact that needs to be created
inputs = Map();
inputs.put("Id",ticketId);
inputs.put("Subject",Subject);
inputs.put("Email",Email);
inputs.put("Description",Description);
headers = Map();
headers.put("Content-Type","application/json");
data_info = Map();
data_info.put("action_id","__FLOW_ID__");
data_info.put("inputs",inputs);
response = invokeurl
[
url :"https://flow-server.us.dgdeepai.com/execution"
type :POST
parameters:data_info.toText()
headers:headers
connection:"digitalgenius"
];
info response;
For example if the ID of your main flow is 12345 then add the following:
// Create a map that holds the values of the new contact that needs to be created
inputs = Map();
inputs.put("Id",ticketId);
inputs.put("Subject",Subject);
inputs.put("Email",Email);
inputs.put("Description",Description);
headers = Map();
headers.put("Content-Type","application/json");
data_info = Map();
data_info.put("action_id","12345");
data_info.put("inputs",inputs);
response = invokeurl
[
url :"https://flow-server.us.dgdeepai.com/execution"
type :POST
parameters:data_info.toText()
headers:headers
connection:"digitalgenius"
];
info response;
Save the script and Save the newly created function.
Updated 8 months ago
What’s Next