GitHub integration with SAM Pro - Relating to a User

Adrian W
Kilo Contributor

We've recently configured the GitHub <> ServiceNow Direct integration to pull information on our licensing and accounts. The integration pulls in the github members into the subscription table as we'd expect with the "User Principal Name" set to the username of the GitHub user in question. 

I see there is a client script to prevent the "User Principal Name" from being set to the users ServiceNow username if the entry has been sourced from an integration. 

More often than not a users github name is not in a format which makes it easy to tie it back to an actual user so had hoped that we could populate the User field on the subscription manually to record this relationship. This would be perfect however each time the "SAM - Refresh Github Enterprise Cloud Subscriptions" scheduled job runs, the "User" field is reset/cleared and the relationship is lost.

How is this supposed to work? 

We've also had to implement custom functionality to pull in outside collaborators from our organisation. These users make use of a Github license but aren't pulled in using the integration. 

 

3 REPLIES 3

Scott Halverso1
Mega Guru
Mega Guru

Please upvote my idea....... before ServiceNow kills it due to inactivity.

https://community.servicenow.com/community?id=view_idea&sysparm_idea_id=8286d688dbffdc10fb115583ca961964&sysparm_idea_table=x_snc_com_ideation_idea&sysparm_module_id=enhancement_requests

 

I haven't worked with the GitHub profile yet, only Microsoft and Adobe.  I've had to do work arounds that include a scheduled job to go do the look ups.  Business Rules against the table usually don't work because as ServiceNow inserts them into the subscription table they must be doing some sort of setworkflow(false) in their code that they hide from prying eyes.

Are you working with the GitHub Server or GitHub Cloud Direct Integration Profile?  I can see if I can reverse engineer why it's clearing out the user from the subscription table.  If I had to guess each time it runs the code tries to match user principal name to a user in your user table, if it doesn't find a match it wipes out what was already in the record.  But I would need to test that.  Do all user fields get cleared on each run or just users that the user principal name doesn't tie up to a sys_user record?

Take a look at SAMSaasSubscriptionUtils script include.  In there I see newer code that shows another look up table called samp_discovered_user in a method called createOrUpdateDiscoveredUser. I gotta admit I really miss the simple days of import set data, transforms.  Way faster to troubleshoot.

I've tried to upvote your idea but it looks like ServiceNow has already closed it off.

Interesting to hear that you had to implement some workarounds for Microsoft and Adobe - both of those seemed to work out of the box for us, although we did find that if the Adobe product profiles have been modified (in the Adobe admin console) so they don't have the words "single app" or some combination in them, then ServiceNow wouldn't pick them up.

We are making use of the Github Cloud Direct Integration Profile so won't be able to enforce any naming policy that makes the currrent setup work. Just the users where the user principal name doesn't tie up to a sys_user record get cleared each time. As you say I suspect it's wiping it when it doesn't find a record. 

I think the best option will be to add a new field to the Users form which can hold the value of their GitHub Username (the user should be able to modify this themselves) and then we can have a scheduled job that runs soon after the import to populate the names in the subscriptions table.