Announcing the Saviynt Knowledge Exchange unifying the Saviynt forums, documentation, training,
and more in a single search tool across platforms. Read the announcement here.

Only first account is provisioning - ServiceNow - REST

nvachhani
Regular Contributor
Regular Contributor

Only the one account is sending values to ServiceNow table when job is run. For example:

 

Task 1 - User 1 - Create Account

Task 2 - User 2 - Update Account

Task 3 - User 1 - Update Account

 

 

Only Task 1 will send values to ServiceNow. Task 2 and 3 will send attribute variables only (e.g. ${user.customproperty3})

 

Any idea why this is occurring? Below is the JSON being used for all task types:

 

{
    "accountIdPath": "call1.message.result.sys_id",
    "responseColsToPropsMap": {},
    "call": [
        {
            "name": "call1",
            "connection": "acctAuth",
            "url": "https://xxx.service-now.com/api/now/table/u_xxx",
            "httpMethod": "POST",
            "httpParams": "{\"u_first_name\":\"${user.firstname}\",\"u_middle_name\":\"${if(user?.middlename!=null){user?.middlename}else{''}}\",\"u_last_name\":\"${user.lastname}\",\"u_employee_type\":\"${user.employeeType}\",\"u_manager_number\":\"${user.owner}\",\"u_manager\":\"${user.owner}\",\"u_title\":\"${user.title}\",\"u_company\":\"${user.companyname}\",\"u_division\":\"${user.customproperty3}\",\"u_department\":\"${user.departmentname}\",\"u_phone\":\"${if(user?.phonenumber!=null){user?.phonenumber}else{''}}\",\"u_mobile_phone\":\"${if(user?.secondaryPhone!=null){user?.secondaryPhone}else{''}}\",\"u_employee_number\":\"${user.username}\",\"u_function\":\"${user.job_function}\",\"u_job_family_group\":\"${user.customproperty10}\",\"u_job_family\":\"${user.customproperty11}\",\"u_executive\":\"${user.customproperty12}\",\"u_support_organization\":\"${user.customproperty13}\",\"u_cost_center\":\"${user.costcenter}\",\"u_employee_status\":\"${user.statuskey}\",\"u_preferred_first_name\":\"${if(user?.preferedFirstName!=null){user?.preferedFirstName}else{''}}\",\"u_account_expiration_date\":\"${user.termdate}\",\"u_location\":\"${user.location}\",\"u_user_name\":\"${user.systemUserName}\"}",
            "httpHeaders": {
                "Authorization": "${access_token}"
            },
            "httpContentType": "application/json",
            "unsuccessResponses": {
                "error.message": "Operation Failed"
            }
        }
    ]
}

 

10 REPLIES 10

rushikeshvartak
All-Star
All-Star

Are you storing values in accounts column


Regards,
Rushikesh Vartak
If you find the response useful, kindly consider selecting Accept As Solution and clicking on the kudos button.

nvachhani
Regular Contributor
Regular Contributor

We are reconciling accounts, yes. But we are using user attributes when provisioning to target system. 

Vedanth-BK
Regular Contributor
Regular Contributor

hi @nvachhani 
please share the update account json also the provisioning comments that you see for the update account task.
 

Thank you
Vedanth B.K

nvachhani
Regular Contributor
Regular Contributor

The update account json is the same as create account json. We are writing to a table in ServiceNow that updates a main table based on changes.

Provisioning comments:

 

 

 

