logo

NJP

How to populate a Custom 'Last Logged in User' Field using the JAMF Service Graph Connector

New article articles in ServiceNow Community · Mar 16, 2026 · article

How to populate a Custom 'Last Logged in User' Field using the JAMF Service Graph Connector

 

This Article describes how to populate a Custom  Last Logged in User  Field in the  Computer CI Class using the JAMF Service Graph Connector by f o llowing the below steps:

 

  1. Create a* JAMF Extension Attribute(EA) for capturing **Last logged in User*  in the JAMF Backend
  2. Ensure that a Valid SG-JAMF Computers  Import Set is selected in the the I ntegrationHub ETL Tool
  3. Create a new Last Logged in User  Transform in the Parent Object using the I ntegrationHub ETL Tool
  4. Create a new Last Logged in User  Transform in the Nested Hardware Child**  Object using the I ntegrationHub ETL** Tool
  5. Map the new Last Logged in User  Transform Output Field to your Custom Last Logged in User Field in the Target Computer CI using the I ntegrationHub ETL Tool

 

JAMF Backend

 

1. Create a* JAMF Extension Attribute(EA) for capturing **Last logged in User*  in the JAMF Backend

 

Create a* JAMF Extension Attribute(EA) for capturing **Last logged in User*  in the JAMF Backend. (Please refer to this Last Logged in User Extension Attribute Community Blog for a sample BASH Script for creating this Last logged in User EA in the JAMF Backend)

 

An e.g. LastLoggedInUser Extension Attribute will be added to the List of  Extension Attributes that are included in the SG-JAMF Computers Source Feed.  The below Screenshot shows 1 of the SG-JAMF Objects (object[1]) that are ingested by the JAMF Service Graph Connector via the  SG-JAMF Computers Scheduled Import Job. The Nested extension_attributes Child Object in the Parent object[1] Object  is expanded to show the List of Extension Attributes  (10 in total) that is included in this Nested extension_attributes  Child Object. An e.g.  LastLoggedInUser Extension Attribute will be included in this List of  Extension Attributes when a JAMF Extension Attribute(EA) for capturing Last logged in User  in the JAMF Backend is enabled.

 

AnneMarieDuff_0-1773670794008.png

 

 

IntegrationHub ETL Tool

 

  1. Ensure that a Valid SG-JAMF Computers  Import Set is selected in the the I ntegrationHub ETL Tool

 

(i)  Launch the I ntegrationHub ETL Tool

(ii) Navigate to the SG-Jamf CMDB Application shown in the CMDB Application list

(iii) Open the  SG-JAMF Computers Transform Definition displayed under the  SG-Jamf CMDB Application

(iv) Navigate to the 1st 1 . Specify Basic Details step and click on the  Import Source Data and Provide Basic Details  link to bring up the  Provide Basic Information for the ETL Transform Map Screen

(v) Ensure that the Sample Import Set Field is populated with a valid SG-JAMF Computers Import Set. The screenshot below shows the  Provide Basic Information for the ETL Transform Map Screen with the Sample Import Set Field being populated with a  SG-JAMF Computers ISET0148400 Import Set.

 

AnneMarieDuff_0-1773674704110.png

(vi) Click on the Save Pushbutton on this Screen

 

N.B.  It is important to click  Save  on this Screen. This populates the Import Set Field in the SG-JAMF Computers   Application Feed  Record in the Template States[sn_int_studio_template_state] **Table. The data from the Import Set  associated with the  SG-JAMF Computers   Application Feed  Record is the data that is used in the follow on  2. Prepare Source Data for Mapping & 3. Map Data to CMDB and Add Relationships** IH-ETL Steps.

 

3.  Create a new Last Logged in User  Transform in the Parent Object using the I ntegrationHub ETL Tool

 

This step involves creating a new  Last Logged in User  Transform in the Parent Object for extracting the data from the  LastLoggedInUser  Extension Attribute that will have been included in the List of  Extension Attributes referenced in the 1. Create a* JAMF Extension Attribute(EA) for capturing **Last logged in User*  in the JAMF Backend step.

 

