- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-31-2020 01:54 AM
Hi,
I'm facing an issue concerning our record producer development.
I have multiples record producers with a lot of variables set. Everything works as expected except one thing :
Values from form on portal are duplicated inside the 'Variable Editor' of my current table. I know I can't map a variable which is inside a variable set. But I don't want them to be deplicated inside my variable editor.
Any ideas ? Already tried something like this : current.u_version = producer.u_version;
u_version is in a variable set. It ends up in both variable editor and the current object. Which seems wrong ...
Thanks.
Solved! Go to Solution.
- Labels:
-
Service Portal Development
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-17-2020 05:05 AM
Hello Rolf,
Sorry I was in holidays.
I ended up writing a script to hide existing variables in form.
1 -> Create variables that have the same name of those in the target table.
2 -> Write a UI Policie on the target table form.
When to apply : On Load with no conditions
Script :
// Function to hide variables when they already exist in the table
function onCondition() {
// Loop on form elements
for (var i=0; i< g_form.elements.length; i++) {
// Check elements off change_request
if(g_form.elements[i].tableName == "change_request"){
// Hide all existing variables that have the same name of change_request column
g_form.setDisplay('variables.'+g_form.elements[i].fieldName,false);
}
}
}

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-01-2020 05:17 AM
Hi César,
Did you ever find a solution for this? We seem to have the same issue, but in our case it also applies to record producers with regular variables.
Regards,
Rolf
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-17-2020 05:05 AM
Hello Rolf,
Sorry I was in holidays.
I ended up writing a script to hide existing variables in form.
1 -> Create variables that have the same name of those in the target table.
2 -> Write a UI Policie on the target table form.
When to apply : On Load with no conditions
Script :
// Function to hide variables when they already exist in the table
function onCondition() {
// Loop on form elements
for (var i=0; i< g_form.elements.length; i++) {
// Check elements off change_request
if(g_form.elements[i].tableName == "change_request"){
// Hide all existing variables that have the same name of change_request column
g_form.setDisplay('variables.'+g_form.elements[i].fieldName,false);
}
}
}

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-03-2020 03:50 AM
Hi César,
Now it was my turn to be on holiday. Thanks for replying. I will keep your solution in memory, but for now we have opted to revert our sc_cat_item widget to OOB as we too started seing the same issue as Suzanne (https://community.servicenow.com/community?id=community_question&sys_id=89602b9bdb19941023f4a345ca96...) did after moving to New York release. Hopefully this fixes our issue, and could potentially work for you as well. Since we had ever so slightly modfied our widget, we had missed some updates.
Rolf