Integration ServiceNow to GreenHouse

raj12345
Tera Contributor

Hello Developers,

I have requirement Integration ServiceNow to Greenhouse , and Authentication type is Basic authentication.
Client want a way that with password they want basic authentication
Integration - Type - OUTBOUND
Please suggest me best solution which I can implement and close the task.
Thanks 

1 ACCEPTED SOLUTION

Hello @raj12345 

1. Create Outbound REST Message - Here is an example of Dummy Outbound rest message

VishalJaswal_0-1744042673408.png

2. Define the POST HTTP Method: In the content field under HTTP Query parameters you can pass the required attributes with their corresponding variables (these variables can be used to pass the value from ServiceNow)

VishalJaswal_1-1744042712792.png


3. TEST HTTP POST Method: Under Related Links of the POST HTTP Method, click on Auto-generate variables. You will find the related List "Variable Substitutions" to auto-populate these two variables to whom you can assign Test Value as shown below. Now, click Test under Related Links

VishalJaswal_2-1744042815238.png
You will see a successful POST HTTP Response (201)

VishalJaswal_3-1744042874774.png


4. Develop Business Rule: Under Related Links of HTTP POST method, click on "Preview Script Usage" and use in the Script (Under Advanced Tab) of your business rule as shown below:

NOTE: You can modify the filter conditions as per your requirement:

VishalJaswal_4-1744042970549.png



(function executeRule(current, previous /*null when async*/ ) {

    // Add your code here

    // Check if the record has been updated
    if (!previous || current.title !== previous.title || current.name !== previous.name) {
        var title = current.title;
        var name = current.name;

        try {
            var r = new sn_ws.RESTMessageV2('Dummy User Creation', 'Create User');
            r.setStringParameterNoEscape('job', title);
            r.setStringParameterNoEscape('name', name);
            var response = r.execute();
            var responseBody = response.getBody();
            var httpStatus = response.getStatusCode();
            gs.log('VJ1: ' + httpStatus);
            gs.log('VJ1: ' + responseBody);

        } catch (ex) {
            var message = ex.message;
        }
    } else {
        gs.log('VJ1: No updates');
    }

})(current, previous);

 

VishalJaswal_5-1744042992490.png

Use the above learning to implement your solution to Greenhouse.

 


Hope that helps!

View solution in original post

4 REPLIES 4

Dr Atul G- LNG
Tera Patron
Tera Patron

Hi @raj12345 

https://support.greenhouse.io/hc/en-us/articles/360022426351-ServiceNow-integration#:~:text=Connect%....

 

*************************************************************************************************************
If my response proves useful, please indicate its helpfulness by selecting " Accept as Solution" and " Helpful." This action benefits both the community and me.

Regards
Dr. Atul G. - Learn N Grow Together
ServiceNow Techno - Functional Trainer
LinkedIn: https://www.linkedin.com/in/dratulgrover
YouTube: https://www.youtube.com/@LearnNGrowTogetherwithAtulG
Topmate: https://topmate.io/atul_grover_lng [ Connect for 1-1 Session]

****************************************************************************************************************

Vishal Jaswal
Giga Sage

 

Hello @raj12345 

If you are new to ServiceNow outbound Integration then I would suggest to rely on ServiceNow official documentation as much as possible. Such information will help you learn about what HTTP Methods are, what are request and response headers, http query parameters etc.

https://developer.servicenow.com/dev.do#!/learn/learning-plans/xanadu/servicenow_application_develop... 
https://www.servicenow.com/community/developer-articles/outbound-rest-integration/ta-p/2861448 

Pre-requisites before any development:

1. Understand the scope of work/requirement. For example: From ServiceNow to Greenshouse you should be performing these three HTTP methods: Retrieve (GET), create(POST) and update (PUT)

2. Understand the list of various Greenhouse APIs available from it's official documentation.

3. You can always practice a dummy integration in your ServiceNow PDI to get some hands-on experience (shown below)

Step#1. Navigate to System Web Services > Outbound > REST Message and Create an Outbound REST message.

VishalJaswal_18-1742829717928.png

 

 

 


Step#2: While Creating the above, you can select Basic Authentication (as per your requirement) and create a new Basic Authentication credentials. There is no way you can test them within ServiceNow, hence I would advise you to look at the character limit of password field to ensure your password length is captured in the password field.