(i)  Navigate to the 2nd  2. Prepare Source Data for Mapping Step

(ii) Click on the Preview and Prepare Data link to bring up the Preview and Prepare Data Screen populated with the 1st 10 Rows of data from the Import Set specified in the Sample Import Set Field in (v) of the previous 2. Ensure that a Valid SG-JAMF Computers  Import Set is selected in the the I ntegrationHub ETL Tool step.

 

The screenshot below shows the Preview and Prepare Data Screen with data from the  SG-JAMF Computers ISET0148400 Import Set. The extension_attributes_json Transform Output Field, highlighted in the screenshot, will be the Input Column to the new Last Logged in User Transform that you will be creating.

 

 

ext_json.PNG

 

 

(iii) Click on the object Pill in the in the Left Hand Nested Data Structure Pane to ensure that you are creating the New Transform in the Parent Object Level

(iv) Click on the New Transform Pushbutton on the  Preview and Prepare Data  screen and select the Use Source Column option from the Pulldown Menu that is displayed.

(v)  Populate the following fields in the New Transform Screen that gets displayed:

 

Transform Type:   Multi Input Script

Input Column 1: extension_attributes_json

Output Column Name: last_logged_in_user_parent_object

Script:

 

(function(batch, output) {

   for (var i = 0; i < batch.length; i++) {

      var input = batch[i].input; // Value of the input columns concatenated with '|'.

    // Access input column values by their names, ex: batch[i].column_name

    // In order to access columns containing multiple parts concatenated by a dot, use bracket notation ex. batch[i]['prefix_name.column_name']

    // Add your code here.

    // Set each output element below

    //output[i] = output_variable_name;

    var obj=global.JSON.parse(input);

    var outputValue = "";

    var ExtAttrName = "";

    for (var j=0; j < obj.length; j++){

       ExtAttrName = obj[j].name;

       if (ExtAttrName == " LastLoggedInUser") {

           outputValue = obj[j].values;

       }

   }

   output[i] = outputValue;

   }

})(batch, output);

 

Note: The var obj=global.JSON.parse(input); line of code deserializes the  extension_attributes_json JSON string into a JavaScript object that is a collection of Extension Attribute Objects. The for loop is iterating over this collection until you get to the Last Logged in User Extension Attribute e.g. LastLoggedInUser. If the  Last Logged in User Extension Attribute is found then its value is saved to  last_logged_in_user_parent_object Output Column (outputValue = obj[j].values;)

 

(vi) Click on the Apply Pushbutton on the New Transform Screen to save your new  last_logged_in_user_parent_object Transform. You should see a new last_logged_in_user_parent_object Transform Column being displayed in the Preview and Prepare Data Screen like the one shown in the below screenshot. 

 

You should see  Last Logged In User  data displayed in the  last_logged_in_user_parent_object Transform Column for Computers whose  Last Logged In User Attribute is populated in the JAMF Backend. (The below screenshot shows all Blanks in the  last_logged_in_user_parent_object Transform Column because a JAMF Extension Attribute(EA) for capturing Last logged in User  was not setup in the JAMF Backend that I was testing with).

 

 

ext_transform2.PNG

 

 

 

4.  Create a new Last Logged in User  Transform in the Nested Hardware Child**  Object using the I ntegrationHub ETL** Tool

 

There is a limitation with the IntegrationHub ETL Tool where, in the  3. Map Data to CMDB and Add Relationships IH-ETL Step, it is not possible to Map from a Transform Output Field in the Parent Object Level to a Target Field in a Nested Child Object like e.g. Hardware. If you want to Map from a  Transform Output Field in the Parent Object Level to a Target Field in a Nested e.g. Hardware Child Object  you will need to copy the contents of the Transform Output Field in the Parent Object Level to a new Transform Output Field in the Nested e.g. Hardware Child Object  that can then be mapped to the  Target Field in the  Nested e.g. Hardware Child Object.

 