{"call1":{"headers":"yqml19ySuHDfqY6BdU6Z6CVowM5CVdrGH7CHrJy7z84r85l8n2/06mjMUr7Q+CYq/CIW/9Yohu+7R7uxdiPOHK5vroWFPBzqgqS6IGq+AS9nepBRXwYaUA+SiambeecNgaca4pYm8OJw/lDmwatRK/e7CHOHp/UE3NkWiICeomXfQN63FF3oLYp+Sq2xVB5te6wCs1sjhReaod3IDtGnwGOfGkXItt2hTf3kJ9k4VpGbEtA+zvQB2O+Z3j9MSOa+wEL3QhBcl8byLml3PY3XB4RaQKQE2ykv7zOYmjtOPyDzRkbgmhjjOZKe6QhhEr+A3yr/2terhwxO8mF6DE7jjNXuUi3zMqFmpo16IN5ego3YWVpPzYs","message":{"result":{"u_department":"${user.departmentname}","u_support_organization":"${user.customproperty13}","u_division":"${user.customproperty3}","sys_import_state_comment":"No field values changed","template_import_log":"","sys_updated_on":"2024-02-12 19:10:29","u_middle_name":"${if(user?.middlename!=null){user?.middl","sys_class_name":"u_saviynt_user_details","u_company":"${user.companyname}","u_last_name":"${user.lastname}","sys_target_sys_id":{"link":"https://xxxdev.service-now.com/api/now/table/sys_user/90c145f5db80c694bb3443d913961938","value":"90c145f5db80c694bb3443d913961938"},"u_employee_type":"${user.employeeType}","sys_id":"17a6bb7d1b948ed04e6510ad2d4bcbd3","sys_updated_by":"Saviynt_integration","u_phone":"${if(user?.phonenumber!=null){user?.phon","sys_created_on":"2024-02-12 19:10:29","sys_import_set":{"link":"https://xxxdev.service-now.com/api/now/table/sys_import_set/f5b0ebb5db548ad0bb3443d913961928","value":"f5b0ebb5db548ad0bb3443d913961928"},"sys_transform_map":{"link":"https://xxxdev.service-now.com/api/now/table/sys_transform_map/c252eae6db0b3950bb3443d913961936","value":"c252eae6db0b3950bb3443d913961936"},"sys_created_by":"Saviynt_integration","sys_import_row":"9","u_mobile_phone":"${if(user?.secondaryPhone!=null){user?.s","u_executive":"${user.customproperty12}","sys_row_error":"","sys_target_table":"sys_user","u_employee_status":"${user.statuskey}","u_manager_number":"${user.owner}","u_function":"${user.job_function}","u_title":"${user.title}","sys_mod_count":"1","u_job_family_group":"${user.customproperty10}","import_set_run":{"link":"https://xxxdev.service-now.com/api/now/table/sys_import_set_run/5ba6bb7d1b948ed04e6510ad2d4bcbd4","value":"5ba6bb7d1b948ed04e6510ad2d4bcbd4"},"sys_tags":"","sys_import_state":"ignored","u_locked_out":"","u_job_family":"${user.customproperty11}","u_first_name":"${user.firstname}","u_account_expiration_date":"","u_user_name":"${user.systemUserName}","u_employee_number":"${user.username}","u_location":"${user.location}","u_manager":"${user.owner}","u_cost_center":"${user.costcenter}"}},"statusCode":201,"description":null,"status":"Success"}}

 

Reduce number of attributes and try one of the variable value is not evaluating hence its causing issue


Regards,
Rushikesh Vartak
If you find the response useful, kindly consider selecting Accept As Solution and clicking on the kudos button.

nvachhani
Regular Contributor
Regular Contributor

I will try this. But just curious why it would work for some users and not others? 

nvachhani
Regular Contributor
Regular Contributor

Looks like it fails when adding more than one if/else condition as it is working when I add attributes back one by one until I get to phonenumber(tried phoneNumber as well) and secondaryPhone.

use ternary operator 

${user?.phonenumber ? user.phonenumber : user?.secondaryPhone ? user.secondaryPhone : user?.customproperty29 ? user.customproperty29 : '0000000000'}


Regards,
Rushikesh Vartak
If you find the response useful, kindly consider selecting Accept As Solution and clicking on the kudos button.

nvachhani
Regular Contributor
Regular Contributor

Still the same issue with ternary operators, see below JSON:

 

{
    "accountIdPath": "call1.message.result.sys_id",
    "responseColsToPropsMap": {},
    "call": [
        {
            "name": "call1",
            "connection": "acctAuth",
            "url": "https://xxx.service-now.com/api/now/table/u_saviynt_user_details",
            "httpMethod": "POST",
            "httpParams": "{\"u_first_name\":\"${user.firstname}\",\"u_middle_name\":\"${user?.middlename=null ? '' : user?.middlename}\",\"u_last_name\":\"${user.lastname}\",\"u_employee_type\":\"${user.employeeType}\",\"u_manager_number\":\"${user.owner}\",\"u_manager\":\"${user.owner}\",\"u_title\":\"${user.title}\",\"u_company\":\"${user.companyname}\",\"u_division\":\"${user.customproperty3}\",\"u_department\":\"${user.departmentname}\",\"u_phone\":\"${user?.phonenumber=null ? '' : user?.phonenumber}\",\"u_mobile_phone\":\"${user?.secondaryPhone=null ? '' : user?.secondaryPhone}\",\"u_employee_number\":\"${user.username}\",\"u_function\":\"${user.job_function}\",\"u_job_family_group\":\"${user.customproperty10}\",\"u_job_family\":\"${user.customproperty11}\",\"u_executive\":\"${user.customproperty12}\",\"u_support_organization\":\"${user.customproperty13}\",\"u_cost_center\":\"${user.costcenter}\",\"u_employee_status\":\"${user.statuskey}\",\"u_preferred_first_name\":\"${if(user?.preferedFirstName!=null){user?.preferedFirstName}else{''}}\",\"u_account_expiration_date\":\"${user.termdate}\",\"u_location\":\"${user.location}\",\"u_user_name\":\"${user.systemUserName}\"}",
            "httpHeaders": {
                "Authorization": "${access_token}"
            },
            "httpContentType": "application/json",
            "unsuccessResponses": {
                "error.message": "Operation Failed"
            }
        }
    ]
}

nvachhani
Regular Contributor
Regular Contributor

Issue found:

termdate needed to be termDate