Is conditional execution of custom triggers possible - 02255648

Forum for users and developers of Bullhorn's API service.

Moderators: StaffingSupport, s.emmons, BullhornSupport

Post Reply
sdjukic
User
Posts: 5
Joined: Tue May 24, 2016 4:11 pm

Is conditional execution of custom triggers possible - 02255648

Post by sdjukic » Tue May 24, 2016 4:23 pm

Is there a way to make custom trigger execution conditional? Is there a way that this custom trigger would be implemented so user can click some checkbox or press some button for custom trigger action to execute, and not executed otherwise?

I red all about custom triggers here but I do not see such option: http://developer.bullhorn.com/doc/versi ... s%7C_____4

TedWalters
User
Posts: 7
Joined: Mon Apr 18, 2016 1:25 pm

Re: Is conditional execution of custom triggers possible - 02255648

Post by TedWalters » Wed Jun 01, 2016 2:09 pm

In order to make your custom trigger conditional, all you would need to do is include something similar to the sample code provided:

// Get the cost center variable that was posted to the form trigger
if (isset($_POST["costCenter"])) {
$costCenter = $_POST["costCenter"];
if (validateCostCenter($costCenter)) // a custom function that checks database to verify this is a live cost center.
{
// Successful validation
echo "({ result: true })";
} else {
// Unsuccesful validation
echo "({ result: false, error: \"The cost center you provided is not a valid cost center in the PeopleSoft system.\" })";
}
}

In this case, instead of it checking to see whether or not this is a live cost center, it can check something as simple as whether or not the box is checked, and only include the form trigger code itself within the //Successful validation section. Please let me know if you have any questions, and I will be happy to help!

Thanks,
Ted Walters

Post Reply