This step involves creating a New Transform to Copy the contents of the l ast_logged_in_user_parent_object Transform Output Field in the Parent Object Level to a new last_logged_in_user Transform Output Field i n the Nested   Hardware Child Object Level. 

 

(i) Click on 1 of the Objects  e.g. Object[1] in the Left Hand Nested Data Structure Pane of the  Preview and Prepare Data Screen to show the below list of Nested Child Objects that it contains:

 

- general

- software

- extension attributes

- location

- hardware

 

(ii) Click on the Nested Hardware Child Object Pill _- You are creating the New Transform at the Nested Hardware Child Level _

(iii) Click on the New Transform Pushbutton on the  Preview and Prepare Data  screen and select the Use Source Column option from the Pulldown Menu that is displayed.

(iv)  Populate the following fields in the New Transform Screen that gets displayed:

 

Transform Type:  Copy

Input Column:  last_logged_in_user_parent_object

Output Column Name 1: last_logged_in_user

 

(vi) Click on the Apply Pushbutton on the New Transform Screen to save your new  last_logged_in_user  Transform. You should see a new l** ast_logged_in_user  Transform Column being displayed in the Preview and Prepare Data Screen** like the one shown in the below screenshot. 

 

Copy_transform.PNG

 

 

5.  Map the new Last Logged in User  Transform Output Field to your Custom Last Logged in User Field in the Target Computer CI using the I ntegrationHub ETL Tool

 

You will be mapping the new Last Logged in User Transform Output Field that you created in the above Step to your Custom Last Logged in User Field in your Target Computer CI

 

(i)  Navigate to the 3rd  3. Map Data to CMDB and Add Relationships  Step in the IntegrationHub ETL Tool

(ii) Click on the Select CMDB Classes to Map Source Data  link to bring up the  Select CMDB Classes to Map Source Data  Screen like the one shown in the below screenshot. You will be editing the Computer 1  Class Mapping.

 

Step 3.PNG

 

 

(iii) Click on the Edit Mapping Pushbutton shown on the  Select CMDB Classes to Map Source Data**   Screen to bring up the Map to Computer 1 - Map to CMDB** screen like the one shown in the below screenshot.

 

Map Screen.PNG

 

(iv) Click on the Add Attribute Pushbutton to bring up the Add Attribute Screen

(v) Select your Custom Last Logged in User Attribute and click on the Save Pushbutton to be brought back to the  Map to Computer 1 - Map to CMDB screen. You should see your Custom  Last Logged in User Attribute displayed on this screen.  The screenshot below shows our Custom Last Logged in User Attribute being displayed on this screen after it was added.

 

Map_LU.PNG

 

(vi) Navigate to the Nested hardware Child Object in the Right Hand Data Pane

(vii) Drag the last_logged_in_user Tranform Output Field listed under the  hardware Child Object to the Custom  Last Logged in User Target Field that you added in the above step.

 

The screenshot below shows our Custom Last Logged in User Attribute being populated with the last_logged_in_user Transform Output Field that we created in the above 4.  Create a new Last Logged in User  Transform in the Nested Hardware Child**  Object using the I ntegrationHub ETL** Tool Step.

 

Map_last.PNG

 

Notice how From collection:object.hardware is displayed under the Mapping to Computer 1 (cmdb_ci_computer) Heading on the Screen. This is letting you know that the Computer 1 (cmdb_ci_computer) Mapping is encapsulated in the  Nested Hardware Child Object contained in the Parent Object.  You are mapping from the last_logged_in_user Transform Output Field in the Nested Hardware Child Object to the Custom Last Logged In User Attribute in the same Hardware Child Object.

View original source

https://www.servicenow.com/community/cmdb-articles/how-to-populate-a-custom-last-logged-in-user-field-using-the/ta-p/3508644