The “After share script” section allow you to specify a script that will run after the dynamic share has shared a record. This can be useful for when you run scripts in the Before share script section that you want to then cancel out after the dynamic share has run.
|current||This represents the record that is being shared out|
|dynamicshare_gr||B Release An object corresponding to the dynamic share configuration itself (i.e. you can use dynamicshare_gr.table_name to access the “table” field of the dynamic share)|
One example use case is to use the Before and After share script sections together to specify a language to share out records in. In the Before share script section you would have the following script so all records shared out will have English translated text (for fields that support translation as mentioned in the language link above):
var lang = gs.getSession().getLanguage(); var gc = (typeof GlideController != 'undefined') ? GlideController : Packages.com.glide.script.GlideController; gc.putGlobal('user_lang', lang); gs.getSession().setLanguage("en");
And then in the After share script section, you would cancel this change so it doesn't affect users who are using the system and want to see translations in their selected language:
var gc = (typeof GlideController != 'undefined') ? GlideController : Packages.com.glide.script.GlideController; var userlang = gc.getGlobal('user_lang'); gs.getSession().setLanguage(userlang);