Create Function

Go to Setup and open Functions.

2632

Open Functions

On the Functions page click New Function and you should see the following interface to set it up.

3244

Add a Name such as DigitalGenius. Next click on the pencil to add some arguments to the function.

2656

Add the following arguments.

1524

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.