Customizer: input._requestConfig.body is null in Update Account before hook

Hi Everyone,

I am relatively new to Customizers and am developing one for a Web Services SaaS connector.

Use case

When a user’s email address changes, I need to add the following structure to the Update Account request body:

"communicationChannel": [
    {
        "communicationChannelCode": "EMAIL",
        "communicationValue": "##UserEmail##"
    }
]

Here, ##UserEmail## should be replaced with the updated email value from the provisioning plan.

I have configured the Customizer hook under:

customizedOperation: Update Account:before

Update Account is the HTTP operation used for account updates.

Issue

Based on the SailPoint documentation, I tried retrieving the HTTP operation body using:

input._requestConfig.body

However, input._requestConfig.body is always null.

I can see another property named:

input._requestConfig._body

This property contains the configured HTTP operation body, but its plan placeholders have not yet been resolved. For example, it still contains values such as: $plan.email$

instead of the updated email address.

Because the request body is not populated and the placeholders in _body are not resolved, I cannot determine whether email is present in the provisioning plan or reliably construct the required communicationChannel JSON structure.

I referred to the SailPoint Endpoint Before Customization documentation, which appears to indicate that the request body can be retrieved and modified in a way similar to a Web Services Before Operation Rule.

Could someone please clarify:

  1. Why is input._requestConfig.body null in the Update Account:before hook?
  2. Is input._requestConfig._body intended to be used, even though its plan placeholders have not yet been resolved?
  3. How can I access the provisioning plan or determine whether the email attribute is part of the current update?

If anyone has implemented a similar requirement using a Customizer, an example would be very helpful.

Thanks!

I think the interesting part here is that _body still contains $plan.email$, which makes me think the hook is running before SailPoint resolves the plan values into the final request body.
I wouldn’t rely too much on _body itself since it’s not really part of the documented customizer contract.
Can you check input.changes in beforeStdAccountUpdate and see whether the email change is available there?
If it is, I’d handle the logic there and let the endpoint resolve the $plan.*$ values normally afterward.
If _requestConfig.body is still null after that, then I’d start suspecting a connector/customizer limitation rather than an issue in your code.

Hi Kartik. Amr’s suggestion is in the right direction. I would avoid using _requestConfig._body here, because what you are seeing there is still the request template with $plan.email$ unresolved. Since _requestConfig.body is null while _body still contains $plan.email$, it looks like the final request body has not been built yet at this point.

I would handle the email value a little earlier in beforeStdAccountUpdate instead. That hook gives you the actual account changes through input.changes as attribute, op, and value. You could try something like this:

.beforeStdAccountUpdate(async (context: Context, input: StdAccountUpdateInput) => {

    const emailChange = input.changes?.find(
        change => change.attribute === 'email' && change.op === 'Set'
    )

    if (emailChange) {
        const newEmail = String(emailChange.value)

        emailChange.value =
            `"communicationChannelCode":"EMAIL",` +
            `"communicationValue":${JSON.stringify(newEmail)}`
    }

    return input
})

Then keep the structure in your Update Account body like this:

{
  "communicationChannel": [
    {
      $plan.email$
    }
  ]
}

Web Services SaaS supports $plan.<attribute>$ placeholders in provisioning bodies (reference).

There is also a similar Web Services SaaS example where the value is converted into a JSON fragment in beforeStdAccountUpdate, and that fragment is then inserted into the request body through $plan.*$ (example). I would test one update and check the actual outbound body to make sure the fragment is being inserted exactly as expected.

This changes $plan.email$ from the plain email address into the JSON fragment. If you also need the plain email somewhere else in the same request, I would keep that in a separate attribute instead of reusing email.

Thanks @amrdodani & @punna0001 for your response.

I have tried replacing the email value in beforeStdAccountUpdate, as you have already suggested. However, the request body is a complex JSON structure and the return value from the code is replaced as a string rather than as a JSON attribute.

Also, the body also contains other attributes:

  {
       "documentActionCode": "PARTIAL_CHANGE",
       "userId": "$plan.nativeIdentity$",
       "logisticsGroupCode": "$plan.logisticsGroupCode$",
       "communicationChannel": "$plan.email$"

  }

and in case if I am defining the field as “communicationChannel”: $plan.email$ (without quotes) and the email has not changed, the connector does not remove the complete email attribute from the body. It appears to recognize only the “communicationChannel”: “$plan.email$” format.

I was therefore considering updating the complete request body in the HTTP operation. Example 2 in the Before Operation Customization documentation gives an impression that the request body can be parsed and replaced in a similar way to a Before Operation rule.

However, I may need to find a workaround within beforeStdAccountUpdate instead. If you have handled a similar scenario in beforeStdAccountUpdate where we need to replace complex attribute and other attributes are also present then please suggest an approach. Thanks again!

Hello @Kartiksainihcl. I agree that beforeStdAccountUpdate is not the cleanest place to build communicationChannel here. For normal fields like:

"logisticsGroupCode": "$plan.logisticsGroupCode$"

the placeholder behavior works well, because SailPoint removes the key/value if the value is not in the plan. Your email case is different, because when it changes you need a nested array, and when it does not you need the whole communicationChannel property removed.

The endpoint-customization docs do list input._requestConfig.body as the request body object, and Example 2 shows it being read through body.get('jsonBody') (reference). The one thing I would keep in mind is that the example is for Add Entitlement:before, not Update Account:before.

I would try one simple test before adding more logic. Temporarily use a literal Update Account body:

{
  "test": "value"
}

Then log:

const body = input._requestConfig.body

logger.info('body exists: ' + (body != null))
logger.info('jsonBody: ' + body?.get?.('jsonBody'))
logger.info('_body: ' + input._requestConfig._body)

If jsonBody is populated, then Update Account:before can expose the body, and I would compare the literal case with the $plan.*$ body. If it is still null, I would raise that with SailPoint Support and ask whether input._requestConfig.body is expected to be populated for Update Account:before.

beforeStdAccountUpdate can still be used to detect whether email changed through input.changes, even if the final body shaping happens in the endpoint hook. Let us know what you see with the literal-body test.

Thanks Harish. I did a workaround and created the entire body in an attribute inside the beforeStdAccountUpdate. Although not cleanest approach, but it works.