The value of True/false field
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-29-2016 06:08 AM
In my table I have a field called u_active and the type is True/False.
In my record producer I have a drop down field the values of Add and Delete.
When a record is submitted with 'Add' flag the u_active field should be shown as true; and when a record is submitted with 'delete' flag the u_active field should be shown as false.
(we will keep the deleted records in the database as well)
I have set the default value of the u_active field as true in the dictionary.
in the script section of my record producer I have this code:
if(producer.Add_Delete=="Add")
rec.u_active='true';
if(producer.Add_Delete=="Delete")
rec.u_active='false';
rec.update();
} else{
rec.initialize();
rec.u_src_grp_no = group_ids[x];
rec.u_cid = producer.u_cid;
rec.u_renewal_month = producer.u_renewal_month;
rec.u_ctb_prgm_start_dt=producer.u_ctb_prgm_start_dt;
rec.u_ctb_prgm_end_dt=producer.u_ctb_prgm_end_dt;
rec.u_req_type=producer.Add_Delete;
rec.insert();
But it does not work!!!!!!!!!!!!! it always shows True. Any help would be greatly appreciated.
- Labels:
-
Scripting and Coding
-
Team Development

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-29-2016 06:46 AM
I would try something like this and then check the logs to see what is happening.
gs.log('Add_Delete value: ' + producer.Add_Delete, 'RPDebug');
if (producer.Add_Delete == "Add") {
rec.u_active = 'true';
gs.log('Add_Delete: Add', 'RPDebug');
}
if (producer.Add_Delete == "Delete") {
rec.u_active = 'false';
gs.log('Add_Delete: Delete', 'RPDebug');
}
rec.update();
https://instance.service-now.com/syslog_list.do?sysparm_query=source%3DRPDebug
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-29-2016 06:50 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-29-2016 06:53 AM
What do the logs tell you?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-29-2016 06:53 AM
it's very slow. i'm still waiting

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-29-2016 06:56 AM
If the record has already been udpated and the logs don't show up, then you're not getting to that point in the code. Looking at your code it looks like this is only going to be applicablewhen your record producer is updating an existing record and that checkbox will always be true for new records. Are you testing where your record producer is updating existing records or creating new records?