- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-20-2017 05:23 PM
Hello,
I'm currently working on a 'after- insert' Business Rule that initializes a new record using current values, but some are sending an 'undefined' value even though they are full.
All values being managed are from reference fields
For example we have this two fields in the current form.
- Area Desarrollo (u_area_desarrollo)
- Clasificación del Proyecto (u_clasificacion_del_proyecto)
Now.. after they insert that record the business rule triggers and this is the code
// This is the part of the code where the mistake appears
var gr = new GlideRecord('pm_project');
gr.initialize();
gr.u_area_desarrollo = current.u_area_desarrollo;
gr.u_clasificacion_del_proyecto = current.u_clasificacion_del_proyecto;
gr.insert();
After the Business Rule runs, this is how the new record's form shows. You can see that 'Clasificación del Proyecto' got filled, while 'Area Desarrollo' stayed empty.
When I displayed the values in a string, 'Clasificación del Proyecto' brings the sys_id of the reference (as planned) and 'Area Desarrollo' displays a value of 'undefined'. Why is this happening? Any ideas?
If you need any more information please let me know
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-20-2017 05:36 PM
Hello Andres,
Can you replace current.u_area_desarrollo; with current.getValue('u_area_desarrollo'); and check once. Also is there any reference qualifier on the target reference field?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-20-2017 05:36 PM
Hello Andres,
Can you replace current.u_area_desarrollo; with current.getValue('u_area_desarrollo'); and check once. Also is there any reference qualifier on the target reference field?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-20-2017 05:47 PM
It worked, thanks a lot!
Would it be too much if I asked you to explain me why?
What's the difference between assigning directly with only current and using current.getValue('x');

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-20-2017 06:04 PM