Print this page

By passing the mandatory TimeZoneSidKey mapping in Identity Connect

Knowledge Article Number 000198673
Description Right now TimeZoneSidKey mapping is mandatory. Is there a way to do the sync by leaving it blank.  If  we sync existing users who are in a different timezone than the  default then theirs is overwritten which causes all of their times to be wrong. 
Resolution This can be accomplished by customizing the 'salesforceIdConnect/conf/sync.json' file as follows: 

Backup the existong conf/sync.json file to an alternate directory 
Edit the conf/sync.json file, there is no need to shutdown the instance 
Locate the existing onUpdate trigger within the file, it will looking something like the following: 
"onUpdate" : { 
"type" : "text/javascript", 
"source" : "var profileQuery = openidm.query('managed/Profile', {'_queryId': 'get-by-field-value-for-org', 'field': 'Id', 'value': target.ProfileId, 'orgId': 'xxxxxxxxxx'}); if (profileQuery.result.length === 1) { target.UserType = profileQuery.result[0].UserType; } else { throw {'openidmCode': 400, 'detail': {'message':'Cannot find cached profile matching ' + target.ProfileId} }; } try { existingPSLA = openidm.query(\"managed/PermissionSetLicenseAssign\", { \"_queryId\": \"get-by-field-value-for-org\", \"field\": \"AssigneeId\", \"value\": target._id, 'orgId': 'xxxxxxxxxxx' }); if (existingPSLA.result.length === 0) { openidm.create('system/00Dn0000000D4M7/sobjects/PermissionSetLicenseAssign', { 'PermissionSetLicenseId': '0PL300000008OJ3GAM', 'AssigneeId': target._id }); openidm.create('managed/PermissionSetLicenseAssign', { 'orgId': 'xxxxxxxxxxxx', 'PermissionSetLicenseId': '0PL300000008OJ3GAM', 'AssigneeId': target._id }); } } catch (e) { throw {'openidmCode': 400, 'detail': {'message': 'No Identity Connect Licenses Available.'} }; }" 

Append the following to the end of the source value: 

delete target.TimeZoneSidKey; 
The resulting onUpdate trigger should now look similar to the following: 

"onUpdate" : { 
"type" : "text/javascript", 
"source" : "var profileQuery = openidm.query('managed/Profile', {'_queryId': 'get-by-field-value-for-org', 'field': 'Id', 'value': target.ProfileId, 'orgId': 'xxxxxxxxx'}); if (profileQuery.result.length === 1) { target.UserType = profileQuery.result[0].UserType; } else { throw {'openidmCode': 400, 'detail': {'message':'Cannot find cached profile matching ' + target.ProfileId} }; } try { existingPSLA = openidm.query(\"managed/PermissionSetLicenseAssign\", { \"_queryId\": \"get-by-field-value-for-org\", \"field\": \"AssigneeId\", \"value\": target._id, 'orgId': 'xxxxxxxxxxxxx' }); if (existingPSLA.result.length === 0) { openidm.create('system/00Dn0000000D4M7/sobjects/PermissionSetLicenseAssign', { 'PermissionSetLicenseId': '0PL300000008OJ3GAM', 'AssigneeId': target._id }); openidm.create('managed/PermissionSetLicenseAssign', { 'orgId': 'xxxxxxxxxx', 'PermissionSetLicenseId': '0PL300000008OJ3GAM', 'AssigneeId': target._id }); } } catch (e) { throw {'openidmCode': 400, 'detail': {'message': 'No Identity Connect Licenses Available.'} }; } delete target.TimeZoneSidKey;" 

NOTE: If you have configured multiple Organizations then you will need to perform the above modification for each organization in the sync.json file. 

After having completed the above changes, the behavior will be as follows: 

Upon initial creation of a new user in Salesforce as a result of a synchronization from Active Directory, the TimeZoneSidKey for the user will be set to the default specified in the Identity Connect mapping page. 
Upon updating an existing user in Salesforce, the TimeZoneSidKey will NOT be sent to Salesforce and the existing value as specified in the Salesforce User entry will be maintained. 




promote demote