- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā04-15-2021 02:54 AM
Hi All,
Hope everyone is doing good.
I am working on a catalog form with Variables,
Name (reference to User table), Department, Work Location, Telephone, Email. When value changes in Name variable, all the other variables get populated automatically if the user in Name variable has that values exist. If not, we are allowing users to manually enter values in Department, work location, telephone, email variables.
We have a MRVS with the same variables as mentioned above.
Now, We have a checkbox variable on the same form with name "Self". When user checks it to true, all the values in the Name, Department, work location, telephone, email should be copied to variables in MRVS. If he unchecks, the values should get cleared (only the row should get deleted which is populated when the variable is checked). This should work on change of both Name and Self variables.
Thank you.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā04-21-2021 06:17 AM
Done and working fine in native
please check below output
Please mark my response as correct and close the question.
Regards
Ankur
Ankur
⨠Certified Technical Architect || ⨠9x ServiceNow MVP || ⨠ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā04-19-2021 02:14 AM
Hi,
now obj1 should have json object
try the above code now and share
Regards
Ankur
Ankur
⨠Certified Technical Architect || ⨠9x ServiceNow MVP || ⨠ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā04-19-2021 02:18 AM
Sorry
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā04-19-2021 02:31 AM
Hi,
use this and share the updates
if it contains only 1 object then no for loop required
Regards
Ankur
Ankur
⨠Certified Technical Architect || ⨠9x ServiceNow MVP || ⨠ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā04-19-2021 03:19 AM
Hi
I have modified like below,
parser is showing [object Object] and obj1 is showing undefined. The result is, the value in MRVS is not getting cleared when self is unchecked.
var finalArr = [];
var parser = JSON.parse(details1);
alert (parser);
var obj1 = parser[i];
alert(obj1);
if (obj1.attendee_name.toString() != toRemove.toString()) {
finalArr.push(obj1);
}
g_form.setValue('attendees_information', JSON.stringify(finalArr));
}
I have also checked with the below version, but the same result and obj1 is empty.
var finalArr = [];
var parser = JSON.parse(JSON.stringify(details1));
alert (parser);
var obj1 = parser[i];
alert(obj1);
if (obj1.attendee_name.toString() != toRemove.toString()) {
finalArr.push(obj1);
}
g_form.setValue('attendees_information', JSON.stringify(finalArr));
}
Here we are not defining "i" anywhere right, var obj1 = parser[i] but we used i here.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā04-19-2021 03:37 AM
Hi,
since your arr contains only 1 object no need for i
it should be parser[0];
var finalArr = [];
var parser = JSON.parse(details1);
alert (parser);
var obj1 = parser[0];
alert(obj1);
if (obj1.attendee_name.toString() != toRemove.toString()) {
finalArr.push(obj1);
}
g_form.setValue('attendees_information', JSON.stringify(finalArr));
}
Regards
Ankur
Ankur
⨠Certified Technical Architect || ⨠9x ServiceNow MVP || ⨠ServiceNow Community Leader