Store Last 4 Digits of Social Security Number (SSN) in Dynamics 365/ CRM – No code approach

Follow my blog for more interesting topics on Dynamics 365, Portals and Power Platform. For training and consulting, write to us at info@xrmforyou.com

Working with Social security number (SSN) is probably a requirement you definitely encountered if you have worked for US customers. And here is one such common requirement – “Store the last 4 digits (serial number) of SSN” in a field.

And trust me there are so many ways you can do this. You can do this using JavaScript. You can do using Plugins/ Workflows. But in all this we forget a no-code approach of doing this. And that is using the calculated field.

This is the format of a Social Security Number – XXX-XX-XXXX. Basically it is 9 digits separated by ‘-‘. Below is the formula for the same.

image

And it just works great! Without the drop of a sweat. And no code.

Well this works fine for our case since Social Security Number is always nine digits. However it won’t work when the input has variable length. In that case you need to resort to client script or business rules.

Hope this helps!

Debajit Dutta

(Microsoft MVP)