Step#3: Automatically ServiceNow will add a Default GET HTTP method within the REST Message (under HTTP Methods related list) which you created. So, you can rename it or create similar other HTTP methods available as per your requirement.


Step#4: Test the HTTP method by clicking Test under Related links of the HTTP Method:

VishalJaswal_19-1742829764249.png

 

 

VishalJaswal_20-1742829771457.png

 

 



You may get a response as XML or other format however you may wanna GET the JSON response as it is easier to parse in your script. So, ensure to add HTTP Headers as shown below:

VishalJaswal_23-1742829830306.png

 

 

 


NOTE: always say the HTTP method when you are updating any such field else you will notice a green bar in front of the name in HTTP headers which denotes you haven't saved it.

 

Step#5: Instead of providing the value in the endpoint, learn about providing variable in the endpoint as shown below:



Save and then under related links, click Auto-generate variables and then provide the test value and then click Test again:

VishalJaswal_22-1742829818992.png

 

 

 



VishalJaswal_14-1742829545620.png

 

 


Step#6: Practice scripting - Background script. Under related links of HTTP method, click Preview Script Usage and then copy paste the script/code to background script (System Definition > Scripts - Background). You need to add gs.info before the try block end to print the output as shown below:

VishalJaswal_15-1742829545620.png

 

 


Step#7: Modify the HTTP method and script as shown below to populate the city name via variable instead of hardcoding it. Assume, you have populated city in the sys_user table for yourself and you are the logged in user who is executing this background script.

VishalJaswal_16-1742829545620.png

 

 

VishalJaswal_17-1742829545621.png

 

 


Hope that helps!

Thank you Vishal.


Requirement: Integration of Greenhouse with ServiceNow (Outbound Integration)

We need to integrate Greenhouse with ServiceNow. The scenario is as follows:

  1. In ServiceNow, a user is created from a database (e.g., XY DB), and the user record is displayed as "created by XY".

  2. Our goal is to implement a solution where, every week, the user records created in ServiceNow via XY DB are sent to Greenhouse, and a corresponding user record is created in Greenhouse.

All the integration work needs to be handled on the ServiceNow side, with the data being sent to Greenhouse.

This is exact requirement if possible to Provide me High level solutions.
Thnaks 

Hello @raj12345 

1. Create Outbound REST Message - Here is an example of Dummy Outbound rest message

VishalJaswal_0-1744042673408.png

2. Define the POST HTTP Method: In the content field under HTTP Query parameters you can pass the required attributes with their corresponding variables (these variables can be used to pass the value from ServiceNow)

VishalJaswal_1-1744042712792.png


3. TEST HTTP POST Method: Under Related Links of the POST HTTP Method, click on Auto-generate variables. You will find the related List "Variable Substitutions" to auto-populate these two variables to whom you can assign Test Value as shown below. Now, click Test under Related Links

VishalJaswal_2-1744042815238.png
You will see a successful POST HTTP Response (201)

VishalJaswal_3-1744042874774.png


4. Develop Business Rule: Under Related Links of HTTP POST method, click on "Preview Script Usage" and use in the Script (Under Advanced Tab) of your business rule as shown below:

NOTE: You can modify the filter conditions as per your requirement:

VishalJaswal_4-1744042970549.png



(function executeRule(current, previous /*null when async*/ ) {

    // Add your code here

    // Check if the record has been updated
    if (!previous || current.title !== previous.title || current.name !== previous.name) {
        var title = current.title;
        var name = current.name;

        try {
            var r = new sn_ws.RESTMessageV2('Dummy User Creation', 'Create User');
            r.setStringParameterNoEscape('job', title);
            r.setStringParameterNoEscape('name', name);
            var response = r.execute();
            var responseBody = response.getBody();
            var httpStatus = response.getStatusCode();
            gs.log('VJ1: ' + httpStatus);
            gs.log('VJ1: ' + responseBody);

        } catch (ex) {
            var message = ex.message;
        }
    } else {
        gs.log('VJ1: No updates');
    }

})(current, previous);

 

VishalJaswal_5-1744042992490.png

Use the above learning to implement your solution to Greenhouse.

 


Hope that helps!