- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-01-2024 12:07 PM
I'm importing some department data and there is a custom field called Active. It is a checkbox. The data coming from the source shows either Active or Inactive. If the status is Active, I need the custom field to be checked. If it is Inactive, I need it to be unchecked. I've created an onAfter transform script but it isn't setting the value after the import. Here's the script I'm using:
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-01-2024 02:28 PM
Hey @KeithM1
Is there any particular reason you are doing this in an onAfter instead of just in a field map? It might be more straight forward to do it that way. Setup a field mapping for the field u_active, check the box for "Use source script", then plug in your script with slight modification:
if (source.u_status == "Active"){
gs.info("Source status: " + source.u_status);
return true;
} else if (source.u_status == "Inactive"){
gs.info("Source status: " + source.u_status);
return false
}
Hope this helps!
~Nick

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-01-2024 01:29 PM
Hey @KeithM1
The issue seems to be you have double quotes around "true" and "false". Take those out and set the value to the boolean true/false and you should be good to go.
Hope this helps!
~Nick
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-01-2024 02:07 PM
I tried it with no quotes and with single quotes and no luck
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-01-2024 02:10 PM
Data Type Check on the u_active Field: Make sure that u_active is a boolean or true/false type field in the dictionary. If this field was created as a string or some other type by mistake, it wouldn't work with true/false.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-01-2024 02:28 PM
Hey @KeithM1
Is there any particular reason you are doing this in an onAfter instead of just in a field map? It might be more straight forward to do it that way. Setup a field mapping for the field u_active, check the box for "Use source script", then plug in your script with slight modification:
if (source.u_status == "Active"){
gs.info("Source status: " + source.u_status);
return true;
} else if (source.u_status == "Inactive"){
gs.info("Source status: " + source.u_status);
return false
}
Hope this helps!
~Nick