Custom form trigger

Forum for users and developers of Bullhorn's Webservices API suite

Moderators: StaffingSupport, s.emmons, BullhornSupport

Post Reply
Terry
User
Posts: 32
Joined: Tue Mar 01, 2011 10:04 am

Custom form trigger

Post by Terry » Thu Oct 06, 2011 10:57 am

I've been trying to get the custom form triggers to work.

when i edit a candidate a request is made to http://mydomain/test
which is a .ascx asp.net C# page

i've got some problems with sending a JSON format string back to bullhorn and i can't find out what i am doing wrong.

after my business logics i try to send the answer to bullhorn back with this code:
Response.ContentType = "application/json";
Response.Write("{ 'result' : true };");

but then i receive this error:
Error calling remote trigger.
'An error occurred in the handler function. (Expected ';')'

where should i add the additional ; ???

i also changed the string a bit to see if i could any more information, but mostly is gives this error back:
Error calling remote trigger.
'An error occurred in the handler function. (Syntax error)'

Terry
User
Posts: 32
Joined: Tue Mar 01, 2011 10:04 am

Re: Custom form trigger

Post by Terry » Mon Oct 10, 2011 6:11 am

Nobody??

DAC84
User
Posts: 1
Joined: Mon Oct 17, 2011 9:00 am

Re: Custom form trigger

Post by DAC84 » Mon Oct 17, 2011 9:02 am

The JSON response is incorrectly formatted. You need to use double quotes for the name/string and also lose the semi-colon at the end like so:

Code: Select all

{"result": true}

Terry
User
Posts: 32
Joined: Tue Mar 01, 2011 10:04 am

Re: Custom form trigger

Post by Terry » Thu Jan 19, 2012 9:03 am

It has been i while, but I'm currently working on the custom form triggers again.

I'm still not able to get this working.

Can someone provide me some C# code to produce a valid JSON response that returns "result : true" ??

Alliance
User
Posts: 40
Joined: Mon Feb 18, 2013 12:16 pm

Re: Custom form trigger

Post by Alliance » Mon Apr 29, 2013 11:43 am

Terry,

I ran across the same error message as you: An error occurred in the handler function. (Expected ';')
The way I fixed it was by wrapping the entire JSON string in parenthesis.

Code: Select all

{"result":false,"error":"here is an error msg"}   // this DOESN'T work

({"result":false,"error":"here is an error msg"})  // add parenthesis, this WORKS

So for the PHP users out there it would look like:

Code: Select all

// create return array structure and encode it in JSON format
$ret = json_encode(array(
    "result" => false,
    "error" => "here is an error msg"
));

// add parenthesis around the JSON string and print it
echo("($ret)");

Hope that helps.

Post Reply