- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-20-2025 02:45 AM
Hi Everyone,
I need to write a code in LDAP Transform Map, Transform map already created on sys_user table.
If Employee Type is updating then Supplier Company value should be cleared.
Thanks!
Chhavi Agnihotri
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-20-2025 05:29 AM
yes that BR logic will work in both cases when somebody updates the employee type and also when transform map runs.
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-20-2025 03:20 AM
So employee type is coming from LDAP? Did you check this?
You can use onBefore transform script for this and set the target supplied company as empty
Something like this but please enhance
Give correct source and target fields
(function runTransformScript(source, map, log, target /*undefined onStart*/ ) {
// Add your code here
if (source.u_employee_type != target.employee_type && action == 'update')
target.supplierCompanyField = '';
})(source, map, log, target);
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-20-2025 03:58 AM
Thanks @Ankur Bawiskar for quick response.
It will work.
But now requestor is asking me to do it via Business Rule.
Thanks!
Chhavi Agnihotri
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-20-2025 03:59 AM
Thank you for marking my response as helpful.
I believe I answered your original question.
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-20-2025 04:01 AM
Inform the requestor that it's recommended to handle this via onBefore transform script since you can re-use the transform script
why to create business rule?
if you want to handle via business rule then you can do this
BR: Before Update
Condition: Employee Type Changes
Script:
current.supplied_company = '';
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader